如何解决如何使用 just_audio 在播放列表中使用 firebase 链接
我是 Flutter 的初学者。我目前正在尝试在我的应用程序中添加音频,我使用 just_audio。这运行良好,但我无法从 Firebase 播放音频。这是我从正在运行的示例中获取的代码:
final _playlist = ConcatenatingAudioSource(children: [
AudioSource.uri(
Uri.parse(
"https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3"),tag: AudioMetadata(
album: "Science Friday",title: "A Salute To Head-Scratching Science",),AudioSource.uri(
Uri.parse("https://s3.amazonaws.com/scifri-segments/scifri201711241.mp3"),title: "From Cat Rheology To Operatic Incompetence",AudioSource.uri(
Uri.parse("asset:///audio/nature.mp3"),tag: AudioMetadata(
album: "Public Domain",title: "Nature Sounds",]);
当我尝试用 Firebase 中的链接替换实际链接时,这不起作用。
我来自 firebase 的链接是:
我不明白,因为它与另一个插件一起工作,但我需要将 just_audio 用于其他功能。
非常感谢,
Cinqprien
解决方法
您的服务器(即 firebase 存储)配置了 audio/mpeg
的 Content-Type 标头,但您的实际音频文件是 mp4
文件。如果您使用 audio/mp4
并且可能还使用 video/mp4
,它应该可以工作。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。