By: Emiley J in HTML5 Tutorials on 2013年02月17日 [フレーム]
The concept of storing a video and playing it on a webpage is really complicated. You may need to know a little bit of a background of playing videos on the web in order to appreciate what HTML5 does for playing video on a webpage.
Video files are of many types. You would have heard of AVI files and MPEG4 files which are really a container to store video files. I say container because they are equivalent to a zip file which consists of many files of different types. A video file also contains the actual video, the audio and some meta data about the video and saves it in a single file.
So just as you have many different zip file extractors, you also have many video players. Just as there are many type of video files, there are many type of video players and they may not understand all the different types of video files. That is why some of the video files are not playable from some video players.
So if you think of a video player's job, it does three things:
To do steps 2 and 3 above, the player must understand the different codecs that the video/audio was encoded in and then use the same decoder to decode before playing. This is the reason why there is NO Single video player that can play all types of video files. In fact, what YouTube does is when you upload any video file, it converts the video and stores it in a format that the youtube understands which is a flash movie type.
So prior to HTML5 there was no common accepted method to represent and play video on a webpage without the need for a plugin such as silverlight or flash etc, due to the above complexities. So HTML5 introduces a new tag called <video> tag which lets you list all the different formats of the same video within the <video> tag and lets the browser decide which format to use and play the video.
The below code illustrates this.
<video width="560" height="340" controls> <source src="bday.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'> <source src="bday.ogv" type='video/ogg; codecs="theora, vorbis"'> </video>
So with HTML5 you can make sure your video is playable in all browsers and devices, here's what your video workflow will look like:
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Most Viewed Articles (in HTML5 )
user-scalable=no in the meta tag in html
HTML5 Canvas - Using Canvas in HTML5
HTML5 Location - getCurrentPosition() in HTML5
HTML5 Video - Handling video in HTML5
Latest Articles (in HTML5)
© 2023 Java-samples.com
Tutorial Archive: Data Science React Native Android AJAX ASP.net C C++ C# Cocoa Cloud Computing EJB Errors Java Certification Interview iPhone Javascript JSF JSP Java Beans J2ME JDBC Linux Mac OS X MySQL Perl PHP Python Ruby SAP VB.net EJB Struts Trends WebServices XML Office 365 Hibernate
Latest Tutorials on: Data Science React Native Android AJAX ASP.net C Cocoa C++ C# EJB Errors Java Certification Interview iPhone Javascript JSF JSP Java Beans J2ME JDBC Linux Mac OS X MySQL Perl PHP Python Ruby SAP VB.net EJB Struts Cloud Computing WebServices XML Office 365 Hibernate