HTML5 Video Stop onClose

后端 未结 9 862
暗喜
暗喜 2020-12-10 11:23

I\'m using jQuery tools for an overlay. Inside the overlay I have an HTML5 video. However, when I close the overlay, the video keeps playing. Any idea how I might get the vi

相关标签:
9条回答
  • 2020-12-10 12:13

    To save hours of coding time, use a jquery plug-in already optimized for embedded video iframes.

    I spent a couple days trying to integrate Vimeo's moogaloop API with jquery tools unsuccessfully. See this list for a handful of easier options.

    0 讨论(0)
  • 2020-12-10 12:15

    If you want to stop every movie tag in your page from playing, this little snippet of jQuery will help you:

    $("video").each(function () { this.pause() });
    
    0 讨论(0)
  • 2020-12-10 12:17

    The problem may be with jquery selector you've chosen $("video") is not a selector

    The right selector may be putting an id element for video tag i.e.
    Let's say your video element looks like this:

    <video id="vid1" width="480" height="267" oster="example.jpg" durationHint="33"> 
        <source src="video1.ogv" /> 
        <source src="video2.ogv" /> 
    </video> 
    

    Then you can select it via $("#vid1") with hash mark (#), id selector in jquery. If a video element is exposed in function,then you have access to HtmlVideoElement (HtmlMediaElement).This elements has control over video element,in your case you can use pause() method for your video element.

    Check reference for VideoElement here.
    Also check that there is a fallback reference here.

    0 讨论(0)
提交回复
热议问题