{"id":7018,"date":"2013-01-28T05:41:17","date_gmt":"2013-01-28T05:41:17","guid":{"rendered":"http:\/\/vskills.in\/certification\/tutorial\/?p=7018"},"modified":"2024-04-12T14:13:35","modified_gmt":"2024-04-12T08:43:35","slug":"html5-audio-and-video","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/","title":{"rendered":"HTML5 Audio and Video"},"content":{"rendered":"<h4><strong>HTML5 Audio and Video<\/strong><\/h4>\n<p>HTML5 includes native audio and video support without the need for Flash or any other plug-ins. The HTML5 &lt;audio&gt; and &lt;video&gt; tags make it simple to add media to a website. It helps in configuring the src attribute to identify the media source and including controls attribute so the user can play and pause the media.<\/p>\n<p><strong>HTML5 Video<\/strong> &#8211; The simplest form of embedding a video file is<\/p>\n<p>&lt;video src=&#8221;foo.mp4&#8243; width=&#8221;300&#8243; height=&#8221;200&#8243; controls&gt;<\/p>\n<p>Your browser does not support the &lt;video&gt; element.<\/p>\n<p>&lt;\/video&gt;<\/p>\n<p>The current HTML5 draft specification does not specify which video formats browsers should support in the video tag. But most commonly used video formats are:<\/p>\n<ul>\n<li>Ogg: Ogg files with Thedora video codec and Vorbis audio codec.<\/li>\n<li>mpeg4: MPEG4 files with H.264 video codec and AAC audio codec<\/li>\n<\/ul>\n<p>The &lt;source&gt; tag is used to specify media along with media type and many other attributes. A video element allows multiple source elements and browser will use the first recognized format as<\/p>\n<p>&lt;video width=&#8221;300&#8243; height=&#8221;200&#8243; controls autoplay&gt;<\/p>\n<p>&lt;source src=&#8221;\/html5\/foo.ogg&#8221; type=&#8221;video\/ogg&#8221; \/&gt;<\/p>\n<p>&lt;source src=&#8221;\/html5\/foo.mp4&#8243; type=&#8221;video\/mp4&#8243; \/&gt;<\/p>\n<p>Your browser does not support the &lt;video&gt; element.<\/p>\n<p>&lt;\/video&gt;<\/p>\n<p><strong>HTML5 Video Attribute<\/strong> &#8211; The HTML5 video tag can have a number of attributes to control the look and feel and various functionalities of the control as<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"91\"><strong>Attribute<\/strong><\/td>\n<td width=\"468\"><strong>Detail<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"91\">autoplay<\/td>\n<td width=\"468\">It specifies, whether video will automatically plays as soon as it can do so without stopping to finish loading the data.<\/td>\n<\/tr>\n<tr>\n<td width=\"91\">autobuffer<\/td>\n<td width=\"468\">It specifies, the video will automatically begin buffering even if it&#8217;s not set to automatically play.<\/td>\n<\/tr>\n<tr>\n<td width=\"91\">controls<\/td>\n<td width=\"468\">It allows user to control video playback, including volume, seeking, and pause\/resume playback.<\/td>\n<\/tr>\n<tr>\n<td width=\"91\">height<\/td>\n<td width=\"468\">It specifies the height of the video&#8217;s display area, in pixels.<\/td>\n<\/tr>\n<tr>\n<td width=\"91\">loop<\/td>\n<td width=\"468\">It allows video automatically seek back to start after reaching at end.<\/td>\n<\/tr>\n<tr>\n<td width=\"91\">preload<\/td>\n<td width=\"468\">It specifies if video will be loaded at page load, and ready to run.<\/td>\n<\/tr>\n<tr>\n<td width=\"91\">poster<\/td>\n<td width=\"468\">This is a URL of an image to show until the user plays or seeks.<\/td>\n<\/tr>\n<tr>\n<td width=\"91\">src<\/td>\n<td width=\"468\">The URL of video to embed. The &lt;source&gt; element can also be used<\/td>\n<\/tr>\n<tr>\n<td width=\"91\">width<\/td>\n<td width=\"468\">It specifies the width of the video&#8217;s display area, in pixels.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>HTML5 Audio<\/strong> &#8211; HTML5 supports &lt;audio&gt; tag which is used to embed sound content in an HTML or XHTML document as<\/p>\n<p>&lt;audio src=&#8221;foo.wav&#8221; controls autoplay&gt;<\/p>\n<p>Your browser does not support the &lt;audio&gt; element.<\/p>\n<p>&lt;\/audio&gt;<\/p>\n<p>The current HTML5 draft specification does not specify which audio formats browsers should support in the audio tag. But most commonly used audio formats are ogg, mp3 and wav.<\/p>\n<p>The &lt;source&gt; tag is used to specify media along with media type and many other attributes. An audio element allows multiple source elements and browser will use the first recognized format.<\/p>\n<p>&lt;audio controls autoplay&gt;<\/p>\n<p>&lt;source src=&#8221;\/html5\/audio.ogg&#8221; type=&#8221;audio\/ogg&#8221; \/&gt;<\/p>\n<p>&lt;source src=&#8221;\/html5\/audio.wav&#8221; type=&#8221;audio\/wav&#8221; \/&gt;<\/p>\n<p>Your browser does not support the &lt;audio&gt; element.<\/p>\n<p>&lt;\/audio&gt;<\/p>\n<p><strong>HTML5 Audio Attribute<\/strong> &#8211; The HTML5 audio tag can have a number of attributes to control the look and feel and various functionalities of the control which are<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"91\"><strong>Attribute<\/strong><\/td>\n<td width=\"468\"><strong>Detail<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"91\">autoplay<\/td>\n<td width=\"468\">It specifies, whether audio will automatically plays as soon as it can do so without stopping to finish loading the data.<\/td>\n<\/tr>\n<tr>\n<td width=\"91\">autobuffer<\/td>\n<td width=\"468\">It specifies, the audio will automatically begin buffering even if it&#8217;s not set to automatically play.<\/td>\n<\/tr>\n<tr>\n<td width=\"91\">controls<\/td>\n<td width=\"468\">It allows user to control audio playback, including volume, seeking, and pause\/resume playback.<\/td>\n<\/tr>\n<tr>\n<td width=\"91\">loop<\/td>\n<td width=\"468\">It allows audio automatically seek back to start after reaching at end.<\/td>\n<\/tr>\n<tr>\n<td width=\"91\">preload<\/td>\n<td width=\"468\">It specifies if audio will be loaded at page load, and ready to run.<\/td>\n<\/tr>\n<tr>\n<td width=\"91\">src<\/td>\n<td width=\"468\">The URL of audio to embed. The &lt;source&gt; element can also be used<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>HTML5 Media Events<\/strong> &#8211; The HTML5 audio and video tag can have a number of attributes to control various functionalities of the control using Javascript as<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"108\"><strong>Event<\/strong><\/td>\n<td width=\"468\"><strong>Detail<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"108\">abort<\/td>\n<td width=\"468\">This event is for when playback is aborted.<\/td>\n<\/tr>\n<tr>\n<td width=\"108\">canplay<\/td>\n<td width=\"468\">This event is for when enough data is available that the media can be played.<\/td>\n<\/tr>\n<tr>\n<td width=\"108\">ended<\/td>\n<td width=\"468\">This event is for when playback completes.<\/td>\n<\/tr>\n<tr>\n<td width=\"108\">error<\/td>\n<td width=\"468\">This event is for when an error occurs.<\/td>\n<\/tr>\n<tr>\n<td width=\"108\">loadeddata<\/td>\n<td width=\"468\">This event is for when the first frame of the media has finished loading.<\/td>\n<\/tr>\n<tr>\n<td width=\"108\">loadstart<\/td>\n<td width=\"468\">This event is for when loading of the media begins.<\/td>\n<\/tr>\n<tr>\n<td width=\"108\">pause<\/td>\n<td width=\"468\">This event is for when playback is paused.<\/td>\n<\/tr>\n<tr>\n<td width=\"108\">play<\/td>\n<td width=\"468\">This event is for when playback starts or resumes.<\/td>\n<\/tr>\n<tr>\n<td width=\"108\">progress<\/td>\n<td width=\"468\">This event is for periodically to inform the progress of the downloading the media.<\/td>\n<\/tr>\n<tr>\n<td width=\"108\">ratechange<\/td>\n<td width=\"468\">This event is for when the playback speed changes.<\/td>\n<\/tr>\n<tr>\n<td width=\"108\">seeked<\/td>\n<td width=\"468\">This event is for when a seek operation completes.<\/td>\n<\/tr>\n<tr>\n<td width=\"108\">seeking<\/td>\n<td width=\"468\">This event is for when a seek operation begins.<\/td>\n<\/tr>\n<tr>\n<td width=\"108\">suspend<\/td>\n<td width=\"468\">This event is for when loading of the media is suspended.<\/td>\n<\/tr>\n<tr>\n<td width=\"108\">volumechange<\/td>\n<td width=\"468\">This event is for when the audio volume changes.<\/td>\n<\/tr>\n<tr>\n<td width=\"108\">waiting<\/td>\n<td width=\"468\">This event is for when the requested operation (such as playback) is delayed pending the completion of another operation (such as a seek).<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Following is the example which allows to play the given video:<\/p>\n<p>&lt;!DOCTYPE HTML&gt;<\/p>\n<p>&lt;head&gt;<\/p>\n<p>&lt;script type=&#8221;text\/javascript&#8221;&gt;<\/p>\n<p>function PlayVideo(){<\/p>\n<p>var v = document.getElementsByTagName(&#8220;video&#8221;)[0];<\/p>\n<p>v.play();<\/p>\n<p>}<\/p>\n<p>&lt;\/script&gt;<\/p>\n<p>&lt;\/head&gt;<\/p>\n<p>&lt;html&gt;<\/p>\n<p>&lt;body&gt;<\/p>\n<p>&lt;form&gt;<\/p>\n<p>&lt;video width=&#8221;300&#8243; height=&#8221;200&#8243; src=&#8221;\/html5\/foo.mp4&#8243;&gt;<\/p>\n<p>Your browser does not support the &lt;video&gt; element.<\/p>\n<p>&lt;\/video&gt;<\/p>\n<p>&lt;input type=&#8221;button&#8221; onclick=&#8221;PlayVideo();&#8221; value=&#8221;Play&#8221;\/&gt;<\/p>\n<p>&lt;\/form&gt;<\/p>\n<p>&lt;\/body&gt;<\/p>\n<p>&lt;\/html&gt;<\/p>\n<h3>Apply for HTML5 Certification Now!!<\/h3>\n<p><a href=\"http:\/\/www.vskills.in\/certification\/Certified-HTML5-Developer\" target=\"_blank\" rel=\"noopener\">http:\/\/www.vskills.in\/certification\/Certified-HTML5-Developer<\/a><\/p>\n<h4><a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/certified-html5-developer\/\" target=\"_blank\" rel=\"noopener\"><strong>Back to Tutorial<\/strong><\/a><\/h4>\n<div class=\"apply\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>HTML5 Audio and Video HTML5 includes native audio and video support without the need for Flash or any other plug-ins. The HTML5 &lt;audio&gt; and &lt;video&gt; tags make it simple to add media to a website. It helps in configuring the src attribute to identify the media source and including controls attribute so the user can&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[135],"tags":[6768,2555,6767,2444],"class_list":["post-7018","page","type-page","status-publish","hentry","category-html5-developer","tag-html5","tag-html5-audio-and-video","tag-html5-developer","tag-html5-developer-certification"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>HTML5 Audio and Video - Tutorial<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HTML5 Audio and Video - Tutorial\" \/>\n<meta property=\"og:description\" content=\"HTML5 Audio and Video HTML5 includes native audio and video support without the need for Flash or any other plug-ins. The HTML5 &lt;audio&gt; and &lt;video&gt; tags make it simple to add media to a website. It helps in configuring the src attribute to identify the media source and including controls attribute so the user can...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T08:43:35+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/\",\"name\":\"HTML5 Audio and Video - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"datePublished\":\"2013-01-28T05:41:17+00:00\",\"dateModified\":\"2024-04-12T08:43:35+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HTML5 Audio and Video\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HTML5 Audio and Video - Tutorial","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/","og_locale":"en_US","og_type":"article","og_title":"HTML5 Audio and Video - Tutorial","og_description":"HTML5 Audio and Video HTML5 includes native audio and video support without the need for Flash or any other plug-ins. The HTML5 &lt;audio&gt; and &lt;video&gt; tags make it simple to add media to a website. It helps in configuring the src attribute to identify the media source and including controls attribute so the user can...","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T08:43:35+00:00","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/","name":"HTML5 Audio and Video - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"datePublished":"2013-01-28T05:41:17+00:00","dateModified":"2024-04-12T08:43:35+00:00","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/html5-audio-and-video\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"HTML5 Audio and Video"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/7018","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=7018"}],"version-history":[{"count":8,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/7018\/revisions"}],"predecessor-version":[{"id":126519,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/7018\/revisions\/126519"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=7018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=7018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=7018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}