如何从Firebase存储中加载视频并将其作为React组件返回?
我在Firebase存储中存储了一个视频,并且可以从Firebase访问它的下载URL并尝试这样做:
const App = () => {
var videoRef = storage.ref('myVideo.mp4')
return (
<video width="750" height="500" controls>
<source src={videoRef.getDownloadURL()} />
</video>
)
}
控制台中没有任何错误,但没有加载视频。
有办法这样做吗?
提前致谢!
I have a video stored in my firebase storage and and I'm able to access it's download URL from firebase and trying to do this:
const App = () => {
var videoRef = storage.ref('myVideo.mp4')
return (
<video width="750" height="500" controls>
<source src={videoRef.getDownloadURL()} />
</video>
)
}
There aren't any errors coming up in the console but it doesn't load the video.
Is there a way to do this?
Thank's in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您只想播放一个视频,则可以转到保存该视频的Firebase存储空间。单击它,在您的右边,您将看到名称属性。右键单击下面的链接,然后复制链接地址。
然后,您可以这样做:
if it is only one video you want to play, you can go to your firebase storage where you saved that video. Click on it, to your right you will see Name property. Right click on link below and copy link address.
You can then do this: