一、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了。
网页中内嵌MMS流媒体播放该如何设置呢?前几天就遇到过这么一个问题,经过网上一番搜索,具体方法有两种,一是制作ASX文件内嵌调用,二是直接在HTML下写相关调用代码。如果你不是经常使用的,建议还是使用后面一种方法,相对简单方便,现将内嵌代码张贴出来记录一下,以防以后需要用到。
内嵌代码一(简洁版,只适合在IE浏览器下显示):
<object
classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" height="460"
type="application/x-oleobject" width="530"><param name="URL"
value="MMS链接"></object>
内嵌代码二(测试在其它浏览器下也能显示):
<object id="player" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" height="460" width="530">
<param name="URL" value="MMS链接">
<param name="rate" value="1">
<param name="balance" value="0">
<param name="defaultFrame" value="">
<param name="playCount" value="1">
<param name="autoStart" value="1">
<param name="currentMarker" value="0">
<param name="invokeURLs" value="-1">
<param name="baseURL" value="">
<param name="volume" value="50">
<param name="mute" value="0">
<param name="stretchToFit" value="1">
<param name="windowlessVideo" value="0">
<param name="enabled" value="-1">
<param name="enableContextMenu" value="0">
<param name="fullScreen" value="0">
<param name="SAMIStyle" value="">
<param name="SAMILang" value="">
<param name="SAMIFilename" value="">
<param name="captioningID" value="">
<embed src="MMS链接" autostart="1" type="video/x-ms-wmv" width="530" height="460">
</object>
内嵌效果(没加全屏按钮,双击可全屏):
如上面黑屏没内容说明引用MMS地址失效,只要看得见播放器就说明代码生效了。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)