我试图在播放直播时隐藏搜索栏。我似乎只需要不将它添加到系统操作中,但它仍然出现。起初它只是条形图,然后在 10 秒后出现开始和结束时间以及沿条形图拖动的图标。我的音频处理程序文件中有这个:
playbackState.add(playbackState.value.copyWith(
controls: [
if (playing) MediaControl.pause else MediaControl.play,
],
systemActions: {
MediaAction.rewind,
},
processingState: const {
ProcessingState.idle: AudioProcessingState.idle,
ProcessingState.loading: AudioProcessingState.loading,
ProcessingState.buffering: AudioProcessingState.buffering,
ProcessingState.ready: AudioProcessingState.ready,
ProcessingState.completed: AudioProcessingState.completed,
}[_audioPlayer.processingState]!,
playing: playing,
updatePosition: Duration.zero,
bufferedPosition: Duration.zero,
speed: _audioPlayer.speed,
));
你可以看到我没有添加MediaAction.seek
. 根据https://pub.dev/documentation/audio_service/latest/audio_service/PlaybackState/systemActions.html,您需要添加该操作以使其显示,但无论如何它都会显示。我尝试过不声明 systemActions,设置一个为 false 的布尔值作为添加搜索操作的条件,删除分配的其他值以防万一。但我似乎无法摆脱搜索栏。