一、html的video标签的方式,这种方式播放很简单:
<!DOCTYPE hmtl>
<html>
<head>
<title>the5fire m3u8 test</title>
</head>
<body>
<video controls autoplay >
<source src="../v1d30/posts/2014/barcelona/barcelona.m3u8">
</video>
</body>
</html>
二、通过开源的swfobject.js以及两个flash组件:OSMF和HLSProvider来播放,代码如下:
<!DOCTYPE html>
<html>
<head>
<title>the5fire m3u8 test</title>
<script src="../staticfile/swfobject.js"></script>
</head>
<body>
<div id="player">
</div>
<script>
var flashvars = {
// M3U8 url, or any other url which compatible with SMP player (flv, mp4, f4m)
// escaped it for urls with ampersands
src: escape("http://www.the5fire.com/static/demos/diaosi.m3u8"),
// url to OSMF HLS Plugin
plugin_m3u8: "http://www.the5fire.com/static/demos/swf/HLSProviderOSMF.swf",
}
var params = {
// self-explained parameters
allowFullScreen: true,
allowScriptAccess: "always",
bgcolor: "#000000"
}
var attrs = {
name: "player"
}
swfobject.embedSWF(
// url to SMP player
"http://www.the5fire.com/static/demos/swf/StrobeMediaPlayback.swf",
// div id where player will be place
"player",
// width, height
"800", "485",
// minimum flash player version required
"10.2",
// other parameters
null, flashvars, params, attrs
)
</script>
</body>
</html>
通过嵌入以上代码就可以播m3u8了。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)