<Video> elements also have methods, attributes, and events.
The methods are used for playing, pausing, and loading. The attributes (such as duration and volume) can be read or set. The DOM event can notify you, for example, the <video> element starts to play, has been paused, has been stopped, and so on.
The Simple Method in the following example demonstrates how to use the <video> element, read and set attributes, and call methods.
Instance
Create simple play/pause and resize controls for the video:
<Div style = "text-align: center;"> <button onclick = "playpause ()"> play/pause </button> <button onclick = "makebig () "> large </button> <button onclick =" makenormal () "> medium </button> <button onclick =" makesmall () "> small </button> <br/> <video ID =" video1 "width =" 420 "style =" margin-top: 15px; "> <source src ="/example/HTML5/mov_bbb.mp4 "type =" Video/MP4 "/> <source src ="/example/HTML5/mov_bbb.ogg "type =" Video/ ogg "/> your browser does not support HTML5 video. </video> </div> <SCRIPT type = "text/JavaScript"> var myvideo = document. getelementbyid ("video1"); function playpause () {If (myvideo. paused) myvideo. play (); else myvideo. pause ();} function makebig () {myvideo. width = 560;} function makesmall () {myvideo. width = 320;} function makenormal () {myvideo. width = 420 ;}</SCRIPT>