HTML5 introduction, video, and html5 introduction video

Source: Internet
Author: User

HTML5 introduction, video, and html5 introduction video

HTML5 rules:

  • The new features should be based on HTML, CSS, DOM, and JavaScript.
  • Reduce the need for external plug-ins (such as Flash)
  • Better error handling
  • More replace script Markup
  • HTML5 should be independent of devices
  • The development process should respond to new features of public transparency

    Some interesting new features in HTML5:

    • Canvas elements used for painting
    • Video and audio elements used for media playback
    • Better support for local offline storage
    • New special content elements, such as article, footer, header, nav, section
    • New Form controls, such as calendar, date, time, email, url, and search browser support

      The latest versions of Safari, Chrome, Firefox, and Opera support some HTML5 features. Internet Explorer 9 will support some HTML5 features.

      Video on the Web

      Until now, there is still no standard for displaying videos on webpages.

      Today, most videos are displayed through plug-ins (such as Flash. However, not all browsers have the same plug-ins.

      HTML5 specifies a standard method to include videos through video elements.

      Video Format

      Currently, the video element supports three video formats:

      Format IE Firefox Opera Chrome Safari
      Ogg No 3.5 + 10.5 + 5.0 + No
      MPEG 4 9.0 + No No 5.0 + 3.0 +
      WebM No 4.0 + 10.6 + 6.0 + No

      Ogg = Ogg file with Theora video encoding and Vorbis Audio Encoding

      MPEG4 = MPEG 4 files with H.264 video encoding and AAC audio encoding

      WebM = A WebM file with VP8 video encoding and Vorbis Audio Encoding

      How to work

      To display videos in HTML5, all you need are:

      <video src="movie.ogg" controls="controls"></video>

      For example, the control attribute is used to add a playback, pause, and volume control.

      The content inserted between <video> and </video> is displayed by browsers that do not support video elements:

      It is also a good idea to include the width and height attributes.

      Use an Ogg file for Firefox, Opera, and Chrome browsers.

      Make sure that the video file type is MPEG4 for Safari.

      <!DOCTYPE HTML>

      The video element allows multiple source elements. The source element can be used to link different video files. The browser uses the first recognizable format:

      <video width="320" height="240" controls="controls">  <source src="movie.ogg" type="video/ogg">  <source src="movie.mp4" type="video/mp4">Your browser does not support the video tag.</video>

       

      Internet Explorer

      Internet Explorer 8 does not support video elements. In IE 9, video elements of MPEG4 are supported.

      <Video> tag attributes
      Attribute Value Description
      Autoplay Autoplay If this attribute appears, the video will be played immediately after it is ready.
      Controls Controls If this attribute is displayed, the control, such as the play button, is displayed to the user.
      Height Pixels Set the height of the video player.
      Loop Loop If this attribute is displayed, the media file starts playing again after being played.
      Preload Preload

      If this attribute is displayed, the video is loaded when the page is loaded and ready for playing.

      If "autoplay" is used, this attribute is ignored.

      Src Url The URL of the video to be played.
      Width Pixels Set the width of the video player.

Related Article

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.