在 html 中播放 flv
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2248800/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
play flv in html
提问by neeep
Can anyone give a concise instruction on how I can have a flv play from my html page please?
任何人都可以简要说明如何从我的 html 页面播放 flv 吗?
回答by thegauraw
With video.js its very easy. All you need to do is include js & css in head & then use html5 code as:
使用 video.js 非常简单。您需要做的就是在 head 中包含 js 和 css,然后使用 html5 代码作为:
<head>
<link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/c/video.js"></script>
</head>
<body>
<video id="video1" class="video-js vjs-default-skin" width="640" height="480"
data-setup='{"controls" : true, "autoplay" : true, "preload" : "auto"}'>
<source src="video1.flv" type="video/x-flv">
</video>
</body>
For further details: http://videojs.com/Actually, I did not find information specified about playing flv files. But it works fine. :)
有关更多详细信息:http: //videojs.com/实际上,我没有找到有关播放 flv 文件的指定信息。但它工作正常。:)
You can use other video formats using video.js all you need to change is type as...
您可以使用 video.js 使用其他视频格式,您需要更改的只是输入...
<source src="..." type="video/mp4">
Moreover, there might some issue regarding your browser, does your browser support the .mp4 format, I could not play .mp4 in chrome, but it works fine in firefox. Try adding more sources with same video in different formats. Like...
此外,您的浏览器可能存在一些问题,您的浏览器是否支持 .mp4 格式,我无法在 chrome 中播放 .mp4,但它在 Firefox 中运行良好。尝试使用不同格式的相同视频添加更多源。喜欢...
<source src="video1.mp4" type="video/mp4">
<source src="video1.ogg" type="video/ogg">
<source src="video1.webm" type="video/webm">
回答by Matchu
Wrap a flash player around it, such as Flowplayer. There currently is no other way; browsers can't just render an FLV by itself.
在它周围包裹一个 flash 播放器,例如Flowplayer。目前没有其他办法;浏览器不能自己渲染 FLV。
See the installation guide for Flowplayer, taking you step-by-step on how to place the video directly into your HTML.
请参阅Flowplayer的安装指南,逐步指导您如何将视频直接放入 HTML 中。
回答by rectangular
I'm fairly certain that shadowbox can also play FLV files: http://www.shadowbox-js.com/
我很确定 shadowbox 也可以播放 FLV 文件:http: //www.shadowbox-js.com/
It's clean, minimal and fairly simple to setup.
它干净,最小且设置相当简单。
回答by Zhongrui Chen
You can try https://github.com/Bilibili/flv.js
你可以试试https://github.com/Bilibili/flv.js
With flv.js, You'll get:
使用 flv.js,您将获得:
- Pure HTML5 + JavaScript Video Player for flv videos
- Pure HTML5 + JavaScript LiveStream Player for http-flv streams
- Flawless experience
- Smaller size than H.264 Videos
- 用于 flv 视频的纯 HTML5 + JavaScript 视频播放器
- 用于 http-flv 流的纯 HTML5 + JavaScript LiveStream Player
- 完美体验
- 尺寸小于 H.264 视频
Flv.js utilizes MSE (Media Source Extensions) therefore it'll only be available on Chrome 43+, Firefox but not Apple / iOS Safari.
Flv.js 使用 MSE(媒体源扩展),因此它仅适用于 Chrome 43+、Firefox 而不是 Apple / iOS Safari。
Flv.js instantaneously transmuxes flv streams to H.264 streams and then push the H.264 stream to Media Source Extensions. It'll display as a video tag in HTML Element with a blob URL.
Flv.js 立即将 flv 流转换为 H.264 流,然后将 H.264 流推送到媒体源扩展。它将在带有 blob URL 的 HTML 元素中显示为视频标签。
回答by Frederick
Another really popular Flash player is the JW Player, at http://www.longtailvideo.com/. They have a nice setup wizard that generates the code you need.
另一个非常流行的 Flash 播放器是 JW 播放器,位于http://www.longtailvideo.com/。他们有一个很好的设置向导,可以生成您需要的代码。
回答by joejoeson
Insert an SWF object into your HTML and assign the FLV in the attributes as the video that will play.
将 SWF 对象插入到您的 HTML 中,并将属性中的 FLV 指定为要播放的视频。