Cara menggunakan supporting codecs of html5

Deteksi dukungan untuk fitur-fitur HTML5 seperti Canvas, Border Radius, Animasi & Transformasi CSS, 3D & WebGL, LocalStorage, Video HTML5 dan banyak lagi lainnya untuk Android versi terbaru. Gunakan Android HTML5 Didukung untuk menerapkan keindahan HTML5 ke dalam Aplikasi dan Situs Web seluler berbasis Web Anda.

Show

    Mendeteksi dukungan HTML5 di browser stok dari versi Android berikut.

    Chrome untuk Android
    Berani untuk Android
    Firefox untuk Android
    Android10.0
    Android 9.0
    Android 8.1
    Android 8.0
    Android 7.1
    Android 7.0
    Android 6.1
    Android 6.0
    Android 5.1
    Android 5.0
    Android 2.1
    Android 2.2
    Android 2.3.3
    Android 4.0
    Android 4.1
    Android 4.2
    Android 4.3
    Android 4.4

    The <video> HTML element embeds a media player which supports video playback into the document. You can use <video> for audio content as well, but the <audio> element may provide a more appropriate user experience.

    The above example shows simple usage of the <video> element. In a similar manner to the

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    1 element, we include a path to the media we want to display inside the
    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    2 attribute; we can include other attributes to specify information such as video width and height, whether we want it to autoplay and loop, whether we want to show the browser's default video controls, etc.

    The content inside the opening and closing

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    3 tags is shown as a fallback in browsers that don't support the element.

    Like all other HTML elements, this element supports the global attributes.

    A Boolean attribute; if specified, the video automatically begins to play back as soon as it can do so without stopping to finish loading the data.

    Note: Sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible. If you must offer autoplay functionality, you should make it opt-in (requiring a user to specifically enable it). However, this can be useful when creating media elements whose source will be set at a later time, under user control. See our autoplay guide for additional information about how to properly use autoplay.

    To disable video autoplay,

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    5 will not work; the video will autoplay if the attribute is there in the <video> tag at all. To remove autoplay, the attribute needs to be removed altogether.

    In some browsers (e.g. Chrome 70.0) autoplay doesn't work if no

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    7 attribute is present.

    Experimental

    A Boolean attribute which if

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    9 indicates that the element should automatically toggle picture-in-picture mode when the user switches back and forth between this document and another document or application.

    If this attribute is present, the browser will offer controls to allow the user to control video playback, including volume, seeking, and pause/resume playback.

    Experimental Non-standard

    The

    AddType video/ogg .ogm
    AddType video/ogg .ogv
    AddType video/ogg .ogg
    
    1 attribute, when specified, helps the browser select what controls to show for the
    AddType video/ogg .ogm
    AddType video/ogg .ogv
    AddType video/ogg .ogg
    
    3 element whenever the browser shows its own set of controls (that is, when the
    AddType video/ogg .ogm
    AddType video/ogg .ogv
    AddType video/ogg .ogg
    
    0 attribute is specified).

    The allowed values are

    AddType video/ogg .ogm
    AddType video/ogg .ogv
    AddType video/ogg .ogg
    
    5,
    AddType video/ogg .ogm
    AddType video/ogg .ogv
    AddType video/ogg .ogg
    
    6 and
    AddType video/ogg .ogm
    AddType video/ogg .ogv
    AddType video/ogg .ogg
    
    7.

    Use the attribute if you want to disable the Picture-In-Picture mode (and the control).

    This enumerated attribute indicates whether to use CORS to fetch the related video. CORS-enabled resources can be reused in the

    AddType video/webm .webm
    
    0 element without being tainted. The allowed values are:

    AddType video/webm .webm
    
    1

    Sends a cross-origin request without a credential. In other words, it sends the

    AddType video/webm .webm
    
    2 HTTP header without a cookie, X.509 certificate, or performing HTTP Basic authentication. If the server does not give credentials to the origin site (by not setting the
    AddType video/webm .webm
    
    3 HTTP header), the resource will be tainted, and its usage restricted.

    AddType video/webm .webm
    
    4

    Sends a cross-origin request with a credential. In other words, it sends the

    AddType video/webm .webm
    
    2 HTTP header with a cookie, a certificate, or performing HTTP Basic authentication. If the server does not give credentials to the origin site (through
    AddType video/webm .webm
    
    6 HTTP header), the resource will be tainted and its usage restricted.

    When not present, the resource is fetched without a CORS request (i.e. without sending the

    AddType video/webm .webm
    
    2 HTTP header), preventing its non-tainted use in
    AddType video/webm .webm
    
    0 elements. If invalid, it is handled as if the enumerated keyword
    AddType video/webm .webm
    
    1 was used. See CORS settings attributes for additional information.

    Experimental

    Prevents the browser from suggesting a Picture-in-Picture context menu or to request Picture-in-Picture automatically in some cases.

    Experimental

    A Boolean attribute used to disable the capability of remote playback in devices that are attached using wired (HDMI, DVI, etc.) and wireless technologies (Miracast, Chromecast, DLNA, AirPlay, etc.).

    In Safari, you can use

    <!-- Simple video example -->
    <!-- 'Big Buck Bunny' licensed under CC 3.0 by the Blender foundation. Hosted by archive.org -->
    <!-- Poster from peach.blender.org -->
    <video
      controls
      src="https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4"
      poster="https://peach.blender.org/wp-content/uploads/title_anouncement.jpg?x11217"
      width="620">
      Sorry, your browser doesn't support embedded videos, but don't worry, you can
      <a href="https://archive.org/details/BigBuckBunny_124">download it</a>
      and watch it with your favorite video player!
    </video>
    
    2 as a fallback.

    The height of the video's display area, in (absolute values only; ).

    A Boolean attribute; if specified, the browser will automatically seek back to the start upon reaching the end of the video.

    A Boolean attribute that indicates the default setting of the audio contained in the video. If set, the audio will be initially silenced. Its default value is

    <!-- Simple video example -->
    <!-- 'Big Buck Bunny' licensed under CC 3.0 by the Blender foundation. Hosted by archive.org -->
    <!-- Poster from peach.blender.org -->
    <video
      controls
      src="https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4"
      poster="https://peach.blender.org/wp-content/uploads/title_anouncement.jpg?x11217"
      width="620">
      Sorry, your browser doesn't support embedded videos, but don't worry, you can
      <a href="https://archive.org/details/BigBuckBunny_124">download it</a>
      and watch it with your favorite video player!
    </video>
    
    6, meaning that the audio will be played when the video is played.

    A Boolean attribute indicating that the video is to be played "inline", that is within the element's playback area. Note that the absence of this attribute does not imply that the video will always be played in fullscreen.

    A URL for an image to be shown while the video is downloading. If this attribute isn't specified, nothing is displayed until the first frame is available, then the first frame is shown as the poster frame.

    This enumerated attribute is intended to provide a hint to the browser about what the author thinks will lead to the best user experience regarding what content is loaded before the video is played. It may have one of the following values:

    • <!-- Using multiple sources as fallbacks for a video tag -->
      <!-- 'Elephants Dream' by Orange Open Movie Project Studio, licensed under CC-3.0, hosted by archive.org -->
      <!-- Poster hosted by Wikimedia -->
      <video
        width="620"
        controls
        poster="https://upload.wikimedia.org/wikipedia/commons/e/e8/Elephants_Dream_s5_both.jpg">
        <source
          src="https://archive.org/download/ElephantsDream/ed_hd.ogv"
          type="video/ogg" />
        <source
          src="https://archive.org/download/ElephantsDream/ed_hd.avi"
          type="video/avi" />
        <source
          src="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4"
          type="video/mp4" />
      
        Sorry, your browser doesn't support embedded videos, but don't worry, you can
        <a href="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4">
          download the MP4
        </a>
        and watch it with your favorite video player!
      </video>
      
      0: Indicates that the video should not be preloaded.
    • <!-- Using multiple sources as fallbacks for a video tag -->
      <!-- 'Elephants Dream' by Orange Open Movie Project Studio, licensed under CC-3.0, hosted by archive.org -->
      <!-- Poster hosted by Wikimedia -->
      <video
        width="620"
        controls
        poster="https://upload.wikimedia.org/wikipedia/commons/e/e8/Elephants_Dream_s5_both.jpg">
        <source
          src="https://archive.org/download/ElephantsDream/ed_hd.ogv"
          type="video/ogg" />
        <source
          src="https://archive.org/download/ElephantsDream/ed_hd.avi"
          type="video/avi" />
        <source
          src="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4"
          type="video/mp4" />
      
        Sorry, your browser doesn't support embedded videos, but don't worry, you can
        <a href="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4">
          download the MP4
        </a>
        and watch it with your favorite video player!
      </video>
      
      1: Indicates that only video metadata (e.g. length) is fetched.
    • <!-- Using multiple sources as fallbacks for a video tag -->
      <!-- 'Elephants Dream' by Orange Open Movie Project Studio, licensed under CC-3.0, hosted by archive.org -->
      <!-- Poster hosted by Wikimedia -->
      <video
        width="620"
        controls
        poster="https://upload.wikimedia.org/wikipedia/commons/e/e8/Elephants_Dream_s5_both.jpg">
        <source
          src="https://archive.org/download/ElephantsDream/ed_hd.ogv"
          type="video/ogg" />
        <source
          src="https://archive.org/download/ElephantsDream/ed_hd.avi"
          type="video/avi" />
        <source
          src="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4"
          type="video/mp4" />
      
        Sorry, your browser doesn't support embedded videos, but don't worry, you can
        <a href="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4">
          download the MP4
        </a>
        and watch it with your favorite video player!
      </video>
      
      2: Indicates that the whole video file can be downloaded, even if the user is not expected to use it.
    • empty string: Synonym of the
      <!-- Using multiple sources as fallbacks for a video tag -->
      <!-- 'Elephants Dream' by Orange Open Movie Project Studio, licensed under CC-3.0, hosted by archive.org -->
      <!-- Poster hosted by Wikimedia -->
      <video
        width="620"
        controls
        poster="https://upload.wikimedia.org/wikipedia/commons/e/e8/Elephants_Dream_s5_both.jpg">
        <source
          src="https://archive.org/download/ElephantsDream/ed_hd.ogv"
          type="video/ogg" />
        <source
          src="https://archive.org/download/ElephantsDream/ed_hd.avi"
          type="video/avi" />
        <source
          src="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4"
          type="video/mp4" />
      
        Sorry, your browser doesn't support embedded videos, but don't worry, you can
        <a href="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4">
          download the MP4
        </a>
        and watch it with your favorite video player!
      </video>
      
      2 value.

    The default value is different for each browser. The spec advises it to be set to

    <!-- Using multiple sources as fallbacks for a video tag -->
    <!-- 'Elephants Dream' by Orange Open Movie Project Studio, licensed under CC-3.0, hosted by archive.org -->
    <!-- Poster hosted by Wikimedia -->
    <video
      width="620"
      controls
      poster="https://upload.wikimedia.org/wikipedia/commons/e/e8/Elephants_Dream_s5_both.jpg">
      <source
        src="https://archive.org/download/ElephantsDream/ed_hd.ogv"
        type="video/ogg" />
      <source
        src="https://archive.org/download/ElephantsDream/ed_hd.avi"
        type="video/avi" />
      <source
        src="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4"
        type="video/mp4" />
    
      Sorry, your browser doesn't support embedded videos, but don't worry, you can
      <a href="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4">
        download the MP4
      </a>
      and watch it with your favorite video player!
    </video>
    
    1.

    Note:

    • The
      const elem = document.querySelector("video");
      
      elem.audioTracks.onaddtrack = (event) => {
        trackEditor.addTrack(event.track);
      };
      
      elem.audioTracks.onremovetrack = (event) => {
        trackEditor.removeTrack(event.track);
      };
      
      4 attribute has precedence over
      <!-- Simple video example -->
      <!-- 'Big Buck Bunny' licensed under CC 3.0 by the Blender foundation. Hosted by archive.org -->
      <!-- Poster from peach.blender.org -->
      <video
        controls
        src="https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4"
        poster="https://peach.blender.org/wp-content/uploads/title_anouncement.jpg?x11217"
        width="620">
        Sorry, your browser doesn't support embedded videos, but don't worry, you can
        <a href="https://archive.org/details/BigBuckBunny_124">download it</a>
        and watch it with your favorite video player!
      </video>
      
      9. If
      const elem = document.querySelector("video");
      
      elem.audioTracks.onaddtrack = (event) => {
        trackEditor.addTrack(event.track);
      };
      
      elem.audioTracks.onremovetrack = (event) => {
        trackEditor.removeTrack(event.track);
      };
      
      4 is specified, the browser would obviously need to start downloading the video for playback.
    • The specification does not force the browser to follow the value of this attribute; it is a mere hint.

    The URL of the video to embed. This is optional; you may instead use the

    <!-- Using multiple sources as fallbacks for a video tag -->
    <!-- 'Elephants Dream' by Orange Open Movie Project Studio, licensed under CC-3.0, hosted by archive.org -->
    <!-- Poster hosted by Wikimedia -->
    <video
      width="620"
      controls
      poster="https://upload.wikimedia.org/wikipedia/commons/e/e8/Elephants_Dream_s5_both.jpg">
      <source
        src="https://archive.org/download/ElephantsDream/ed_hd.ogv"
        type="video/ogg" />
      <source
        src="https://archive.org/download/ElephantsDream/ed_hd.avi"
        type="video/avi" />
      <source
        src="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4"
        type="video/mp4" />
    
      Sorry, your browser doesn't support embedded videos, but don't worry, you can
      <a href="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4">
        download the MP4
      </a>
      and watch it with your favorite video player!
    </video>
    
    9 element within the video block to specify the video to embed.

    The width of the video's display area, in (absolute values only; ).

    Event NameFired When

    14
    00:03:14 --> 00:03:18
    [Dramatic rock music]
    
    15
    00:03:19 --> 00:03:21
    [whispering] What's that off in the distance?
    
    16
    00:03:22 --> 00:03:24
    It's… it's a…
    
    16 00:03:25 --> 00:03:32
    [Loud thumping]
    [Dishes clattering]
    
    1 DeprecatedThe input buffer of a
    14
    00:03:14 --> 00:03:18
    [Dramatic rock music]
    
    15
    00:03:19 --> 00:03:21
    [whispering] What's that off in the distance?
    
    16
    00:03:22 --> 00:03:24
    It's… it's a…
    
    16 00:03:25 --> 00:03:32
    [Loud thumping]
    [Dishes clattering]
    
    2 is ready to be processed.
    14
    00:03:14 --> 00:03:18
    [Dramatic rock music]
    
    15
    00:03:19 --> 00:03:21
    [whispering] What's that off in the distance?
    
    16
    00:03:22 --> 00:03:24
    It's… it's a…
    
    16 00:03:25 --> 00:03:32
    [Loud thumping]
    [Dishes clattering]
    
    3The browser can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content.
    14
    00:03:14 --> 00:03:18
    [Dramatic rock music]
    
    15
    00:03:19 --> 00:03:21
    [whispering] What's that off in the distance?
    
    16
    00:03:22 --> 00:03:24
    It's… it's a…
    
    16 00:03:25 --> 00:03:32
    [Loud thumping]
    [Dishes clattering]
    
    4The browser estimates it can play the media up to its end without stopping for content buffering.
    14
    00:03:14 --> 00:03:18
    [Dramatic rock music]
    
    15
    00:03:19 --> 00:03:21
    [whispering] What's that off in the distance?
    
    16
    00:03:22 --> 00:03:24
    It's… it's a…
    
    16 00:03:25 --> 00:03:32
    [Loud thumping]
    [Dishes clattering]
    
    5The rendering of an
    14
    00:03:14 --> 00:03:18
    [Dramatic rock music]
    
    15
    00:03:19 --> 00:03:21
    [whispering] What's that off in the distance?
    
    16
    00:03:22 --> 00:03:24
    It's… it's a…
    
    16 00:03:25 --> 00:03:32
    [Loud thumping]
    [Dishes clattering]
    
    6 is terminated.
    14
    00:03:14 --> 00:03:18
    [Dramatic rock music]
    
    15
    00:03:19 --> 00:03:21
    [whispering] What's that off in the distance?
    
    16
    00:03:22 --> 00:03:24
    It's… it's a…
    
    16 00:03:25 --> 00:03:32
    [Loud thumping]
    [Dishes clattering]
    
    7The
    14
    00:03:14 --> 00:03:18
    [Dramatic rock music]
    
    15
    00:03:19 --> 00:03:21
    [whispering] What's that off in the distance?
    
    16
    00:03:22 --> 00:03:24
    It's… it's a…
    
    16 00:03:25 --> 00:03:32
    [Loud thumping]
    [Dishes clattering]
    
    8 attribute has been updated.
    14
    00:03:14 --> 00:03:18
    [Dramatic rock music]
    
    15
    00:03:19 --> 00:03:21
    [whispering] What's that off in the distance?
    
    16
    00:03:22 --> 00:03:24
    It's… it's a…
    
    16 00:03:25 --> 00:03:32
    [Loud thumping]
    [Dishes clattering]
    
    9The media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the <video>0 method is called to reload it.<video>1Playback has stopped because the end of the media was reached.<video>2An error occurred while fetching the media data, or the type of the resource is not a supported media format.<video>3The first frame of the media has finished loading.<video>4The metadata has been loaded.<video>5Playback has been paused.<video>6Playback has begun.<video>7Playback is ready to start after having been paused or delayed due to lack of data.<video>8Fired periodically as the browser loads a resource.<video>9The playback rate has changed.<video>0A seek operation completed.<video>1A seek operation began.<video>2The user agent is trying to fetch media data, but data is unexpectedly not forthcoming.<video>3Media data loading has been suspended.<video>4The time indicated by the <video>5 attribute has been updated.<video>6The volume has changed.<video>7Playback has stopped because of a temporary lack of data.

    Browsers don't all support the same video formats; you can provide multiple sources inside nested

    <!-- Using multiple sources as fallbacks for a video tag -->
    <!-- 'Elephants Dream' by Orange Open Movie Project Studio, licensed under CC-3.0, hosted by archive.org -->
    <!-- Poster hosted by Wikimedia -->
    <video
      width="620"
      controls
      poster="https://upload.wikimedia.org/wikipedia/commons/e/e8/Elephants_Dream_s5_both.jpg">
      <source
        src="https://archive.org/download/ElephantsDream/ed_hd.ogv"
        type="video/ogg" />
      <source
        src="https://archive.org/download/ElephantsDream/ed_hd.avi"
        type="video/avi" />
      <source
        src="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4"
        type="video/mp4" />
    
      Sorry, your browser doesn't support embedded videos, but don't worry, you can
      <a href="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4">
        download the MP4
      </a>
      and watch it with your favorite video player!
    </video>
    
    9 elements, and the browser will then use the first one it understands.

    <video controls>
      <source src="myVideo.webm" type="video/webm" />
      <source src="myVideo.mp4" type="video/mp4" />
      <p>
        Your browser doesn't support HTML video. Here is a
        <a href="myVideo.mp4">link to the video</a> instead.
      </p>
    </video>
    

    We offer a substantive and thorough guide to media file types and the guide to the codecs supported for video. Also available is a guide to audio codecs that can be used with them.

    Other usage notes:

    • If you don't specify the
      AddType video/ogg .ogm
      AddType video/ogg .ogv
      AddType video/ogg .ogg
      
      0 attribute, the video won't include the browser's default controls; you can create your own custom controls using JavaScript and the <audio>0 API. See Creating a cross-browser video player for more details.
    • To allow precise control over your video (and audio) content, <audio>0s fire many different . In addition to providing controllability, these events let you monitor the progress of both download and playback of the media, as well as the playback state and position.
    • You can use the <audio>2 property to adjust the positioning of the video within the element's frame, and the <audio>3 property to control how the video's size is adjusted to fit within the frame.
    • To show subtitles/captions along with your video, you can use some JavaScript along with the <audio>4 element and the WebVTT format. See Adding captions and subtitles to HTML video for more information.
    • You can play audio files using a <video> element. This can be useful if, for example, you need to perform audio with a WebVTT transcript, since the <audio> element doesn't allow captions using WebVTT.
    • To test the fallback content on browsers that support the element, you can replace <video> with a non-existing element like <audio>8.

    A good general source of information on using HTML <video> is the Video and audio content beginner's tutorial.

    The <video> element is a replaced element — its

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    01 value is
    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    02 by default, but its default width and height in the viewport is defined by the video being embedded.

    There are no special considerations for styling <video>; a common strategy is to give it a

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    01 value of
    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    05 to make it easier to position, size, etc., and then provide styling and layout information as required. Video player styling basics provides some useful styling techniques.

    You can detect when tracks are added to and removed from a <video> element using the

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    07 and
    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    08 events. However, these events aren't sent directly to the <video> element itself. Instead, they're sent to the track list object within the <video> element's <audio>0 that corresponds to the type of track that was added to the element:

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    12

    An

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    13 containing all of the media element's audio tracks. You can add a listener for
    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    07 to this object to be alerted when new audio tracks are added to the element.

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    15

    Add an

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    07 listener to this
    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    17 object to be informed when video tracks are added to the element.

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    18

    Add an

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    07 event listener to this
    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    20 to be notified when new text tracks are added to the element.

    For example, to detect when audio tracks are added to or removed from a <video> element, you can use code like this:

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    

    This code watches for audio tracks to be added to and removed from the element, and calls a hypothetical function on a track editor to register and remove the track from the editor's list of available tracks.

    You can also use

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    22 to listen for the
    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    07 and
    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    08 events.

    If the MIME type for the video is not set correctly on the server, the video may not show or show a gray box containing an X (if JavaScript is enabled).

    If you use Apache Web Server to serve Ogg Theora videos, you can fix this problem by adding the video file type extensions to "video/ogg" MIME type. The most common video file type extensions are ".ogm", ".ogv", or ".ogg". To do this, edit the "mime.types" file in "/etc/apache" or use the

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    25 configuration directive in
    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    26.

    AddType video/ogg .ogm
    AddType video/ogg .ogv
    AddType video/ogg .ogg
    

    If you serve your videos as WebM, you can fix this problem for the Apache Web Server by adding the extension used by your video files (".webm" is the most common one) to the MIME type "video/webm" via the "mime.types" file in "/etc/apache" or via the "AddType" configuration directive in

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    26.

    AddType video/webm .webm
    

    Your web host may provide an easy interface to MIME type configuration changes for new technologies until a global update naturally occurs.

    This example plays a video when activated, providing the user with the browser's default video controls to control playback.

    HTML

    <!-- Simple video example -->
    <!-- 'Big Buck Bunny' licensed under CC 3.0 by the Blender foundation. Hosted by archive.org -->
    <!-- Poster from peach.blender.org -->
    <video
      controls
      src="https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4"
      poster="https://peach.blender.org/wp-content/uploads/title_anouncement.jpg?x11217"
      width="620">
      Sorry, your browser doesn't support embedded videos, but don't worry, you can
      <a href="https://archive.org/details/BigBuckBunny_124">download it</a>
      and watch it with your favorite video player!
    </video>
    

    Result

    Until the video starts playing, the image provided in the

    <!-- Simple video example -->
    <!-- 'Big Buck Bunny' licensed under CC 3.0 by the Blender foundation. Hosted by archive.org -->
    <!-- Poster from peach.blender.org -->
    <video
      controls
      src="https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4"
      poster="https://peach.blender.org/wp-content/uploads/title_anouncement.jpg?x11217"
      width="620">
      Sorry, your browser doesn't support embedded videos, but don't worry, you can
      <a href="https://archive.org/details/BigBuckBunny_124">download it</a>
      and watch it with your favorite video player!
    </video>
    
    8 attribute is displayed in its place. If the browser doesn't support video playback, the fallback text is displayed.

    This example builds on the last one, offering three different sources for the media; this allows the video to be watched regardless of which video codecs are supported by the browser.

    HTML

    <!-- Using multiple sources as fallbacks for a video tag -->
    <!-- 'Elephants Dream' by Orange Open Movie Project Studio, licensed under CC-3.0, hosted by archive.org -->
    <!-- Poster hosted by Wikimedia -->
    <video
      width="620"
      controls
      poster="https://upload.wikimedia.org/wikipedia/commons/e/e8/Elephants_Dream_s5_both.jpg">
      <source
        src="https://archive.org/download/ElephantsDream/ed_hd.ogv"
        type="video/ogg" />
      <source
        src="https://archive.org/download/ElephantsDream/ed_hd.avi"
        type="video/avi" />
      <source
        src="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4"
        type="video/mp4" />
    
      Sorry, your browser doesn't support embedded videos, but don't worry, you can
      <a href="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4">
        download the MP4
      </a>
      and watch it with your favorite video player!
    </video>
    

    Result

    First is tried. If that can't be played, then AVI is tried. Finally, is tried. A fallback message is displayed if the video element isn't supported, but not if all sources fail.

    Some media file types let you provide more specific information using the

    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    29 parameter as part of the file's type string. A relatively simple example is
    const elem = document.querySelector("video");
    
    elem.audioTracks.onaddtrack = (event) => {
      trackEditor.addTrack(event.track);
    };
    
    elem.audioTracks.onremovetrack = (event) => {
      trackEditor.removeTrack(event.track);
    };
    
    30, which says that the file is a video using for its video and for audio.

    Videos should provide both captions and transcripts that accurately describe its content (see Adding captions and subtitles to HTML video for more information on how to implement these). Captions allow people who are experiencing hearing loss to understand a video's audio content as the video is being played, while transcripts allow people who need additional time to be able to review audio content at a pace and format that is comfortable for them.

    It's worth noting that while you can caption audio-only media, you can only do so when playing audio in a <video> element, since the video region of the element is used to present the captions. This is one of the special scenarios in which it's useful to play audio in a video element.

    If automatic captioning services are used, it is important to review the generated content to ensure it accurately represents the source video.

    In addition to spoken dialog, subtitles and transcripts should also identify music and sound effects that communicate important information. This includes emotion and tone:

    14
    00:03:14 --> 00:03:18
    [Dramatic rock music]
    
    15
    00:03:19 --> 00:03:21
    [whispering] What's that off in the distance?
    
    16
    00:03:22 --> 00:03:24
    It's… it's a…
    
    16 00:03:25 --> 00:03:32
    [Loud thumping]
    [Dishes clattering]
    

    Captions should not obstruct the main subject of the video. They can be positioned using .

    • Web Video Text Tracks Format (WebVTT)
    • WebAIM: Captions, Transcripts, and Audio Descriptions
    • Understanding Success Criterion 1.2.1 | W3C Understanding WCAG 2.0
    • Understanding Success Criterion 1.2.2 | W3C Understanding WCAG 2.0

    Content categories, phrasing content, embedded content. If it has a attribute: interactive content and palpable content.Permitted content

    If the element has a attribute: zero or more <audio>4 elements, followed by transparent content that contains no media elements–that is no <audio> or <video>.

    Else: zero or more

    <!-- Using multiple sources as fallbacks for a video tag -->
    <!-- 'Elephants Dream' by Orange Open Movie Project Studio, licensed under CC-3.0, hosted by archive.org -->
    <!-- Poster hosted by Wikimedia -->
    <video
      width="620"
      controls
      poster="https://upload.wikimedia.org/wikipedia/commons/e/e8/Elephants_Dream_s5_both.jpg">
      <source
        src="https://archive.org/download/ElephantsDream/ed_hd.ogv"
        type="video/ogg" />
      <source
        src="https://archive.org/download/ElephantsDream/ed_hd.avi"
        type="video/avi" />
      <source
        src="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4"
        type="video/mp4" />
    
      Sorry, your browser doesn't support embedded videos, but don't worry, you can
      <a href="https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4">
        download the MP4
      </a>
      and watch it with your favorite video player!
    </video>
    
    9 elements, followed by zero or more <audio>4 elements, followed by transparent content that contains no media elements–that is no <audio> or <video>.