我正在使用 audio_service flutter 包在后台播放音频并从锁定屏幕和通知栏进行控制。这工作正常。我刚刚面临的问题是图标在 Android 中不显示,而在 iOS 中图标显示,但显示太小。附上下面的截图:
Android 中的通知图标必须为白色或黑色。不接受白色或黑色以外的任何其他颜色,并导致空白的白色方形符号。您可以检查此网站以获取通知图标生成。您甚至可以在通知栏中查看 Spotify 应用程序图标的外观。
就我而言,我缺少 artUri 设置:
MediaItem item = MediaItem(
id: 'https://example.com/audio.mp3',
title: 'episode title',
artUri: Uri.parse('https://example.com/image.png'), // <-- this was missing
);