有时当我单击“关闭”按钮(在视频加载之前)时,视频的音频仍然在后台播放?我正在使用以下代码关闭视频:
$(document).ready(function() {
var a = $
a("img").click(function() {
a("#trailer").fadeOut(300)
a("video").remove();
更多代码:
<div id="trailer">
<img id="close" src="images/close.png" alt="close" />
<div id="video">
<video controls autoplay="autoplay" poster="video/trailer.jpg" width="600" onclick="if(/Android/.test(navigator.userAgent))this.play();">
<source src="video/trailer.mp4" type="video/mp4" />
<source src="video/trailer.webm" type="video/webm" />
<source src="video/trailer.ogv" type="video/ogg" />
<embed src="video/flashfox.swf" width="600" height="480" flashVars="autoplay=true&controls=true&loop=true&src=trailer.mp4" allowFullScreen="true" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_en" />
</video>
</div>
</div>
谢谢!
编辑
代码在此段中不起作用。
a("#trailerb").click(function() {
a("video")[0].pause().remove();
a("#trailer").show("50");
a("#video").load("video.html");
应该发生的是单击任何正在播放的视频,暂停并从视图中删除,然后从 .load 方法中弹出一个新视频:这是 video.html 中的代码
<video controls="controls" autoplay="autoplay" poster="video/trailer.jpg" width="600" height="" onclick="if(/Android/.test(navigator.userAgent))this.play();">
<source src="video/trailer.mp4" type="video/mp4" />
<source src="video/trailer.webm" type="video/webm" />
<source src="video/trailer.ogv" type="video/ogg" />
<embed src="video/flashfox.swf" width="600" height="480" flashVars="autoplay=true&controls=true&loop=true&src=trailer.mp4" allowFullScreen="true" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_en" />
</video>
目前点击“#trailerb”只会暂停任何视频播放,而不执行:
a("#trailer").show("50");
a("#video").load("video.html");
谢谢你的时间!!!