Skip to content

iOS random play future timeout #1914

@chrisdrobison

Description

@chrisdrobison

Checklist

  • I read the troubleshooting guide before raising this issue
  • I made sure that the issue I am raising doesn't already exist

Current bug behaviour

This is just started showing up after upgrading to Flutter 3.29. We are seeing this error appear randomly. We are able to reproduce it, but not consistently. We play small audio files one right after the other and use the onPlayerComplete stream to drive playing other files after one is complete.

┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ [error] | 9:57:52 253ms | Unhandled exception
│ TimeoutException after 0:00:30.000000: Future not completed
│ StackTrace: #0      Future.timeout.<anonymous closure> (dart:async/future_impl.dart:1025:22)
│ <asynchronous suspension>
│ #1      Future.wait.<anonymous closure> (dart:async/future.dart:528:21)
│ <asynchronous suspension>
│ #2      AudioPlayer._completePrepared (package:audioplayers/src/audioplayer.dart:366:5)
│ <asynchronous suspension>
│ #3      AudioPlayer.setSourceAsset (package:audioplayers/src/audioplayer.dart:423:5)
│ <asynchronous suspension>
│ #4      AudioPlayer.setSource (package:audioplayers/src/audioplayer.dart:349:5)
│ <asynchronous suspension>
│ #5      AudioPlayer.play (package:audioplayers/src/audioplayer.dart:215:5)
│ <asynchronous suspension>
│ #6      StandProctor._playAndSignalNextTest (package:cognuro/providers/stand_proctor_provider.dart:100:5)
│ <asynchronous suspension>
│ #7      StandProctor._onHandleAwaitState (package:cognuro/providers/stand_proctor_provider.dart:91:7)
│ <asynchronous suspension>
│ }
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────

Expected behaviour

No timeout exception

Steps to reproduce

Code sample

static final AudioPlayer _fixedPlayer = AudioPlayer(playerId: 'stand-player')
    ..audioCache = AudioCache(prefix: 'assets/stand_audio/');

_fixedPlayer.onPlayerComplete.take(1).listen((event) {
  await _fixedPlayer.play(AssetSource('${state.nextTestName}.mp3')); // Timeout is randomly happening here
});

await _fixedPlayer.play(AssetSource('10-open-eyes.mp3'));

Affected platforms

iOS

Platform details

This is occurring across a number of iPad devices. The ones we've tried are iPad (4th and 10th gen), iPad Pro (4th gen). All are running iOS 18.3.2.

AudioPlayers Version

6.4.0

Build mode

release

Audio Files/URLs/Sources

No response

Screenshots

No response

Logs

my relevant logs
Full Logs
my full logs or a link to a gist

Flutter doctor:

Output of: flutter doctor -v

Related issues / more information

No response

Working on PR

yeah

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions