play method

Future<void> play({
  1. double? endpointSeconds,
})

Plays this Audio content from the beginning.

Note that remote audio streams should not call this to begin playback; call resume instead. Android systems will throw an error if attempting to seek to the start of a remote audio stream.

If endpointSeconds is specified, playback will resume until that point, then stop playback and trigger an onComplete callback. If not specified, audio will play to the end of the file.

Implementation

Future<void> play({double? endpointSeconds}) async {
  if (!_undisposedAudios.containsKey(_audioId)) {
    _logger.severe('Called play() on a disposed Audio');
    return;
  }
  await _playHelper(playFromStart: true, endpointSeconds: endpointSeconds);
}