New Video+dom for HTML5 (play, pause, size resize)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.