SlideShare a Scribd company logo
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

PPTX
32 track
PDF
HTML5 Audio & Video
PPTX
9 audio
PPTX
10 video
PDF
Video & podcasting slideshow
PDF
Syntheway ElectriKeys ePiano VSTi Software: Fender Rhodes, Wurlitzer, Hohner ...
PPTX
Effective HTML5 game audio
ODP
Add-on Products for Plone (part 2)
32 track
HTML5 Audio & Video
9 audio
10 video
Video & podcasting slideshow
Syntheway ElectriKeys ePiano VSTi Software: Fender Rhodes, Wurlitzer, Hohner ...
Effective HTML5 game audio
Add-on Products for Plone (part 2)

Similar to Html 5 full course (20)

PPTX
Html audio video
PPTX
HTML 5: Audio And Video
PPTX
Use of Multimedia tag in HTML using exmples
PPTX
HTML Multimedia.pptx
PPT
05-06 HTML lecture FOR BS STUDENTS IUB.ppt
PPTX
FYBSC IT Web Programming Unit II Audio Video in HTML
PPTX
Html media
PPTX
HTML Video and Audio.pptx( code of enter html video and audio)
PPT
Intro to HTML5 audio tag
PPTX
Lecture9 web design and development
PDF
Basics of HTML5 for Phonegap
PPTX
Html multimedia
PPTX
HTML5_DragDrop_Media_With_Audio ctrl.pptx
PDF
PDF
Multimedia on the web - HTML5 video and audio
PDF
HTML5 Comprehensive Guide
PDF
HTML5 multimedia - where we are, where we're going
PDF
Html5 Media 1st Edition Kevin Martin Shelley Powers
PPTX
HTML5 - Audio/Video Encoding
PDF
HTML5 Multimedia: where we are, where we're going
Html audio video
HTML 5: Audio And Video
Use of Multimedia tag in HTML using exmples
HTML Multimedia.pptx
05-06 HTML lecture FOR BS STUDENTS IUB.ppt
FYBSC IT Web Programming Unit II Audio Video in HTML
Html media
HTML Video and Audio.pptx( code of enter html video and audio)
Intro to HTML5 audio tag
Lecture9 web design and development
Basics of HTML5 for Phonegap
Html multimedia
HTML5_DragDrop_Media_With_Audio ctrl.pptx
Multimedia on the web - HTML5 video and audio
HTML5 Comprehensive Guide
HTML5 multimedia - where we are, where we're going
Html5 Media 1st Edition Kevin Martin Shelley Powers
HTML5 - Audio/Video Encoding
HTML5 Multimedia: where we are, where we're going
Ad

More from AbhishekMondal42 (20)

PPTX
Oss evaluation-certification-oss-financial-advantages
PPTX
Word press 01
PPTX
Word press posts(preview &amp; publish)
PPTX
Word press posts(add , edit , delete post)
PPTX
Word press pages(edit and delete)
PPTX
Word press pages(add)
PPTX
Word press media(add,insert,delete)
PPTX
Word press media library
PPTX
Word press widget management
PPTX
Word press view plugins
PPTX
Word press user roles
PPTX
Word press theme management
PPTX
Word press personal profile
PPTX
Word press moderate comments
PPTX
Word press install plugins
PPTX
Word press edit users
PPTX
Word press edit tags
PPTX
Word press edit links
PPTX
Word press edit comments
PPTX
Word press delete users
Oss evaluation-certification-oss-financial-advantages
Word press 01
Word press posts(preview &amp; publish)
Word press posts(add , edit , delete post)
Word press pages(edit and delete)
Word press pages(add)
Word press media(add,insert,delete)
Word press media library
Word press widget management
Word press view plugins
Word press user roles
Word press theme management
Word press personal profile
Word press moderate comments
Word press install plugins
Word press edit users
Word press edit tags
Word press edit links
Word press edit comments
Word press delete users
Ad

Recently uploaded (20)

PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
RMMM.pdf make it easy to upload and study
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
master seminar digital applications in india
PDF
Classroom Observation Tools for Teachers
PPTX
Cell Structure & Organelles in detailed.
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Basic Mud Logging Guide for educational purpose
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Cell Types and Its function , kingdom of life
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Microbial diseases, their pathogenesis and prophylaxis
RMMM.pdf make it easy to upload and study
VCE English Exam - Section C Student Revision Booklet
master seminar digital applications in india
Classroom Observation Tools for Teachers
Cell Structure & Organelles in detailed.
Supply Chain Operations Speaking Notes -ICLT Program
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Basic Mud Logging Guide for educational purpose
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Cell Types and Its function , kingdom of life
2.FourierTransform-ShortQuestionswithAnswers.pdf
Microbial disease of the cardiovascular and lymphatic systems
STATICS OF THE RIGID BODIES Hibbelers.pdf

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