Skip to main content Link Menu Expand (external link) Document Search Copy Copied
onProgress property - FlutterSoundPlayer class - player library - Dart API
menu
onProgress

onProgress property

Stream<PlaybackDisposition>? get onProgress

The stream side of the onProgress Controller


This is a stream on which FlutterSound will post the player progression. You may listen to this Stream to have feedback on the current playback.

If you want to receive events on this stream, do not forget to call also setSubscriptionDuration(). If you do not call this verb, you will not receive anything because the default value is 0ms which means not events!

PlaybackDisposition has two fields :

  • Duration duration (the total playback duration)
  • Duration position (the current playback position)

Example

        _playerSubscription = myPlayer.onProgress.listen((e)
        {
                Duration maxDuration = e.duration;
                Duration position = e.position;
                ...
        }
        await _mPlayer.setSubscriptionDuration(
             Duration(milliseconds: 100, // an event each 100 ms
        );

See also


Implementation

Stream<PlaybackDisposition>? get onProgress =>
    _playerController != null ? _playerController!.stream : null;
flutter_sound 9.25.3