如何流式传输存储在Google云存储桶中的视频?
问题描述:
我已将视频存储在Google云存储浏览器中.我想在前端播放这些视频.为此,我需要视频URL.但是问题是,每当我导航到该URL时,文件都会被下载.
I have stored videos on google cloud storage browser. I want to play these videos on my frontend. For that I need the video URL. But the problem is, whenever I navigate to that URL, the file gets downloaded.
我该怎么做才能获取存储对象的流式视频URL?
What do I need to do to get the streaming video URL of my stored object?
答
我使用video.js做到了这一点.
I accomplished this using video.js.
<html>
<head>
<link href="https://unpkg.com/video.js/dist/video-js.css" rel="stylesheet">
<style>
.video-js {
width: 600px;
height: 600px;
}
</style>
</head>
<body>
<video-js controls data-setup="{}">
<source src="https://storage.cloud.google.com/bucketName/folderName/recordingName.flv" type="video/flv">
</video-js>
<script src="https://unpkg.com/video.js/dist/video.min.js"></script>
<script src="https://unpkg.com/videojs-flash/dist/videojs-flash.min.js"></script>
</body>
</html>