HTML5 New Audio&&video Use example

Source: Internet
Author: User

This article briefly describes the use of new audio and video in H5, H4 playback is done through flash.

<! DOCTYPE html>
There are also some attributes, such as:

AutoPlay Properties (AutoPlay), preload properties (preload or buffering), poster properties (video unique),

The Loop property, the error property, such as

<video id= "video" src= "Video123.mp4" ></video>
<script type= "Text/javascript" >
    var video = document.getElementById (' video ');
    Video.addeventlistener ("Error", function () {
        var error = Video.error;
        Switch (error.code) {case
            1:
                alert (' The retrieval process was aborted by the user. ');
                break;
            Case 2:
                alert (' An error occurred at the moment of load. ');
                break;
            Case 3:
                alert (' An error occurred while decoding. ');
                break;
            Case 4:
                alert (' Media unavailable or no support for audio/video. ');
                break;
        }
    },false);
</script>

Play Effect Chart:


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.