140 likes | 321 Views
<video> <audio>. Long time ago…. Support. <Video>. <Audio>. HTML HTML5. < object width=" 425"height ="344"> < param name="movie" value="http://www.youtube.com/v/9sEI1AUFJKw&hl=en_GB&fs=1 &"> </ param>
E N D
Support <Video> <Audio>
HTML HTML5 <object width="425"height="344"> <param name="movie" value="http://www.youtube.com/v/9sEI1AUFJKw&hl=en_GB&fs=1&"> </param> <param name="allowFullScreen" value="true"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/9sEI1AUFJKw&hl=en_GB&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"> </embed> </object> http://dev.opera.com/articles/view/introduction-html5-video/ <html> <body> <video src=water.mp4 width=520 height=440 controls poster=water.mp4> </video> </body> </html>
<html> <body> <video src=water.mp4 width=520 height=440 controls poster=water.mp4> </video> <audio src=“Sadness.mp3" controls="controls"></audio> </body> </html> ANATOMY OF <video> <audio> SRC Width/ height Boolean attribute Poster Controls
Attributes: -Audio -Autoplay -Preload -Loop What else ?
Allows to design your own controls Eg: Different design , playback speed , button for captions When using your own controls , you omit the controls attribute <video src="video.ogv">video not supported</video> You can then use buttons that do something when clicked <script>var video = document.getElementsByTagName('video')[0];</script><input type="button" value="Play" onclick="video.play()"><input type="button" value="Pause" onclick="video.pause()"> own controls using DOM
Skip forward How to use seekbar ? <input type="range" step="any" id="seekbar"> Seekbars max attribute to the videos duration varseekbar = document.getElementById('seekbar'); function setupSeekbar() { seekbar.max= video.duration; } Seekbar
Now you can make the video respond to changes to the seekbar. video.ondurationchange= setupSeekbar; function seekVideo() { video.currentTime = seekbar.value; } function updateUI() { seekbar.value= video.currentTime; } seekbar.onchange= seekVideo; video.ontimeupdate= updateUI; http://dev.opera.com/articles/view/everything-you-need-to-know-about-html5-video-and-audio/ Continued…
HTML 5 provides a volume and muted ideal attributes as well as the volumechange event. Implementation of mute button <input type="button" value="Unmuted" id="mutebutton" onclick="muteOrUnmute()"> varmutebutton= document.getElementById('mutebutton'); video.onvolumechange= function(e) { mutebutton.value= video.muted ? 'Muted' : 'Unmuted'; } function muteOrUnmute() { video.muted= !video.muted; } Volume control implementation Adjust the volume
Use of playbackRate ideal and ratechange event <input type="range" min="-3" max="3" value="1" id="ratecontrol" onchange="changePlaybackRate()"> <script> varratecontrol = document.getElementById('ratecontrol'); video.onratechange = function(e) { ratecontrol.value= video.playbackRate; } function changePlaybackRate() { video.playbackRate= ratecontrol.value; } </script> Fast forward, slow motion and rewind
http://dev.opera.com/articles/view/everything-you-need-to-know-about-html5-video-and-audio/http://dev.opera.com/articles/view/everything-you-need-to-know-about-html5-video-and-audio/ http://net.tutsplus.com/tutorials/html-css-techniques/html5-audio-and-video-what-you-must-know/ http://www.w3schools.com/html5/html5_video.asp http://news.cnet.com/8301-30685_3-20028718-264.html References
Thank You! By, AnupamMundale Neeraj Lulay