How to detect if a video file is supported by the HTML5 video tag?
I've looked into it more, and canPlayType() can also contain the codec, so you can try:
canPlayType('video/mp4; codecs="avc1.42E01E"');
and
canPlayType('video/mp4; codecs="mp4a.40.2"');
separately for example
Detect if HTML5 Video element is playing
Note : This answer was given in 2011. Please check the updated documentation on HTML5 video before proceeding.
If you just want to know whether the video is paused, use the flag stream.paused
.
There is no property for a video element in getting its playing status. But there is one event "playing" which will be triggered when it starts to play. An Event called "ended" is also triggered when it stops playing.
So the solution is:
- Declare one variable videoStatus.
- Add event handlers for different events of video.
- Update videoStatus using the event handlers.
- Use videoStatus to identify the status of the video.
This page will give you a better idea about video events. Play the video on this page and see how the events are triggered.
http://www.w3.org/2010/05/video/mediaevents.html
HTML5 Video Tag Not Displayed In Compatible Browser
I'd recommend you to read http://goo.gl/4NwNP7 and use flash as fallback option always.
You can't achieve 100% cross-browser solution with only using HTML5 video tag.
Also in your case, one of solutions is https://stackoverflow.com/a/9349984/800639
How to determine if the guest web browser supports html5 <video>
<video>
tags allow content between the tags. Only when the browser does not support <video>
will the content within be rendered on the page.
<video>
<source ogg>
<source mp4>
<embed flv /> <!-- embed only rendered if video not supported-->
</video>
Related Topics
What Does "Top: 0; Left: 0; Bottom: 0; Right: 0;" Mean
:Before &&: After Pseudo Elements Not Showing Firefox
How to Keep Styles After Animation
How to Hide The Arrow That Is Displayed by Default on The HTML5 <Details> Element in Chrome
How to Make Full Height Cell in Full Height Table in Internet Explorer
Subpixel Anti-Aliased Text on HTML5's Canvas Element
Hide Element, But Show CSS Generated Content
Is It Ok to Have Multiple HTML Forms with The Same Name
Old Google Form Redirect After Submission
How to Get a Flexbox to Have a Center Fixed and a Bottom Fixed Children Together
Will Targeting Ie8 with Conditional Comments Work
Why Certain Doctype Declarations Cause 100%-Height Tables and Divs to Stop Working
What Does It Mean When The Form Action Attribute Is "#" (Number/Pound Symbol/Sign/Character)
HTML.Beginform() with an Absolute Url
How Position Absolute and Fixed Block Elements Get Their Dimension