nowPlaying method

Future<void> nowPlaying(
  1. Track track, {
  2. Duration? duration,
  3. Duration? progress,
  4. TonSkip? onSkipForward,
  5. TonSkip? onSkipBackward,
  6. TonPaused? onPaused,
  7. bool? defaultPauseResume,
})

Set the Lock screen fields without starting a new playback.

The fields 'dataBuffer' and 'trackPath' of the Track parameter are not used. Please refer to 'startPlayerFromTrack' for the meaning of the others parameters. Remark setUIProgressBar() is implemented only on iOS.

Example:

Track track = Track( codec: Codec.opusOGG, trackPath: fileUri, trackAuthor: '3 Inches of Blood', trackTitle: 'Axes of Evil', albumArtAsset: albumArt );
await nowPlaying(Track);

Implementation

Future<void> nowPlaying(
  Track track, {
  Duration? duration,
  Duration? progress,
  TonSkip? onSkipForward,
  TonSkip? onSkipBackward,
  TonPaused? onPaused,
  bool? defaultPauseResume,
}) async {
  await _lock.synchronized(() async {
    await _nowPlaying(
      track,
      duration: duration,
      progress: progress,
      onSkipBackward: _onSkipBackward,
      onSkipForward: _onSkipForward,
      onPaused: onPaused,
      defaultPauseResume: defaultPauseResume,
    );
  });
}