SlideShare a Scribd company logo
1 of 15
HTML 5- Audio and Video Player
HTML5 features include native audio and video support without the need
for Flash.
The HTML5 <audio> and <video> tags make it simple to add media to a
website. You need to set src attribute to identify the media source and
include a controls attribute so the user can play and pause the media.
Embedding Video
Here is the simplest form of embedding a video file in your webpage -
<video src = "foo . mp4" width= " 300" height = "200" controls> Your browser
does not support the element. </video>
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 –
 Ogg - Ogg files with Thedora video codec and Vorbis audio codec.
 mpeg4 - MPEG4 files with H.264 video codec and AAC audio codec.
You can use <source> tag 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 -
< ! DOCTYPE HTML >
<html>
<video width="300" height="200" controls autoplay>
<source src ="/htm15/foo.ogg" type ="video/ogg" / > <source src=
"/htm15/foo.mp4" type= "video/mp4" / > Your browser does not support the
element.
</video>
</html>
This will produce the following result -
0:00 / 0:19
Video Attribute Specification
The HTML5 video tag can have a number of attributes to control the look and feel and
various functionalities of the control -
Sr.No Attribute & Description
1 autoplay
This Boolean attribute if specified, the video will automatically begin to play back
as soon as it can do so without stopping to finish loading the data.
2 autobuffer
This Boolean attribute if specified, the video will automatically begin buffering
even if it's not set to automatically play.
3 controls
If this attribute is present, it will allow the user to control video playback,
including volume, seeking, and pause/resume playback.
4 height
This attribute specifies the height of the video's display area, in CSS pixels.
5 loop
This Boolean attribute if specified, will allow video automatically seek
back to the start after reaching at the end
6 preload
This attribute specifies that the video will be loaded at page load, and
ready to run. Ignored if autoplay is present.
7 poster
This is a URL of an image to show until the user plays or seeks.
8 src
The URL of the video to embed. This is optional; you may instead use the
<source> element within the video block to specify the video to embed.
9 width
This attribute specifies the width of the video's display area, in CSS
pixels.
Embedding Audio
HTML5 supports <audio> tag which is used to embed sound content in an HTML or
XHTML document as follows.
<audio src = "foo.wav" controls autoplay>
Your browser does not support the element. </audio>
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.
You can use <source&ggt; tag 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
< ! DOCTYPE HTML >
<html>
<audio controls autoplay>
<source src=" / html 5/ audio.ogg" type="audio/ogg">
<source src="/htm15/audio.wav" type ="audio/wav does not
support the element.
Your browser
</audio>
</html>
This will produce the following result -
0:02 / 0:02
Audio Attribute Specification
The HTML5 audio tag can have a number of attributes to control the look and feel and
various functionalities of the control -
Sr.No Attribute & Description
1 Autoplay
This Boolean attribute if specified, the audio will automatically begin to
play back as soon as it can do so without stopping to finish loading the
data.
2 autobuffer
This Boolean attribute if specified, the audio will automatically begin
buffering even if it's not set to automatically play.
3 controls
If this attribute is present, it will allow the user to control audio
playback, including volume, seeking, and pause/resume playback.
4 loop
This Boolean attribute if specified, will allow audio automatically seek
back to the start after reaching at the end.
5 preload
This attribute specifies that the audio will be loaded at page load,
and ready to run. Ignored if autoplay is present.
6 src
The URL of the audio to embed. This is optional; you may instead
use the <source> element within the video block to specify the
video to embed.
Handling Media Events
The HTML5 audio and video tag can have a number of attributes to control
various functionalities of the control using JavaScript -
Sr.No Event & Description
1 abort
This event is generated when playback is aborted.
2 canplay
This event is generated when enough data is available that the media
can be played.
3 ended
This event is generated when playback completes.
4 error
This event is generated when an error occurs.
5 loadeddata
This event is generated when the first frame of the media has finished
loading.
6 loadstart
This event is generated when loading of the media begins.
7 pause
This event is generated when playback is paused.
8 play
This event is generated when playback starts or resumes.
9 progress
This event is generated periodically to inform the progress of the
downloading the media.
10 ratechange
This event is generated when the playback speed changes.
11 Seeked
This event is generated when a seek operation completes.
12 seeking
This event is generated when a seek operation begins.
13 seeking
This event is generated when a seek operation begins.
13
suspend
This event is generated when loading of the media is suspended.
14
volumechange
This event is generated when the audio volume changes.
15
waiting
This event is generated when the requested operation (such as playback) is
delayed pending the completion of another operation (such as a seek).
Following is the example which allows to play the given video
-
<!doctype HTML >
<html>
<head>
<script type="text/javascript"> function PlayVideo() { var v =
document.getE1ementsByTagName("video")[0];
v. play();
</script>
</head>
<body>
<form>
<video width ="300" height = "200" src=" / html 5/ foo . mp4" > Your browser
does not support the video element.
</video>
<br / >
< input type - "button" onclick "PlayVideo(); " value </form>
</body>
</html>
This will produce the following result -
Play

More Related Content

Similar to Html 5 full course

Intro to HTML5 audio tag
Intro to HTML5 audio tagIntro to HTML5 audio tag
Intro to HTML5 audio tagsatejsahu
 
HTML5 multimedia - where we are, where we're going
HTML5 multimedia - where we are, where we're goingHTML5 multimedia - where we are, where we're going
HTML5 multimedia - where we are, where we're goingbrucelawson
 
HTML5 Multimedia: where we are, where we're going
HTML5 Multimedia: where we are, where we're goingHTML5 Multimedia: where we are, where we're going
HTML5 Multimedia: where we are, where we're goingbrucelawson
 
FYBSC IT Web Programming Unit II Audio Video in HTML
FYBSC IT Web Programming Unit II  Audio  Video in HTMLFYBSC IT Web Programming Unit II  Audio  Video in HTML
FYBSC IT Web Programming Unit II Audio Video in HTMLArti Parab Academics
 
HTML Multimedia.pptx
HTML Multimedia.pptxHTML Multimedia.pptx
HTML Multimedia.pptxssuser08ea44
 
HTML 5: Audio And Video
HTML 5: Audio And VideoHTML 5: Audio And Video
HTML 5: Audio And VideoReema
 
HTML55 media api
HTML55 media apiHTML55 media api
HTML55 media apiRan Bar-Zik
 
Multimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audioMultimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audioChristian Heilmann
 
Basics of HTML5 for Phonegap
Basics of HTML5 for PhonegapBasics of HTML5 for Phonegap
Basics of HTML5 for PhonegapRakesh Jha
 
Timing and Synchronisation
Timing and SynchronisationTiming and Synchronisation
Timing and Synchronisationjsmith
 
Html5 Video Vs Flash Video presentation
Html5 Video Vs Flash Video presentationHtml5 Video Vs Flash Video presentation
Html5 Video Vs Flash Video presentationMatthew Fabb
 
Responsive Videos, mehr oder weniger
Responsive Videos, mehr oder wenigerResponsive Videos, mehr oder weniger
Responsive Videos, mehr oder wenigerWalter Ebert
 
Craft 2019 - “The Upside Down” Of The Web - Video technologies
Craft 2019 - “The Upside Down” Of The Web - Video technologiesCraft 2019 - “The Upside Down” Of The Web - Video technologies
Craft 2019 - “The Upside Down” Of The Web - Video technologiesMáté Nádasdi
 
Mobile Meow at Mobilism
Mobile Meow at MobilismMobile Meow at Mobilism
Mobile Meow at MobilismGreg Schechter
 

Similar to Html 5 full course (20)

Intro to HTML5 audio tag
Intro to HTML5 audio tagIntro to HTML5 audio tag
Intro to HTML5 audio tag
 
HTML5 multimedia - where we are, where we're going
HTML5 multimedia - where we are, where we're goingHTML5 multimedia - where we are, where we're going
HTML5 multimedia - where we are, where we're going
 
HTML5 Multimedia: where we are, where we're going
HTML5 Multimedia: where we are, where we're goingHTML5 Multimedia: where we are, where we're going
HTML5 Multimedia: where we are, where we're going
 
FYBSC IT Web Programming Unit II Audio Video in HTML
FYBSC IT Web Programming Unit II  Audio  Video in HTMLFYBSC IT Web Programming Unit II  Audio  Video in HTML
FYBSC IT Web Programming Unit II Audio Video in HTML
 
Html audio video
Html audio videoHtml audio video
Html audio video
 
Web DU Mobile Meow
Web DU Mobile MeowWeb DU Mobile Meow
Web DU Mobile Meow
 
HTML Multimedia.pptx
HTML Multimedia.pptxHTML Multimedia.pptx
HTML Multimedia.pptx
 
HTML 5: Audio And Video
HTML 5: Audio And VideoHTML 5: Audio And Video
HTML 5: Audio And Video
 
HTML55 media api
HTML55 media apiHTML55 media api
HTML55 media api
 
Html multimedia
Html multimediaHtml multimedia
Html multimedia
 
Multimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audioMultimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audio
 
JS Days Mobile Meow
JS Days Mobile MeowJS Days Mobile Meow
JS Days Mobile Meow
 
youtube
youtubeyoutube
youtube
 
Basics of HTML5 for Phonegap
Basics of HTML5 for PhonegapBasics of HTML5 for Phonegap
Basics of HTML5 for Phonegap
 
Timing and Synchronisation
Timing and SynchronisationTiming and Synchronisation
Timing and Synchronisation
 
Html5 Video Vs Flash Video presentation
Html5 Video Vs Flash Video presentationHtml5 Video Vs Flash Video presentation
Html5 Video Vs Flash Video presentation
 
Responsive Videos, mehr oder weniger
Responsive Videos, mehr oder wenigerResponsive Videos, mehr oder weniger
Responsive Videos, mehr oder weniger
 
Craft 2019 - “The Upside Down” Of The Web - Video technologies
Craft 2019 - “The Upside Down” Of The Web - Video technologiesCraft 2019 - “The Upside Down” Of The Web - Video technologies
Craft 2019 - “The Upside Down” Of The Web - Video technologies
 
Html5video
Html5videoHtml5video
Html5video
 
Mobile Meow at Mobilism
Mobile Meow at MobilismMobile Meow at Mobilism
Mobile Meow at Mobilism
 

More from AbhishekMondal42

Oss evaluation-certification-oss-financial-advantages
Oss evaluation-certification-oss-financial-advantagesOss evaluation-certification-oss-financial-advantages
Oss evaluation-certification-oss-financial-advantagesAbhishekMondal42
 
Word press posts(preview &amp; publish)
Word press posts(preview &amp; publish)Word press posts(preview &amp; publish)
Word press posts(preview &amp; publish)AbhishekMondal42
 
Word press posts(add , edit , delete post)
Word press posts(add , edit , delete post)Word press posts(add , edit , delete post)
Word press posts(add , edit , delete post)AbhishekMondal42
 
Word press pages(edit and delete)
Word press pages(edit and delete)Word press pages(edit and delete)
Word press pages(edit and delete)AbhishekMondal42
 
Word press media(add,insert,delete)
Word press media(add,insert,delete)Word press media(add,insert,delete)
Word press media(add,insert,delete)AbhishekMondal42
 
Word press widget management
Word press  widget managementWord press  widget management
Word press widget managementAbhishekMondal42
 
Word press theme management
Word press  theme managementWord press  theme management
Word press theme managementAbhishekMondal42
 
Word press personal profile
Word press  personal profileWord press  personal profile
Word press personal profileAbhishekMondal42
 
Word press moderate comments
Word press  moderate commentsWord press  moderate comments
Word press moderate commentsAbhishekMondal42
 
Word press install plugins
Word press  install pluginsWord press  install plugins
Word press install pluginsAbhishekMondal42
 

More from AbhishekMondal42 (20)

Oss evaluation-certification-oss-financial-advantages
Oss evaluation-certification-oss-financial-advantagesOss evaluation-certification-oss-financial-advantages
Oss evaluation-certification-oss-financial-advantages
 
Word press 01
Word press 01Word press 01
Word press 01
 
Word press posts(preview &amp; publish)
Word press posts(preview &amp; publish)Word press posts(preview &amp; publish)
Word press posts(preview &amp; publish)
 
Word press posts(add , edit , delete post)
Word press posts(add , edit , delete post)Word press posts(add , edit , delete post)
Word press posts(add , edit , delete post)
 
Word press pages(edit and delete)
Word press pages(edit and delete)Word press pages(edit and delete)
Word press pages(edit and delete)
 
Word press pages(add)
Word press pages(add)Word press pages(add)
Word press pages(add)
 
Word press media(add,insert,delete)
Word press media(add,insert,delete)Word press media(add,insert,delete)
Word press media(add,insert,delete)
 
Word press media library
Word press media libraryWord press media library
Word press media library
 
Word press widget management
Word press  widget managementWord press  widget management
Word press widget management
 
Word press view plugins
Word press  view pluginsWord press  view plugins
Word press view plugins
 
Word press user roles
Word press  user rolesWord press  user roles
Word press user roles
 
Word press theme management
Word press  theme managementWord press  theme management
Word press theme management
 
Word press personal profile
Word press  personal profileWord press  personal profile
Word press personal profile
 
Word press moderate comments
Word press  moderate commentsWord press  moderate comments
Word press moderate comments
 
Word press install plugins
Word press  install pluginsWord press  install plugins
Word press install plugins
 
Word press edit users
Word press  edit usersWord press  edit users
Word press edit users
 
Word press edit tags
Word press  edit tagsWord press  edit tags
Word press edit tags
 
Word press edit links
Word press  edit linksWord press  edit links
Word press edit links
 
Word press edit comments
Word press  edit commentsWord press  edit comments
Word press edit comments
 
Word press delete users
Word press  delete usersWord press  delete users
Word press delete users
 

Recently uploaded

internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 

Html 5 full course

  • 1. HTML 5- Audio and Video Player
  • 2. HTML5 features include native audio and video support without the need for Flash. The HTML5 <audio> and <video> tags make it simple to add media to a website. You need to set src attribute to identify the media source and include a controls attribute so the user can play and pause the media. Embedding Video Here is the simplest form of embedding a video file in your webpage - <video src = "foo . mp4" width= " 300" height = "200" controls> Your browser does not support the element. </video>
  • 3. 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 –  Ogg - Ogg files with Thedora video codec and Vorbis audio codec.  mpeg4 - MPEG4 files with H.264 video codec and AAC audio codec. You can use <source> tag 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 -
  • 4. < ! DOCTYPE HTML > <html> <video width="300" height="200" controls autoplay> <source src ="/htm15/foo.ogg" type ="video/ogg" / > <source src= "/htm15/foo.mp4" type= "video/mp4" / > Your browser does not support the element. </video> </html> This will produce the following result - 0:00 / 0:19
  • 5. Video Attribute Specification The HTML5 video tag can have a number of attributes to control the look and feel and various functionalities of the control - Sr.No Attribute & Description 1 autoplay This Boolean attribute if specified, the video will automatically begin to play back as soon as it can do so without stopping to finish loading the data. 2 autobuffer This Boolean attribute if specified, the video will automatically begin buffering even if it's not set to automatically play. 3 controls If this attribute is present, it will allow the user to control video playback, including volume, seeking, and pause/resume playback. 4 height This attribute specifies the height of the video's display area, in CSS pixels.
  • 6. 5 loop This Boolean attribute if specified, will allow video automatically seek back to the start after reaching at the end 6 preload This attribute specifies that the video will be loaded at page load, and ready to run. Ignored if autoplay is present. 7 poster This is a URL of an image to show until the user plays or seeks. 8 src The URL of the video to embed. This is optional; you may instead use the <source> element within the video block to specify the video to embed. 9 width This attribute specifies the width of the video's display area, in CSS pixels.
  • 7. Embedding Audio HTML5 supports <audio> tag which is used to embed sound content in an HTML or XHTML document as follows. <audio src = "foo.wav" controls autoplay> Your browser does not support the element. </audio> 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. You can use <source&ggt; tag 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
  • 8. < ! DOCTYPE HTML > <html> <audio controls autoplay> <source src=" / html 5/ audio.ogg" type="audio/ogg"> <source src="/htm15/audio.wav" type ="audio/wav does not support the element. Your browser </audio> </html> This will produce the following result - 0:02 / 0:02
  • 9. Audio Attribute Specification The HTML5 audio tag can have a number of attributes to control the look and feel and various functionalities of the control - Sr.No Attribute & Description 1 Autoplay This Boolean attribute if specified, the audio will automatically begin to play back as soon as it can do so without stopping to finish loading the data. 2 autobuffer This Boolean attribute if specified, the audio will automatically begin buffering even if it's not set to automatically play. 3 controls If this attribute is present, it will allow the user to control audio playback, including volume, seeking, and pause/resume playback. 4 loop This Boolean attribute if specified, will allow audio automatically seek back to the start after reaching at the end.
  • 10. 5 preload This attribute specifies that the audio will be loaded at page load, and ready to run. Ignored if autoplay is present. 6 src The URL of the audio to embed. This is optional; you may instead use the <source> element within the video block to specify the video to embed. Handling Media Events The HTML5 audio and video tag can have a number of attributes to control various functionalities of the control using JavaScript -
  • 11. Sr.No Event & Description 1 abort This event is generated when playback is aborted. 2 canplay This event is generated when enough data is available that the media can be played. 3 ended This event is generated when playback completes. 4 error This event is generated when an error occurs. 5 loadeddata This event is generated when the first frame of the media has finished loading. 6 loadstart This event is generated when loading of the media begins.
  • 12. 7 pause This event is generated when playback is paused. 8 play This event is generated when playback starts or resumes. 9 progress This event is generated periodically to inform the progress of the downloading the media. 10 ratechange This event is generated when the playback speed changes. 11 Seeked This event is generated when a seek operation completes. 12 seeking This event is generated when a seek operation begins. 13 seeking This event is generated when a seek operation begins.
  • 13. 13 suspend This event is generated when loading of the media is suspended. 14 volumechange This event is generated when the audio volume changes. 15 waiting This event is generated when the requested operation (such as playback) is delayed pending the completion of another operation (such as a seek). Following is the example which allows to play the given video -
  • 14. <!doctype HTML > <html> <head> <script type="text/javascript"> function PlayVideo() { var v = document.getE1ementsByTagName("video")[0]; v. play(); </script> </head> <body> <form> <video width ="300" height = "200" src=" / html 5/ foo . mp4" > Your browser does not support the video element. </video> <br / > < input type - "button" onclick "PlayVideo(); " value </form> </body> </html>
  • 15. This will produce the following result - Play