audio_service icon indicating copy to clipboard operation
audio_service copied to clipboard

iOS not showing controls in Notification center or lock screen

Open hossam-96 opened this issue 2 years ago • 3 comments

Documented behaviour

playbackState.add(playbackState.value.copyWith(
      controls: [
        MediaControl.skipToPrevious,
        if (playing) MediaControl.pause else MediaControl.play,
        MediaControl.stop,
        MediaControl.skipToNext,
      ],
      systemActions: const {
        MediaAction.seek,
        MediaAction.seekForward,
        MediaAction.seekBackward,
      },
      androidCompactActionIndices: const [0, 1, 3],
      processingState: const {
        ProcessingState.idle: AudioProcessingState.idle,
        ProcessingState.loading: AudioProcessingState.loading,
        ProcessingState.buffering: AudioProcessingState.buffering,
        ProcessingState.ready: AudioProcessingState.ready,
        ProcessingState.completed: AudioProcessingState.completed,
      }[_player.processingState]!,
      playing: playing,
      updatePosition: _player.position,
      bufferedPosition: _player.bufferedPosition,
      speed: _player.speed,
      queueIndex: queueIndex,
    ));

This piece of code should show the mentioned controls for both Android and iOS.

Actual behaviour

The controls for play/pause/skipToNext/skipToPrevious doesn't show in the Notification center, I have tried to modify the controls and show MediaControl.rewind instead of skipToPrevious and it showed the icon for rewind normally, the same behavior for fastForward too.

The example works just fine on Android with all the controls showing normally.

Minimal reproduction project

Official example: example_playlist.dart

Reproduction steps

  1. Click the Play button
  2. Check the Notification center or lock screen
  3. You can't find the controls

Output of flutter doctor

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.80.1)
[✓] Connected device (5 available)
[✓] Network resources

• No issues found! 

Devices exhibiting the bug

iPhone 14 Pro Max Simulator - iOS 16.4

Screenshot

simulator_screenshot_11C3E25B-78E4-4E0B-B15E-036FF0944C2C

hossam-96 avatar Aug 03 '23 13:08 hossam-96

@hossam-96 I also faced this issue recently. It is most likely happening in iPhone simulator(at least in my case). So you can try it in a physical device. It should work fine.

spyingcoder avatar Aug 18 '23 07:08 spyingcoder

Yes it worked on the physical device. Why it's not working on the simulator?

hossam-96 avatar Aug 18 '23 08:08 hossam-96

this issue confused me for two weeks 😂, my backend was local, so I just used the simulator

sine233 avatar Jan 09 '25 07:01 sine233