diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/html/element%2Fvideo.html | |
new repository
Diffstat (limited to 'devdocs/html/element%2Fvideo.html')
| -rw-r--r-- | devdocs/html/element%2Fvideo.html | 369 |
1 files changed, 369 insertions, 0 deletions
diff --git a/devdocs/html/element%2Fvideo.html b/devdocs/html/element%2Fvideo.html new file mode 100644 index 00000000..4acc9a75 --- /dev/null +++ b/devdocs/html/element%2Fvideo.html @@ -0,0 +1,369 @@ +<header><h1><video>: The Video Embed element</h1></header><div class="section-content"><p>The <code><video></code> <a href="../index">HTML</a> element embeds a media player which supports video playback into the document. You can use <code><video></code> for audio content as well, but the <a href="audio"><code><audio></code></a> element may provide a more appropriate user experience.</p></div> +<h2 id="try_it">Try it</h2> +<div class="section-content"> +<iframe class="interactive is-tabbed-standard-height" height="200" src="https://interactive-examples.mdn.mozilla.net/pages/tabbed/video.html" title="MDN Web Docs Interactive Example" loading="lazy"></iframe> <p>The above example shows simple usage of the <code><video></code> element. In a similar manner to the <a href="img"><code><img></code></a> element, we include a path to the media we want to display inside the <code>src</code> 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.</p> <p>The content inside the opening and closing <code><video></video></code> tags is shown as a fallback in browsers that don't support the element.</p> +</div> +<h2 id="attributes">Attributes</h2> +<div class="section-content"> +<p>Like all other HTML elements, this element supports the <a href="../global_attributes">global attributes</a>.</p> <dl> <dt id="autoplay"><a href="#autoplay"><code>autoplay</code></a></dt> <dd> <p>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.</p> <div class="notecard note" id="sect1"> <p><strong>Note:</strong> 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 <a href="https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide">autoplay guide</a> for additional information about how to properly use autoplay.</p> </div> <p>To disable video autoplay, <code>autoplay="false"</code> will not work; the video will autoplay if the attribute is there in the <code><video></code> tag at all. To remove autoplay, the attribute needs to be removed altogether.</p> <p>In some browsers (e.g. Chrome 70.0) autoplay doesn't work if no <code>muted</code> attribute is present.</p> </dd> <dt id="controls"><a href="#controls"><code>controls</code></a></dt> <dd> <p>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.</p> </dd> <dt id="controlslist"> +<a href="#controlslist"><code>controlslist</code></a> <abbr class="icon icon-experimental" title="Experimental. Expect behavior to change in the future."> <span class="visually-hidden">Experimental</span> </abbr><abbr class="icon icon-nonstandard" title="Non-standard. Check cross-browser support before using."> <span class="visually-hidden">Non-standard</span> </abbr> +</dt> <dd> <p>The <a href="https://wicg.github.io/controls-list/explainer.html" target="_blank"><code>controlslist</code></a> attribute, when specified, helps the browser select what controls to show for the <code>video</code> element whenever the browser shows its own set of controls (that is, when the <code>controls</code> attribute is specified).</p> <p>The allowed values are <code>nodownload</code>, <code>nofullscreen</code> and <code>noremoteplayback</code>.</p> <p>Use the <a href="#disablepictureinpicture"><code>disablepictureinpicture</code></a> attribute if you want to disable the Picture-In-Picture mode (and the control).</p> </dd> <dt id="crossorigin"><a href="#crossorigin"><code>crossorigin</code></a></dt> <dd> <p>This <a href="https://developer.mozilla.org/en-US/docs/Glossary/Enumerated">enumerated</a> attribute indicates whether to use CORS to fetch the related video. <a href="../cors_enabled_image">CORS-enabled resources</a> can be reused in the <a href="canvas"><code><canvas></code></a> element without being <em>tainted</em>. The allowed values are:</p> <dl> <dt id="anonymous"><a href="#anonymous"><code>anonymous</code></a></dt> <dd> <p>Sends a cross-origin request without a credential. In other words, it sends the <code>Origin:</code> 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 <code>Access-Control-Allow-Origin:</code> HTTP header), the resource will be <em>tainted</em>, and its usage restricted.</p> </dd> <dt id="use-credentials"><a href="#use-credentials"><code>use-credentials</code></a></dt> <dd> <p>Sends a cross-origin request with a credential. In other words, it sends the <code>Origin:</code> HTTP header with a cookie, a certificate, or performing HTTP Basic authentication. If the server does not give credentials to the origin site (through <code>Access-Control-Allow-Credentials:</code> HTTP header), the resource will be <em>tainted</em> and its usage restricted.</p> </dd> </dl> <p>When not present, the resource is fetched without a CORS request (i.e. without sending the <code>Origin:</code> HTTP header), preventing its non-tainted use in <a href="canvas"><code><canvas></code></a> elements. If invalid, it is handled as if the enumerated keyword <code>anonymous</code> was used. See <a href="../attributes/crossorigin">CORS settings attributes</a> for additional information.</p> </dd> <dt id="disablepictureinpicture"> +<a href="#disablepictureinpicture"><code>disablepictureinpicture</code></a> <abbr class="icon icon-experimental" title="Experimental. Expect behavior to change in the future."> <span class="visually-hidden">Experimental</span> </abbr> +</dt> <dd> <p>Prevents the browser from suggesting a Picture-in-Picture context menu or to request Picture-in-Picture automatically in some cases.</p> </dd> <dt id="disableremoteplayback"> +<a href="#disableremoteplayback"><code>disableremoteplayback</code></a> <abbr class="icon icon-experimental" title="Experimental. Expect behavior to change in the future."> <span class="visually-hidden">Experimental</span> </abbr> +</dt> <dd> <p>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.).</p> <p>In Safari, you can use <a href="https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/AirPlayGuide/OptingInorOutofAirPlay/OptingInorOutofAirPlay.html" target="_blank"><code>x-webkit-airplay="deny"</code></a> as a fallback.</p> </dd> <dt id="height"><a href="#height"><code>height</code></a></dt> <dd> <p>The height of the video's display area, in <a href="https://drafts.csswg.org/css-values/#px" target="_blank">CSS pixels</a> (absolute values only; <a href="https://html.spec.whatwg.org/multipage/embedded-content.html#dimension-attributes" target="_blank">no percentages</a>).</p> </dd> <dt id="loop"><a href="#loop"><code>loop</code></a></dt> <dd> <p>A Boolean attribute; if specified, the browser will automatically seek back to the start upon reaching the end of the video.</p> </dd> <dt id="muted"><a href="#muted"><code>muted</code></a></dt> <dd> <p>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 <code>false</code>, meaning that the audio will be played when the video is played.</p> </dd> <dt id="playsinline"><a href="#playsinline"><code>playsinline</code></a></dt> <dd> <p>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 <em>does not</em> imply that the video will always be played in fullscreen.</p> </dd> <dt id="poster"><a href="#poster"><code>poster</code></a></dt> <dd> <p>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.</p> </dd> <dt id="preload"><a href="#preload"><code>preload</code></a></dt> <dd> <p>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:</p> <ul> <li> +<code>none</code>: Indicates that the video should not be preloaded.</li> <li> +<code>metadata</code>: Indicates that only video metadata (e.g. length) is fetched.</li> <li> +<code>auto</code>: Indicates that the whole video file can be downloaded, even if the user is not expected to use it.</li> <li> +<em>empty string</em>: Synonym of the <code>auto</code> value.</li> </ul> <p>The default value is different for each browser. The spec advises it to be set to <code>metadata</code>.</p> <div class="notecard note" id="sect2"> <p><strong>Note:</strong></p> <ul> <li>The <code>autoplay</code> attribute has precedence over <code>preload</code>. If <code>autoplay</code> is specified, the browser would obviously need to start downloading the video for playback.</li> <li>The specification does not force the browser to follow the value of this attribute; it is a mere hint.</li> </ul> </div> </dd> <dt id="src"><a href="#src"><code>src</code></a></dt> <dd> <p>The URL of the video to embed. This is optional; you may instead use the <a href="source"><code><source></code></a> element within the video block to specify the video to embed.</p> </dd> <dt id="width"><a href="#width"><code>width</code></a></dt> <dd> <p>The width of the video's display area, in <a href="https://drafts.csswg.org/css-values/#px" target="_blank">CSS pixels</a> (absolute values only; <a href="https://html.spec.whatwg.org/multipage/embedded-content.html#dimension-attributes" target="_blank">no percentages</a>).</p> </dd> </dl> +</div> +<h2 id="events">Events</h2> +<div class="section-content"><figure class="table-container"><div class="_table"><table class="no-markdown"> <thead> <tr> <th scope="col">Event Name</th> <th scope="col">Fired When</th> </tr> </thead> <tbody> <tr> <td> +<a href="https://developer.mozilla.org/en-US/docs/Web/API/ScriptProcessorNode/audioprocess_event"><code>audioprocess</code></a> <abbr class="icon icon-deprecated" title="Deprecated. Not for use in new websites."> <span class="visually-hidden">Deprecated</span> </abbr> +</td> <td> The input buffer of a <a href="https://developer.mozilla.org/en-US/docs/Web/API/ScriptProcessorNode"><code>ScriptProcessorNode</code></a> is ready to be processed. </td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/canplay_event"><code>canplay</code></a></td> <td> The 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. </td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/canplaythrough_event"><code>canplaythrough</code></a></td> <td> The browser estimates it can play the media up to its end without stopping for content buffering. </td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext/complete_event"><code>complete</code></a></td> <td> The rendering of an <a href="https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext"><code>OfflineAudioContext</code></a> is terminated. </td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/durationchange_event"><code>durationchange</code></a></td> <td>The <code>duration</code> attribute has been updated.</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/emptied_event"><code>emptied</code></a></td> <td> The media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/load" rel="internal"><code>load()</code></a> method is called to reload it. </td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/ended_event"><code>ended</code></a></td> <td>Playback has stopped because the end of the media was reached.</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/error_event"><code>error</code></a></td> <td> An error occurred while fetching the media data, or the type of the resource is not a supported media format. </td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/loadeddata_event"><code>loadeddata</code></a></td> <td>The first frame of the media has finished loading.</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/loadedmetadata_event"><code>loadedmetadata</code></a></td> <td>The metadata has been loaded.</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/loadstart_event"><code>loadstart</code></a></td> <td>Fired when the browser has started to load the resource.</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/pause_event"><code>pause</code></a></td> <td>Playback has been paused.</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play_event"><code>play</code></a></td> <td>Playback has begun.</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playing_event"><code>playing </code></a></td> <td> Playback is ready to start after having been paused or delayed due to lack of data. </td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/progress_event"><code>progress</code></a></td> <td>Fired periodically as the browser loads a resource.</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/ratechange_event"><code>ratechange</code></a></td> <td>The playback rate has changed.</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/seeked_event"><code>seeked</code></a></td> <td>A <em>seek</em> operation completed.</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/seeking_event"><code>seeking</code></a></td> <td>A <em>seek</em> operation began.</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/stalled_event"><code>stalled</code></a></td> <td> The user agent is trying to fetch media data, but data is unexpectedly not forthcoming. </td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/suspend_event"><code>suspend</code></a></td> <td>Media data loading has been suspended.</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/timeupdate_event"><code>timeupdate</code></a></td> <td> The time indicated by the <code>currentTime</code> attribute has been updated. </td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/volumechange_event"><code>volumechange</code></a></td> <td>The volume has changed.</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/waiting_event"><code>waiting</code></a></td> <td>Playback has stopped because of a temporary lack of data.</td> </tr> </tbody> </table></div></figure></div> +<h2 id="usage_notes">Usage notes</h2> +<div class="section-content"> +<p>Browsers don't all support the same video formats; you can provide multiple sources inside nested <a href="source"><code><source></code></a> elements, and the browser will then use the first one it understands.</p> <div class="code-example"> +<p class="example-header"><span class="language-name">html</span></p> +<pre data-signature="mCju5VvpFFVY1pIvMFUv4y82OMWccxnVrQNPUHbLNAI=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>video</span> <span class="token attr-name">controls</span><span class="token punctuation">></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>source</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>myVideo.webm<span class="token punctuation">"</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>video/webm<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>source</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>myVideo.mp4<span class="token punctuation">"</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>video/mp4<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span> + Your browser doesn't support HTML video. Here is a + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>myVideo.mp4<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>link to the video<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span> instead. + <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span> +<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>video</span><span class="token punctuation">></span></span> +</pre> +</div> <p>We offer a substantive and thorough <a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats">guide to media file types</a> and the <a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_codecs">guide to the codecs supported for video</a>. Also available is a guide to <a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Audio_codecs">audio codecs that can be used with them</a>.</p> <p>Other usage notes:</p> <ul> <li>If you don't specify the <code>controls</code> attribute, the video won't include the browser's default controls; you can create your own custom controls using JavaScript and the <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement"><code>HTMLMediaElement</code></a> API. See <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/Audio_and_video_delivery/cross_browser_video_player">Creating a cross-browser video player</a> for more details.</li> <li>To allow precise control over your video (and audio) content, <code>HTMLMediaElement</code>s fire many different <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement#events">events</a>. 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.</li> <li>You can use the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/object-position"><code>object-position</code></a> property to adjust the positioning of the video within the element's frame, and the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit"><code>object-fit</code></a> property to control how the video's size is adjusted to fit within the frame.</li> <li>To show subtitles/captions along with your video, you can use some JavaScript along with the <a href="track"><code><track></code></a> element and the <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API">WebVTT</a> format. See <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/Audio_and_video_delivery/Adding_captions_and_subtitles_to_HTML5_video">Adding captions and subtitles to HTML video</a> for more information.</li> <li>You can play audio files using a <code><video></code> element. This can be useful if, for example, you need to perform audio with a <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API">WebVTT</a> transcript, since the <a href="audio"><code><audio></code></a> element doesn't allow captions using WebVTT.</li> <li>To test the fallback content on browsers that support the element, you can replace <code><video></code> with a non-existing element like <code><notavideo></code>.</li> </ul> <p>A good general source of information on using HTML <code><video></code> is the <a href="https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Video_and_audio_content">Video and audio content</a> beginner's tutorial.</p> +</div> +<h3 id="styling_with_css">Styling with CSS</h3> +<div class="section-content"> +<p>The <code><video></code> element is a replaced element — its <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/display"><code>display</code></a> value is <code>inline</code> by default, but its default width and height in the viewport is defined by the video being embedded.</p> <p>There are no special considerations for styling <code><video></code>; a common strategy is to give it a <code>display</code> value of <code>block</code> to make it easier to position, size, etc., and then provide styling and layout information as required. <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/Audio_and_video_delivery/Video_player_styling_basics">Video player styling basics</a> provides some useful styling techniques.</p> +</div> +<h3 id="detecting_track_addition_and_removal">Detecting track addition and removal</h3> +<div class="section-content"> +<p>You can detect when tracks are added to and removed from a <code><video></code> element using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/VideoTrackList/addtrack_event"><code>addtrack</code></a> and <a href="https://developer.mozilla.org/en-US/docs/Web/API/VideoTrackList/removetrack_event"><code>removetrack</code></a> events. However, these events aren't sent directly to the <code><video></code> element itself. Instead, they're sent to the track list object within the <code><video></code> element's <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement"><code>HTMLMediaElement</code></a> that corresponds to the type of track that was added to the element:</p> <dl> <dt id="sect3"><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/audioTracks"><code>HTMLMediaElement.audioTracks</code></a></dt> <dd> <p>An <a href="https://developer.mozilla.org/en-US/docs/Web/API/AudioTrackList"><code>AudioTrackList</code></a> containing all of the media element's audio tracks. You can add a listener for <code>addtrack</code> to this object to be alerted when new audio tracks are added to the element.</p> </dd> <dt id="sect4"><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/videoTracks"><code>HTMLMediaElement.videoTracks</code></a></dt> <dd> <p>Add an <code>addtrack</code> listener to this <a href="https://developer.mozilla.org/en-US/docs/Web/API/VideoTrackList"><code>VideoTrackList</code></a> object to be informed when video tracks are added to the element.</p> </dd> <dt id="sect5"><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/textTracks"><code>HTMLMediaElement.textTracks</code></a></dt> <dd> <p>Add an <code>addtrack</code> event listener to this <a href="https://developer.mozilla.org/en-US/docs/Web/API/TextTrackList"><code>TextTrackList</code></a> to be notified when new text tracks are added to the element.</p> </dd> </dl> <p>For example, to detect when audio tracks are added to or removed from a <code><video></code> element, you can use code like this:</p> <div class="code-example"> +<p class="example-header"><span class="language-name">js</span></p> +<pre data-signature="P1adpaWeLeJpUywZ67D+U+xhFJnNqeKt09kAHkaso4c=" data-language="js"><span class="token keyword">const</span> elem <span class="token operator">=</span> document<span class="token punctuation">.</span><span class="token function">querySelector</span><span class="token punctuation">(</span><span class="token string">"video"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> + +elem<span class="token punctuation">.</span>audioTracks<span class="token punctuation">.</span><span class="token function-variable function">onaddtrack</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">event</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span> + trackEditor<span class="token punctuation">.</span><span class="token function">addTrack</span><span class="token punctuation">(</span>event<span class="token punctuation">.</span>track<span class="token punctuation">)</span><span class="token punctuation">;</span> +<span class="token punctuation">}</span><span class="token punctuation">;</span> + +elem<span class="token punctuation">.</span>audioTracks<span class="token punctuation">.</span><span class="token function-variable function">onremovetrack</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">event</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span> + trackEditor<span class="token punctuation">.</span><span class="token function">removeTrack</span><span class="token punctuation">(</span>event<span class="token punctuation">.</span>track<span class="token punctuation">)</span><span class="token punctuation">;</span> +<span class="token punctuation">}</span><span class="token punctuation">;</span> +</pre> +</div> <p>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.</p> <p>You can also use <a href="https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener"><code>addEventListener()</code></a> to listen for the <a href="https://developer.mozilla.org/en-US/docs/Web/API/VideoTrackList/addtrack_event"><code>addtrack</code></a> and <a href="https://developer.mozilla.org/en-US/docs/Web/API/VideoTrackList/removetrack_event"><code>removetrack</code></a> events.</p> +</div> +<h3 id="server_support_for_video">Server support for video</h3> +<div class="section-content"> +<p>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).</p> <p>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 <code>"AddType"</code> configuration directive in <code>httpd.conf</code>.</p> <pre data-language="plain">AddType video/ogg .ogm +AddType video/ogg .ogv +AddType video/ogg .ogg +</pre> <p>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 <code>httpd.conf</code>.</p> <pre data-language="plain">AddType video/webm .webm +</pre> <p>Your web host may provide an easy interface to MIME type configuration changes for new technologies until a global update naturally occurs.</p> +</div> +<h2 id="examples">Examples</h2> + +<h3 id="single_source">Single source</h3> +<div class="section-content"> +<p>This example plays a video when activated, providing the user with the browser's default video controls to control playback.</p> <h4 id="html">HTML</h4> <div class="code-example"> +<p class="example-header"><span class="language-name">html</span></p> +<pre data-signature="w9j9w9v6znMZNPHCXUvp5XjIjZ6oNzBi9clDzDwBT+Y=" data-language="html"><span class="token comment"><!-- Simple video example --></span> +<span class="token comment"><!-- 'Big Buck Bunny' licensed under CC 3.0 by the Blender foundation. Hosted by archive.org --></span> +<span class="token comment"><!-- Poster from peach.blender.org --></span> +<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>video</span> + <span class="token attr-name">controls</span> + <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4<span class="token punctuation">"</span></span> + <span class="token attr-name">poster</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>https://peach.blender.org/wp-content/uploads/title_anouncement.jpg?x11217<span class="token punctuation">"</span></span> + <span class="token attr-name">width</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>620<span class="token punctuation">"</span></span><span class="token punctuation">></span></span> + Sorry, your browser doesn't support embedded videos, but don't worry, you can + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>https://archive.org/details/BigBuckBunny_124<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>download it<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span> + and watch it with your favorite video player! +<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>video</span><span class="token punctuation">></span></span> +</pre> +</div> <h4 id="result">Result</h4> +<div class="code-example" id="sect6"> + +<iframe class="sample-code-frame" title="Single source sample" id="frame_single_source" height="400" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/video/runner.html?id=single_source" loading="lazy"></iframe> +</div> <p>Until the video starts playing, the image provided in the <code>poster</code> attribute is displayed in its place. If the browser doesn't support video playback, the fallback text is displayed.</p> +</div> +<h3 id="multiple_sources">Multiple sources</h3> +<div class="section-content"> +<p>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.</p> <h4 id="html_2">HTML</h4> <div class="code-example"> +<p class="example-header"><span class="language-name">html</span></p> +<pre data-signature="63xmYMO3MubFVlij4Mr8w2cuUqJ9+T/U3hQD/e0QHTw=" data-language="html"><span class="token comment"><!-- Using multiple sources as fallbacks for a video tag --></span> +<span class="token comment"><!-- 'Elephants Dream' by Orange Open Movie Project Studio, licensed under CC-3.0, hosted by archive.org --></span> +<span class="token comment"><!-- Poster hosted by Wikimedia --></span> +<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>video</span> + <span class="token attr-name">width</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>620<span class="token punctuation">"</span></span> + <span class="token attr-name">controls</span> + <span class="token attr-name">poster</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>https://upload.wikimedia.org/wikipedia/commons/e/e8/Elephants_Dream_s5_both.jpg<span class="token punctuation">"</span></span><span class="token punctuation">></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>source</span> + <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>https://archive.org/download/ElephantsDream/ed_hd.ogv<span class="token punctuation">"</span></span> + <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>video/ogg<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>source</span> + <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>https://archive.org/download/ElephantsDream/ed_hd.avi<span class="token punctuation">"</span></span> + <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>video/avi<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>source</span> + <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4<span class="token punctuation">"</span></span> + <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>video/mp4<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span> + + Sorry, your browser doesn't support embedded videos, but don't worry, you can + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4<span class="token punctuation">"</span></span><span class="token punctuation">></span></span> + download the MP4 + <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span> + and watch it with your favorite video player! +<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>video</span><span class="token punctuation">></span></span> +</pre> +</div> <h4 id="result_2">Result</h4> +<div class="code-example" id="sect7"> + +<iframe class="sample-code-frame" title="Multiple sources sample" id="frame_multiple_sources" height="400" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/video/runner.html?id=multiple_sources" loading="lazy"></iframe> +</div> <p>First <a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#ogg">Ogg</a> is tried. If that can't be played, then AVI is tried. Finally, <a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#mpeg-4_mp4">MP4</a> is tried. A fallback message is displayed if the video element isn't supported, but not if all sources fail.</p> <p>Some media file types let you provide more specific information using the <a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats/codecs_parameter"><code>codecs</code></a> parameter as part of the file's type string. A relatively simple example is <code>video/webm; codecs="vp8, vorbis"</code>, which says that the file is a <a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#webm">WebM</a> video using <a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_codecs#vp8">VP8</a> for its video and <a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Audio_codecs#vorbis">Vorbis</a> for audio.</p> +</div> +<h2 id="accessibility_concerns">Accessibility concerns</h2> +<div class="section-content"> +<p>Videos should provide both captions and transcripts that accurately describe its content (see <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/Audio_and_video_delivery/Adding_captions_and_subtitles_to_HTML5_video">Adding captions and subtitles to HTML video</a> 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.</p> <p>It's worth noting that while you can caption audio-only media, you can only do so when playing audio in a <a href="video" aria-current="page"><code><video></code></a> 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.</p> <p>If automatic captioning services are used, it is important to review the generated content to ensure it accurately represents the source video.</p> <p>In addition to spoken dialog, subtitles and transcripts should also identify music and sound effects that communicate important information. This includes emotion and tone:</p> <pre data-language="plain">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] +</pre> <p>Captions should not obstruct the main subject of the video. They can be positioned using <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API#cue_settings">the <code>align</code> VTT cue setting</a>.</p> <ul> <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API">Web Video Text Tracks Format (WebVTT)</a></li> <li><a href="https://webaim.org/techniques/captions/" target="_blank">WebAIM: Captions, Transcripts, and Audio Descriptions</a></li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable#guideline_1.2_%E2%80%94_providing_text_alternatives_for_time-based_media">MDN Understanding WCAG, Guideline 1.2 explanations</a></li> <li><a href="https://www.w3.org/TR/UNDERSTANDING-WCAG20/media-equiv-av-only-alt.html" target="_blank">Understanding Success Criterion 1.2.1 | W3C Understanding WCAG 2.0</a></li> <li><a href="https://www.w3.org/TR/UNDERSTANDING-WCAG20/media-equiv-captions.html" target="_blank">Understanding Success Criterion 1.2.2 | W3C Understanding WCAG 2.0</a></li> </ul> +</div> +<h2 id="technical_summary">Technical summary</h2> +<div class="section-content"><figure class="table-container"><div class="_table"><table class="properties"> <tbody> <tr> <th scope="row"><a href="../content_categories">Content categories</a></th> <td> <a href="../content_categories#flow_content">Flow content</a>, phrasing content, embedded content. If it has a <a href="video#controls" aria-current="page"><code>controls</code></a> attribute: interactive content and palpable content. </td> </tr> <tr> <th scope="row">Permitted content</th> <td> <p> If the element has a <a href="video#src" aria-current="page"><code>src</code></a> attribute: zero or more <a href="track"><code><track></code></a> elements, followed by transparent content that contains no media elements–that is no <a href="audio"><code><audio></code></a> or <a href="video" aria-current="page"><code><video></code></a>. </p> <p> Else: zero or more <a href="source"><code><source></code></a> elements, followed by zero or more <a href="track"><code><track></code></a> elements, followed by transparent content that contains no media elements–that is no <a href="audio"><code><audio></code></a> or <a href="video" aria-current="page"><code><video></code></a>. </p> </td> </tr> <tr> <th scope="row">Tag omission</th> <td>None, both the starting and ending tag are mandatory.</td> </tr> <tr> <th scope="row">Permitted parents</th> <td>Any element that accepts embedded content.</td> </tr> <tr> <th scope="row">Implicit ARIA role</th> <td><a href="https://www.w3.org/TR/html-aria/#dfn-no-corresponding-role" target="_blank">No corresponding role</a></td> </tr> <tr> <th scope="row">Permitted ARIA roles</th> <td><a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/application_role"><code>application</code></a></td> </tr> <tr> <th scope="row">DOM interface</th> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement"><code>HTMLVideoElement</code></a></td> </tr> </tbody> </table></div></figure></div> +<h2 id="specifications">Specifications</h2> +<div class="_table"><table class="standard-table"> +<thead><tr><th scope="col">Specification</th></tr></thead> +<tbody><tr><td><a href="https://html.spec.whatwg.org/multipage/media.html#the-video-element">HTML Standard <br><small># the-video-element</small></a></td></tr></tbody> +</table></div> +<h2 id="browser_compatibility">Browser compatibility</h2> +<div class="_table"><table> +<thead> +<tr id="bct-browser-type"> +<th></th> +<th colspan="6">Desktop</th> +<th colspan="6">Mobile</th> +</tr> +<tr id="bct-browsers"> +<th></th> +<th>Chrome</th> +<th>Edge</th> +<th>Firefox</th> +<th>Internet Explorer</th> +<th>Opera</th> +<th>Safari</th> +<th>WebView Android</th> +<th>Chrome Android</th> +<th>Firefox for Android</th> +<th>Opera Android</th> +<th>Safari on IOS</th> +<th>Samsung Internet</th> +</tr> +</thead> +<tbody> +<tr> +<th><code>video</code></th> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes">12</td> +<td class="bc-supports-yes">3.5</td> +<td class="bc-supports-yes">9</td> +<td class="bc-supports-yes">10.5</td> +<td class="bc-supports-yes">3.1</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes">14</td> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes">1.0</td> +</tr> +<tr> +<th><code>aspect_ratio_computed_from_attributes</code></th> +<td class="bc-supports-yes">79</td> +<td class="bc-supports-yes">79</td> +<td class="bc-supports-yes">71</td> +<td class="bc-supports-no">No</td> +<td class="bc-supports-yes">66</td> +<td class="bc-supports-yes">14</td> +<td class="bc-supports-yes">79</td> +<td class="bc-supports-yes">79</td> +<td class="bc-supports-yes">79</td> +<td class="bc-supports-yes">57</td> +<td class="bc-supports-yes">14</td> +<td class="bc-supports-yes">12.0</td> +</tr> +<tr> +<th><code>autoplay</code></th> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes">12</td> +<td class="bc-supports-yes">3.5</td> +<td class="bc-supports-yes">9</td> +<td class="bc-supports-yes">10.5</td> +<td class="bc-supports-yes">3.1</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes">14</td> +<td class="bc-supports-yes"><details><summary>10</summary>Only available for videos that have <a href="https://developer.apple.com/library/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_10_0.html">no sound or have the audio track disabled</a>.</details></td> +<td class="bc-supports-yes">1.0</td> +</tr> +<tr> +<th><code>controls</code></th> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes">12</td> +<td class="bc-supports-yes">3.5</td> +<td class="bc-supports-yes">9</td> +<td class="bc-supports-yes">10.5</td> +<td class="bc-supports-yes">3.1</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes">14</td> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes">1.0</td> +</tr> +<tr> +<th><code>crossorigin</code></th> +<td class="bc-supports-yes">33</td> +<td class="bc-supports-yes">≤18</td> +<td class="bc-supports-yes">74<details><summary>12–74</summary>With <code>crossorigin="use-credentials"</code>, cookies aren't sent during seek. See <a href="https://bugzil.la/1532722">bug 1532722</a>.</details> +</td> +<td class="bc-supports-no">No</td> +<td class="bc-supports-yes">20</td> +<td class="bc-supports-yes">10</td> +<td class="bc-supports-yes">4.4.3</td> +<td class="bc-supports-yes">33</td> +<td class="bc-supports-yes">79<details><summary>14–79</summary>With <code>crossorigin="use-credentials"</code>, cookies aren't sent during seek. See <a href="https://bugzil.la/1532722">bug 1532722</a>.</details> +</td> +<td class="bc-supports-yes">20</td> +<td class="bc-supports-yes">10</td> +<td class="bc-supports-yes">2.0</td> +</tr> +<tr> +<th><code>height</code></th> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes">12</td> +<td class="bc-supports-yes">3.5</td> +<td class="bc-supports-yes">9</td> +<td class="bc-supports-yes">10.5</td> +<td class="bc-supports-yes">3.1</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes">14</td> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes">1.0</td> +</tr> +<tr> +<th><code>loop</code></th> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes">12</td> +<td class="bc-supports-yes">11</td> +<td class="bc-supports-yes">9</td> +<td class="bc-supports-yes">10.5</td> +<td class="bc-supports-yes">3.1</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">18</td> +<td class="bc-supports-yes">14</td> +<td class="bc-supports-yes">14</td> +<td class="bc-supports-yes">6</td> +<td class="bc-supports-yes">1.0</td> +</tr> +<tr> +<th><code>muted</code></th> +<td class="bc-supports-yes">30</td> +<td class="bc-supports-yes">12</td> +<td class="bc-supports-yes">11</td> +<td class="bc-supports-yes">10</td> +<td class="bc-supports-yes">Yes</td> +<td class="bc-supports-yes">5</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">30</td> +<td class="bc-supports-yes">14</td> +<td class="bc-supports-yes">18</td> +<td class="bc-supports-no">No</td> +<td class="bc-supports-yes">2.0</td> +</tr> +<tr> +<th><code>poster</code></th> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes">12</td> +<td class="bc-supports-yes">3.6</td> +<td class="bc-supports-yes">9</td> +<td class="bc-supports-yes">10.5</td> +<td class="bc-supports-yes">3.1</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes">14</td> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes">1.0</td> +</tr> +<tr> +<th><code>preload</code></th> +<td class="bc-supports-yes"><details><summary>3</summary>Defaults to <code>metadata</code> in Chrome 64.</details></td> +<td class="bc-supports-yes">12</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes">9</td> +<td class="bc-supports-yes"><details><summary>Yes</summary>Defaults to <code>metadata</code> in Opera 51.</details></td> +<td class="bc-supports-yes">3.1</td> +<td class="bc-supports-yes"><details><summary>Yes</summary>Defaults to <code>metadata</code> in Chrome 64.</details></td> +<td class="bc-supports-yes"><details><summary>Yes</summary>Defaults to <code>metadata</code> in Chrome 64.</details></td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes"><details><summary>Yes</summary>Defaults to <code>metadata</code> in Opera 51.</details></td> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes"><details><summary>Yes</summary>Defaults to <code>metadata</code> in Samsung Internet 9.0.</details></td> +</tr> +<tr> +<th><code>src</code></th> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes">12</td> +<td class="bc-supports-yes">3.5</td> +<td class="bc-supports-yes">9</td> +<td class="bc-supports-yes">10.5</td> +<td class="bc-supports-yes">3.1</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes">14</td> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes">1.0</td> +</tr> +<tr> +<th><code>width</code></th> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes">12</td> +<td class="bc-supports-yes">3.5</td> +<td class="bc-supports-yes">9</td> +<td class="bc-supports-yes">10.5</td> +<td class="bc-supports-yes">3.1</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes">14</td> +<td class="bc-supports-yes">3</td> +<td class="bc-supports-yes">1.0</td> +</tr> +</tbody> +</table></div> +<h2 id="see_also">See also</h2> +<div class="section-content"><ul> <li> +<a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats">Guide to media types and formats on the web</a> <ul> <li><a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers">Media container formats (file types)</a></li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_codecs">Web video codec guide</a></li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Audio_codecs">Web audio codec guide</a></li> </ul> </li> <li>Positioning and sizing the picture within its frame: <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/object-position"><code>object-position</code></a> and <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit"><code>object-fit</code></a> +</li> <li><a href="audio"><code><audio></code></a></li> <li><a href="https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Video_and_audio_content">Using HTML audio and video</a></li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Manipulating_video_using_canvas">Manipulating video using canvas</a></li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Configuring_servers_for_Ogg_media">Configuring servers for Ogg media</a></li> </ul></div><div class="_attribution"> + <p class="_attribution-p"> + © 2005–2023 MDN contributors.<br>Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.<br> + <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video" class="_attribution-link">https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video</a> + </p> +</div> |
