iOS not showing controls in Notification center or lock screen
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
- Click the Play button
- Check the Notification center or lock screen
- 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
@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.
Yes it worked on the physical device. Why it's not working on the simulator?
this issue confused me for two weeks 😂, my backend was local, so I just used the simulator