With the rapid development of the Internet and the application of HTML5, more and more projects are used in Video,audio as a common label.
Let's start with the general usage of the video tag below.
The properties of the video tag are as follows:
Note: The control property is for adding play, pause, and volume controls.
General usage:
<class= "Videocon"><width= "750 " height=" id= "Videop" src= "Video.mp4 " ></ Video > </ Div >
Of course, you can pause, play the video, using the following methods:
function Playpause () { var myvideo = document.getElementById (' Videop '); if (myvideo.paused) { myvideo.play (); } Else { myvideo.pause (); } }
Of course, the video element allows multiple source elements. The source element can link different video files. The browser will use the first recognizable format:
As follows:
<Videowidth= " the"Height= "+"Controls= "Controls"> <Sourcesrc= "Movie.ogg"type= "Video/ogg"> <Sourcesrc= "Movie.mp4"type= "Video/mp4">Your Browser does not support the video tag.</Video>
To introduce the use of audio tags (same as video use):
<src= "Song.mp3" controls= "Controls" loop= " Loop " autoplay=" AutoPlay "> Pro Your browser does not support HTML5 's audio tag </ Audio>
Audio is not just a label. He is also an object under Window, the object has properties and methods, as an object what are his common methods?
Object properties:
currenttime get current playback time
duration Total time to get songs
play is playing back True/false
pause is paused to return True/false
Object method:
Play () playing songs
Pause () pauses the song
load () reload Song
Again as below:
<AudioControls= "Controls"> <Sourcesrc= "Music.ogg" /> <Sourcesrc= "Music.mp3" /> <Sourcesrc= "Music.wav" /> </Audio>
HTML5 video Tag implementation: general article