如何停止HTML5视频?

问题描述 投票:0回答:1

我有一个弹出视频。当在弹出窗口关闭时使用下面的代码时,视频不会停止缓冲并在重新打开时使用旧的视频参考。这是代码:

HTML:

<div id="w_oPopup">
    <a href="javascript:void(0);" class="w_cExitPopupButton"></a>
    <div id="w_oPlayer">
        <video id="w_oVideoFrame" autoplay loop controls tabindex="0" width="946" height="532" poster="">
            <source src="video.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
        </video>
    </div>
</div>

JS:

$('.w_cExitPopupButton').bind('click', onPopupBlockerClick);

function onPopupBlockerClick(e) {
    $('#w_oPopupBlocker').hide();

    //Here my tries...
    $('#w_oVideoFrame')[0].pause();
    $('#w_oVideoFrame')[0].src = "";
}
javascript jquery html5 html5-video
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.