waitUntilStarted method
Wait until playback starts (first true)
Returns true if playback starts before timeout, otherwise false.
Implementation
Future<bool> waitUntilStarted({
Duration timeout = const Duration(seconds: 3),
}) async {
if (_isPlaying) return true;
try {
await onIsPlayingChanged.where((v) => v == true).first.timeout(timeout);
return true;
} on TimeoutException {
FiftyAudioLogger.log('waitUntilStarted() timed out.');
return false;
}
}