我是新来的。我正在使用颤振audio_service
在后台播放音乐。我想隐藏control buttons
在 ios 锁屏中显示。我跟着Suragch的这个教程。我注释掉了显示控制的代码,但它只有控制按钮而不是.disabled
hide
这是 中的通知功能audio_handler.dart
。
void _notifyAudioHandlerAboutPlaybackEvents() {
_player.playbackEventStream.listen((PlaybackEvent event) {
final playing = _player.playing;
playbackState.add(playbackState.value.copyWith(
controls: [
// MediaControl.skipToPrevious,
// if (playing) MediaControl.pause else MediaControl.play,
// MediaControl.stop,
// MediaControl.skipToNext,
],
systemActions: const {
// MediaAction.seek,
},
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],
repeatMode: const {
LoopMode.off: AudioServiceRepeatMode.none,
LoopMode.one: AudioServiceRepeatMode.one,
LoopMode.all: AudioServiceRepeatMode.all,
}[_player.loopMode],
shuffleMode: (_player.shuffleModeEnabled)
? AudioServiceShuffleMode.all
: AudioServiceShuffleMode.none,
playing: playing,
updatePosition: _player.position,
bufferedPosition: _player.bufferedPosition,
speed: _player.speed,
queueIndex: event.currentIndex,
));
});
}