将MP3文件上传到Firebase存储最终成为视频/ mp3文件 [英] Uploading MP3 file to Firebase Storage ends up being a video/mp3 file
本文介绍了将MP3文件上传到Firebase存储最终成为视频/ mp3文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
UploadTask uploadAudio = storageRef.putFile(audioUri);
问题是音频存储为视频/ mp4文件,因此MediaPlayer不能将其作为音频再现,我该如何解决这个问题?
解决方案
移动评论回答:
您可以明确地在将文件上传到Firebase时指定元数据。如果您指定 setContentType(audio / mpeg)
,它应该将文件映射到MP3。
Im trying to save an audio in the new Firebase Storage option, the audio is set as a .mp3 file and the uploaded to Firebase via this code : UploadTask uploadAudio = storageRef.putFile(audioUri);
The problem is that the audio is stored as a video/mp4 file, and because of that the MediaPlayer does not reproduce it as an audio, how can I fix this?
解决方案
Moving comment to answer:
You can explicitly specify metadata when you upload the file to Firebase. If you specify setContentType("audio/mpeg")
it should map the file to an MP3 correctly.
这篇关于将MP3文件上传到Firebase存储最终成为视频/ mp3文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文