The html<video> element also has methods, properties, and events.
The method is used for playing, pausing, loading, and so on. The properties (such as length, volume, etc.) can be read or set. One of the DOM events can inform you. For example, the,<video> element starts playing, paused, stopped, and so on.
Case one: Use video and DOM elements for simple play, pause, and resize controls:
<!DOCTYPE HTML> <HTML> <Body> <Divstyle= "Text-align:center;"> <Buttononclick= "Playpause ()">Play/Pause</Button> <Buttononclick= "Makebig ()">Big</Button> <Buttononclick= "Makenormal ()">In</Button> <Buttononclick= "Makesmall ()">Small</Button> <BR/> <VideoID= "Video1"width= "420"style= "margin-top:15px;"> <Sourcesrc= "/example/html5/mov_bbb.mp4"type= "Video/mp4" /> <Sourcesrc= "/example/html5/mov_bbb.ogg"type= "Video/ogg" />Your Browser does not support HTML5 video. </Video></Div> <Scripttype= "Text/javascript">varMyvideo=document.getElementById ("Video1");functionPlaypause () {if(myvideo.paused) Myvideo.play ();Elsemyvideo.pause ();} functionMakebig () {myvideo.width=560; } functionMakesmall () {myvideo.width= the; } functionMakenormal () {myvideo.width=420; } </Script> </Body> </HTML>
Case: Small size playback:
Medium size playback:
Large-size playback:
The above calls two methods: Paly () and pause (). It uses two properties at the same time: paused and width.
The following is a list of the properties of the Consortium
The following is a list of the video methods, properties, and events supported by most browsers:
Note: In all properties, only the Videowidth and Videoheight properties are available immediately. Other properties are available after the video's metadata has been loaded.
Video, label source
New Video+dom for HTML5 (play, pause, size resize)