Availability of Video-Tag - html

I used HTML's own video tag instead of the "old" flash way to display a video on my own site:
<video src="video.mp4" preload="auto" autobuffer controls autoplay>
<iframe src="http://player.vimeo.com/video/123456" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
</video>
I tested it on my own computer with 3 different browsers: Chrome (30), Firefox (24) and IE (10). It worked as expected.
Then I asked another user to test my site on different machines with different browsers. Unfortunately it didn't work on all machines, even though he used the same browser versions like me.
Firefox displayed him the following error: Video format or MIME type is not supported.
How is it possible, that the same browsers behave different on
different machines?
Why didn't Firefox display the alternative
content, in my case the vimeo video in the iframe?
Is there a way to ensure and check that my videos will be displayed
in all browsers on all machines?
Thank you!

Firefox has no native MP4/H.264 support, it uses the codec available on the system for this, and in case there is no proper H.264 codec, the video won't play, and you'll receive that error message.
See also http://en.wikipedia.org/wiki/HTML5_video#Supported_video_formats
The fallback content is only used in case the browser doesn't understand the video element at all, unsupported codecs won't cause the fallback to be used.
In order to make sure the video plays in all major browsers, irrespective of the OS, you have to supply the video in different formats using the source element.
Currently using WEBM VP8/9, OGG Theora and MP4 H.264 should do it.
<video preload="auto" autobuffer controls autoplay>
<source src="video.webm" type="video/webm">
<source src="video.ogv" type="video/ogg">
<source src="video.mp4" type="video/mp4">
<iframe src="http://player.vimeo.com/video/123456" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
</video>
You could also try utilizing the error event on the video element or on the last source element, and implement a JavaScript based fallback where you replace the video element with its content.
Example from the W3 specs:
<script>
function fallback(video) {
// replace <video> with its contents
while (video.hasChildNodes()) {
if (video.firstChild instanceof HTMLSourceElement)
video.removeChild(video.firstChild);
else
video.parentNode.insertBefore(video.firstChild, video);
}
video.parentNode.removeChild(video);
}
</script>
<video controls autoplay>
<source src='video.mp4' type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
<source src='video.ogv' type='video/ogg; codecs="theora, vorbis"'
onerror="fallback(parentNode)">
...
</video>
http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#source-default-media

Related

How is the preferred source chosen in the video element?

In the code below:
<video id="video" poster="images/poster.jpg" width="400" height="300" controls >
<source src="movies/clip.mov" type="video/quicktime">
<source src="movies/clip.webm" type="video/webm">
<source src="movies/clip.mp4" type="video/mp4">
<source src="movies/clip.ogg" type="video/ogg">
Get the MP4 version of the video.
</video>
What if the browser supports more than one of the formats I have provided? Like both webm and mp4, which one will be chosen?
They run in the order of the source elements.
https://html.spec.whatwg.org/multipage/media.html#loading-the-media-resource
The <source> element allows you to specify alternative video files which the browser may choose from. The browser will use the first recognized format.

HTML video tag not working on edge

I using a simple HTML5 to play mp4 file but it says this file is not supported only on microsoft edge
I have followed this link https://learn.microsoft.com/en-us/microsoft-edge/dev-guide/html5/video here is my code:
<video width="500" height="300" controls autoplay loop>
<source src="video/video.mp4" type="video/mp4" />
<source src="video/video.webm" type="video/webm" />
<source src="video/video.ogv" type="video/ogg" />
Your browser does not support HTML5 video.
</video>
It works fine on opera, chrome and firefox
There is the possibility the mp4 file is in the newer H265 / HEVC format which is not supported in Windows 10, Edge or the Movies and Photos App
If the title of the mp4 file contains H265 or HEVC, then you will need to download a media player that supports this new format.
Also you can see more here Microsoft Edge and <VIDEO>
What version of edge are you running?
You could create a you tube video and then include it that way.
<iframe width="420" height="315" src="https://www.youtube.com/embed/tgbNymZ7vqY"></iframe>
Source tags are empty elements and should not be closed. Remove the closures like so:
<source src="video/video.mp4" type="video/mp4">
<source src="video/video.webm" type="video/webm">
<source src="video/video.ogv" type="video/ogg">

Microsoft Edge and <VIDEO>

