Saturday, June 9, 2012

HTML5 | Video Tag


HTML5 <Video> tag:
Below are methods, properties and events of Video tag. all are explained in details. which will help you to understand the video tag easily as well as you can develop your own video component.

Methods:
Method Name
Purpose
play()
Will play the video
pause()
Will pause the video
load()
Load video file
canPlayType


Properties:
Property Name
Purpose
currentSrc
Will give the path of video file.
currentTime
Will give time of current video
videoWidth
Will give actual width of video
videoHeight
Will give actual height of video
duration
Will give time duration of whole video
ended
Will give false while video is in running mode and when ends then will give true
Error
During video playing, error property holds the error value while error occurs.
Paused
Will return true while video is in pause mode
Muted
Will return true while video’s audio is at mute mode
seeking

Volume
Returns volumn level. If it returns 0 then lowest volumn and 1 returns highest volumn
Height
Height of video tag
Width
Width of video

Events:
  • Play
  • Pause
  • Progress
  • Error
  • timeUpdate
  • ended
  • abort
Example:

<!DOCTYPE HTML>
<HTML lang="en">
<head>

</head>
<body>

<video id="video1" width="700" height="500" controls="controls">
<source src="a63bd27e3520.mp4" type="video/mp4"/>
Browser does not support video format.
</video>
</br>
</body>
</html>

In video tag, we need to provide the all supported source video file and the text which will be displayed while video tag is not supported by browser.



No comments:

Post a Comment