<!DOCTYPE HTML>
<html>
<body>
<video width="400" height="300" controls autoplay>
<source src="/html5/love.ogg" type="video/ogg" />
<source src="/html5/love.mp4" type="video/mp4" />
</video>
</body>
</html>
Attribute | Description |
---|---|
autoplay | If this boolean attribute is specified the video automatically begins to play back as soon as it can do so without stopping to finish loading the data. |
autobuffer | If this boolean attribute is specified the video automatically begins buffering even if it is not set for playing automatically. |
controls | When this attribute is present, it allows the user to control video playback including the volume, seeking and pause/resume playback. |
height | It specifies the height of the video's display area in CSS pixel. |
loop | If this boolean attribute is specified, it allows the video to be sought back to the start after reaching the end. |
preload | It specifies that the video is loaded at page load and is ready to run. It can be ignored if the autoplay is present. |
poster | It is a URL of an image which is shown until the user plays or seeks it. |
src | It is the URL of the video used to embed. It is optional and can be used instead of using the <source> element within the video block to specify the video to embed. |
width | It specifies the width of the video's display area in CSS pixel. |
<!DOCTYPE HTML>
<html>
<body>
<audio controls autoplay>
<source src="/html5/selfie.ogg" type="audio/ogg" />
<source src="/html5/selfie.wav" type="audio/wav" />
</audio>
</body>
</html>
Attributes | Description |
---|---|
autoplay | It is a boolean attribute which when specified the audio begins to play back automatically as soon as it can do so without stopping to finish loading the data. |
autobuffer | It is a boolean attribute which is specified when the audio automatically begins buffering even if its not set to play automatically. |
controls | When this attribute is present it allows the user to control the audio playback including the volume, seeking and pause/resume playback. |
loop | If this boolean attribute is specified it will allow the audio to seek back automatically to the start after reaching the end. |
preload | This attribute specifies the audio that will be loaded at page load and is ready to run. It is ignored if the autoplay is present. |
src | The URL of the video is embedded. It is optional and can be used instead of using the <source> element within the video block to specify the video to embed. |
Event | Description |
---|---|
abort | This event is generated when the playback is aborted. |
canplay | This event is generated when enough data is available so that the media can be played. |
error | This event is generated when an error occurs. |
ended | This event is generated when the playback is completed. |
loadstart | This event is generated when the media begins loading. |
loadeddata | This event is generated when the first frame of the media has completed its loading. |
play | It is generated when the playback starts or resumes. |
pause | It is generated when the media is paused. |
progress | It is generated periodically to inform the progress of the downloading media. |
ratechange | It is generated when the speed of the playback changes. |
seeking | It is generated when a seek operation begins. |
seeked | It is generated when the seek operation completes. |
suspend | It is generated when the loading of media is suspended. |
volumechange | It is generated when the volume of the audio changes. |
waiting | It is generated when the requested operation is delayed pending the completion of another operation. |
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
function playingvideo()
{
var v = document.getElementsByTagName("video")[0];
v.play();
}
</script>
</head>
<body>
<form>
<video width="400" height="300" src="/html5/selfie.mp4">
This browser does not support the video element.
</video>
<br />
<input type="button" onclick="playingvideo();" value="Play"/>
</form>
</body>
</html>