HTML5 <video> using DOM for control
HTML5 <video> elements also have methods, properties, and Events.
The methods are used for playing, pausing, loading, and so On. The properties (such as length, volume, etc.) can be read or set. DOM events can inform you, for example, that the,<video> element starts playing, paused, stopped, and so On.
Two methods were called: play () and pause (). It uses two properties at the same time: paused and Width.
<!DOCTYPE HTML><HTML> <Head> <MetaCharSet= "utf-8" /> <title></title> </Head> <Body> <Divstyle= "text-align:center;"> <VideoID= "video1"width= "420"style= "margin-top:55px;"> <Sourcesrc= "img/mov_bbb.mp4"type= "video/mp4" /> <Sourcesrc= "img/mov_bbb.ogg"type= "video/ogg" />Your Browser does not support HTML5 Video. </Video> <BR/> <Buttononclick= "playpause ()">Play/pause</Button> <Buttononclick= "makebig ()">Big</Button> <Buttononclick= "makenormal ()">In</Button> <Buttononclick= "makesmall ()">Small</Button> </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>
1. Chrome Browser Test
2, IE9 in the test
3. IE8 Browser Test
HTML5 video (b) <video> control using the DOM