Html5audio/video Full Solution (Media Object methods and properties)

Source: Internet
Author: User

    • Get Htmlvideoelement and Htmlaudioelement objects
    1. Audio can create objects directly from new
    2. Media = new Audio ("Http://www.abc.com/test.mp3");
    3. Both audio and video can be used to get objects from tags
    4. Media = document. getElementById ("Media");
    • Media methods and properties--htmlvideoelement and htmlaudioelement inherit from Htmlmediaelement
    1. Error status
    2. Media.error; Null: Normal
    3. Media.error.code; 1. User Termination 2. Network error 3. Decoding Error 4.URL invalid
    4. Network status
    5. MEDIA.CURRENTSRC; Returns the URL of the current resource
    6. MEDIA.SRC = value;//Returns or sets the URL of the current resource
    7. Media.canplaytype (type); Whether you can play a resource in a certain format
    8. Media.networkstate; 0. This element is not initialized 1. Normal but not using network 2. Downloading Data 3. No Resources found
    9. Media.load (); Reload the resource specified by SRC
    10. media.buffered; Returns the buffered area, timeranges
    11. Media.preload; None: Do not preload metadata: Preload resource information Auto:
    12. Readiness Status
    13. Media.readystate; 1:have_nothing 2:have_metadata 3.have_current_data 4.have_future_data 5.have_enough_data
    14. media.seeking; Are you seeking
    15. Playback status
    16. Media.currenttime = value;//Current playback position, assignment can change position
    17. Media.starttime; Typically 0, not 0 if it is a streaming medium or a resource that does not start at 0
    18. Media.duration; Current resource length stream returns unlimited
    19. media.paused; Whether to pause
    20. Media.defaultplaybackrate = value;//default playback speed, can be set
    21. Media.playbackrate = value;//Current playback speed, change immediately after setting
    22. media.played; Returns the area that has been played, timeranges, for this object see below
    23. media.seekable; Returns the area that can be seek timeranges
    24. media.ended; Whether to end
    25. Media.autoplay; Whether to play automatically
    26. Media.loop; Whether to loop playback
    27. Media.play (); Play
    28. Media.pause (); Pause//Control
    29. media.controls;//whether there is a default control bar
    30. Media.volume = value;//volume
    31. media.muted = value;//Mute
    32. Timeranges (Region) object
    33. Timeranges.length; Number of Region segments
    34. Timeranges.start (index)//start position of the area of the index section
    35. Timeranges.end (index)//End position of the section of the index area

Html5audio/video Full Solution (Media Object methods and properties)

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.