在网页中经常会用到视频播放的功能,下面介绍一下swfobject.js的视频播放应用:
html代码结构:
<div id="video_content"></div>
css样式结构:
body{background: #003368} #video_content{width:600px;height:400px;margin:200px auto;}
js代码:
function showFLV(flvId,flvUrl,imgUrl,w,h){ var imgUrl = imgUrl; var flvUrl = flvUrl; var w = w || "907"; var h =h || "455"; var s1 = new SWFObject("flvplayer.swf","single",w,h,"7"); s1.addParam("allowfullscreen","true"); s1.addParam("wmode","transparent"); s1.addVariable("file",flvUrl); s1.addVariable("image",imgUrl); s1.addVariable("width",w); s1.addVariable("height",h); s1.addVariable(‘autostart‘,‘true‘); s1.write(flvId); } showFLV(‘video_content‘,‘flv_4.flv‘,‘‘,600,400);
结果实现如图:
作者:风雨后见彩虹
出处:http://www.cnblogs.com/moqiutao/
如果您觉得本文对您的学习有所帮助,请多支持与鼓励。
时间: 2024-10-11 17:35:56