如何从Firebase存储流式传输mp3音频 [英] how to stream a mp3 audio from firebase storage

查看:87
本文介绍了如何从Firebase存储流式传输mp3音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用,该应用将流式存储在Firebase存储器中的mp3文件.我几乎有100首歌曲,例如song1,song2,song3 ......如果选择了某首歌曲,则必须流该特定歌曲而不下载.在这种情况下,我需要编写大量代码,因为对于每首歌曲,我都必须提及Firebase存储URL.网址就像

I'm developing an app that will stream mp3 file stored in firebase storage. Nearly I'm having 100 songs like song1,song2,song3..... if a song is selected I have to stream that particular song without downloading. In such case I need to write plenty of code because for each song I have to mention the firebase storage url. the url would be like

https://firebasestorage.googleapis.com/......song1.mp3?alt=media&token=8a8a0593-e8bb-40c7-87e0-814d9c8342f3

对于每首歌曲,URL的 alt = media& token = 部分各不相同,因此我必须提及所有歌曲的唯一URL.但是在这里,我需要一些简化的编码来播放歌曲,方法是从Firebase存储中单独提及歌曲的名称.

For each song the alt=media&token= part of the url varies, so I have to mention the unique url for all songs. But here I need some simplified coding to play the songs by mentioning its name alone from firebase storage.

请提出一种仅使用存储在Firebase存储器中的名称来流式传输音频文件的方法.

Please suggest a way to stream the audio file by using its name alone that is stored in firebase storage.

推荐答案

如果要将文件从Firebase存储桶中取出,则有两种选择.

You have two choices if you want to get files out of a Firebase Storage bucket.

  1. 使用您可以从存储参考中获得的完整下载URL,该URL指向存储桶中的文件路径.
  2. 使用下载任务(Android或iOS)从文件中获取数据.

您无法从移动应用程序中以其他任何方式获取文件数据. Firebase存储不支持特殊的媒体流协议,例如RTSP.

You can't get the file data any other way from within a mobile app. Firebase Storage doesn't support special media streaming protocols, such as RTSP.

这篇关于如何从Firebase存储流式传输mp3音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