I have looked everywhere online to try and solve this issue.
I have got the following code on my website which works fine on all browsers apart from Microsoft Edge, it simply says that the content is not supported, so it is recognising the video tag.
I'm displaying an MP4 video, codec: H.264, AAC
<video width="100%" controls id="slider-video">
<!-- <source src="img-src/{v2_FOLDER}/theme/GMS_Final.webm" type="video/webm"> -->
<source src="img-src/{v2_FOLDER}/theme/GMS_Final.mp4" type='video/mp4; codecs="avc1.64001E, mp4a.40.2"'>
<p>Your browser does not support the video tag.</p>
</video>
As you can see, I have even tried using an webm but this also doesn't work... any ideas?
Updated Code:
<video width="100%" controls id="slider-video">
<source src="http://devsite6.clickserverdev.co.uk/img-src/_themev2-germanmotorspecialist-1131/theme/GMS_Final.webm" type="video/webm">
<source src="http://devsite6.clickserverdev.co.uk/img-src/_themev2-germanmotorspecialist-1131/theme/GMS_Final.mp4" type="video/mp4">
<source src="http://devsite6.clickserverdev.co.uk/img-src/_themev2-germanmotorspecialist-1131/theme/GMS_Final.m4v" type="video/m4v">
<source src="http://devsite6.clickserverdev.co.uk/img-src/_themev2-germanmotorspecialist-1131/theme/GMS_Final.ogg" type="video/ogg">
</video>
Make sure to use the correct MP4 compression with H264 codec (maximum 720p of resolution) with AC3 audio on it.
Edge is like browsers on iPad/iPhone and needs the same H264 compression style.
Drag and drop your mp4 video file to IE-Edge to play it directly from local file system. So you will be sure if your video correctly converted.

How to open .mov format video in HTML video Tag?

I want to play .mov video like as this, but video doesn't play in any browser.
<video width="400" controls Autoplay=autoplay>
<source src="D:/mov1.mov" type="video/mov">
</video>
You can use below code:
<video width="400" controls autoplay>
<source src="D:/mov1.mov" type="video/mp4">
</video>
this code will help you.
Instead of using <source> tag, use <src> attribute of <video> as below and you will see the action.
<video width="320" height="240" src="mov1.mov"></video>
or
you can give multiple tags within the tag, each with a different video source. The browser will automatically go through the list and pick the first one it’s able to play. For example:
<video id="sampleMovie" width="640" height="360" preload controls>
<source src="HTML5Sample_H264.mov" />
<source src="HTML5Sample_Ogg.ogv" />
<source src="HTML5Sample_WebM.webm" />
</video>
If you test that code in Chrome, you’ll get the H.264 video. Run it in Firefox, though, and you’ll see the Ogg video in the same place.
Unfortunately .mov files are not supported with html5 video playback. You can see what filetypes are supported here:
https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats
If you need to be able to play these formats with your html5 video player, you'll need to first convert your videofile--perhaps with something like this:
https://www.npmjs.com/package/html5-media-converter
Content Type for MOV videos are video/quicktime in my case. Adding type="video/mp4" to MOV video file solved issue in my case.
<video width="400" controls Autoplay=autoplay>
<source src="D:/mov1.mov" type="video/mp4">
</video>
in the video source change the type to "video/quicktime"
<video width="400" controls Autoplay=autoplay>
<source src="D:/mov1.mov" type="video/quicktime">
</video>
You can use Controls attribute
<video id="sampleMovie" src="HTML5Sample.mov" controls></video>
My new answer is to use ffmpeg to transcode the .mov like ffmpeg -i sourceFile.mov destinationFile.mp4. Do same for the webm format.
OLD Answer:
Here's what you do:
Upload your video to Youtube.
Install the "Complete YouTube Saver" plugin for Firefox
Using the plugin in Firefox, download both the MP4 and WEBM formats and place them on your Web server
Add the HTML5 Video element to your webpage per MDN's recommendation
<video controls>
<source src="somevideo.webm" type="video/webm">
<source src="somevideo.mp4" type="video/mp4">
I'm sorry; your browser doesn't support HTML5 video in WebM with VP8/VP9 or MP4 with H.264.
<!-- You can embed a Flash player here, to play your mp4 video in older browsers -->
</video>
Style the <video> element with CSS to suit your needs. For example Materializecss has a simple helper class to render the video nicely across device types.

HTML5 video tag doesn't work in FF

On this site, the video doesn't play in FF. But it does play in Chrome. Is there anything I need to add?
<video width="580" height="318" controls poster="link to poster">
<source src="link to video">
Your browser does not support the HTML5 Video tag. Please update to a modern browser.
</video>
In your site's source:
<source src="/wp-content/themes/bigframe/media/bigframe_reel.mp4">
Firefox doesn't support mp4 videos for HTML5 video.
You can add additional sources (WebM, OGG), and fallback to a Flash player. See this table for compatibility.
You can solve the problem by providing video or audio encoded in different formats for different browsers.
<video controls>
<source src="foo.ogg" type="video/ogg">
<source src="foo.mp4" type="video/mp4">
Your browser does not support the <code>video</code> element.
</video>