控制mp4播放器(对象嵌入)

时间:2014-05-12 07:09:19

标签: javascript object

<? $media_src = htmlspecialchars("src=http://test.com/test.mp4"); ?>

<object id="yPlayer" width="480" height="305" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0">

<param name="movie" value="http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf"></param>
<param name="flashvars" value="<?=media_src?>"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowScriptAccess" value="always"></param>
<embed  src="http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf" type="application/x-shockwave-flash" allowScriptAccess="always" allowfullscreen="true" width="480" height="305" flashvars="<?=media_src?>"></embed></object>

<script>
function go(){document.getElementById("yPlayer").play();}
</script>

go()函数不起作用。帮我.....(php,javascript)

1 个答案:

答案 0 :(得分:0)

尝试类似:

<script type="text/javascript">

    function vidplay() {
       var video = document.getElementById("Video1");
       var button = document.getElementById("play");
       if (video.paused) {
          video.play();
          button.textContent = "||";
       } else {
          video.pause();
          button.textContent = ">";
       }
    }

</script>

</head>
<body>        

<video id="Video1" >
     <source src="demo.mp4" type="video/mp4" />
     HTML5 Video is required for this example. 
</video>

<div id="buttonbar">
    <button id="play" onclick="vidplay()">&gt;</button>
</div>