Search completed in 1.30 seconds.
720 results for "video":
Your results are loading. Please wait...
<video>: The Video Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › video
You can use <video> for audio content as well, but the <audio> element may provide a more appropriate user experience. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The above example shows simple usage of the <video> element. ...
...cument. You can use <video> for audio content as well, but the <audio> element may provide a more appropriate user experience. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The above example shows simple usage of the <video> element. In a similar manner to the <img> element, we include a path to the media we want to display inside the src 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. ...
...hows simple usage of the <video> element. In a similar manner to the <img> element, we include a path to the media we want to display inside the src 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 <video></video> tags is shown as a fallback in browsers that don't support the element. Attributes Like all other HTML elements, this element supports the global attributes. autoplay 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. ...
...And 42 more matches
HTMLVideoElement.msInsertVideoEffect() - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The HTMLMediaElement.msInsertVideoEffect() method inserts the specified video effect into the media pipeline. This proprietary method is specific to Internet Explorer and Microsoft Edge. Syntax str = HTMLMediaElement.msInsertVideoEffect(activatableClassId: DOMString, effectRequired: boolean, config); Parameters activatableClassId A DOMString defining the video effects class. effectRequired A Boolean which if set to true requires a video effect to be defined. configOptional An optional Obje...
...ct(activatableClassId: DOMString, effectRequired: boolean, config); Parameters activatableClassId A DOMString defining the video effects class. ...
...effectRequired: boolean, config); Parameters activatableClassId A DOMString defining the video effects class. effectRequired A Boolean which if set to true requires a video effect to be defined. configOptional An optional Object to help with defining any additional configuration needed. Return value This method does not return a value. ...
...And 5 more matches
HTMLVideoElement.videoHeight - Web APIs
If the element's readyState is HTMLMediaElement.HAVE_NOTHING, then the value of this property is 0, because neither video nor poster frame size information is yet available. ...
...If the element's readyState is HTMLMediaElement.HAVE_NOTHING, then the value of this property is 0, because neither video nor poster frame size information is yet available. ...
... The HTMLVideoElement interface's read-only videoHeight property indicates the intrinsic height of the video, expressed in CSS pixels. In simple terms, this is the height of the media in its natural size. See About intrinsic width and height for more details. Syntax height = htmlVideoElement.videoHeight; Value An integer value specifying the intrinsic height of the video in CSS pixels. If the element's readyState is HTMLMediaElement.HAVE_NOTHING, then the value of this property is 0, because neither video nor poster frame size information is yet available. About intrinsic width and height A user agent calculates the intrinsic width and height of the element's media by starting with the media's raw pixel width and height, then taking into account factors including: The media's aspect ra...
...And 3 more matches
HTMLVideoElement.videoWidth - Web APIs
If the element's readyState is HTMLMediaElement.HAVE_NOTHING, then the value of this property is 0, because neither video nor poster frame size information is yet available. ...
...If the element's readyState is HTMLMediaElement.HAVE_NOTHING, then the value of this property is 0, because neither video nor poster frame size information is yet available. ...
... The HTMLVideoElement interface's read-only videoWidth property indicates the intrinsic width of the video, expressed in CSS pixels. In simple terms, this is the width of the media in its natural size. See About intrinsic width and height for more details. Syntax width = htmlVideoElement.videoWidth; Value An integer value specifying the intrinsic width of the video in CSS pixels. If the element's readyState is HTMLMediaElement.HAVE_NOTHING, then the value of this property is 0, because neither video nor poster frame size information is yet available. About intrinsic width and height A user agent calculates the intrinsic width and height of the element's media by starting with the media's raw pixel width and height, then taking into account factors including: The media's aspect ratio. ...
...And 3 more matches
VideoPlaybackQuality.droppedVideoFrames - Web APIs
The read-only droppedVideoFrames property of the VideoPlaybackQuality interface returns the number of video frames which have been dropped rather than being displayed since the last time the media was loaded into the HTMLVideoElement. Syntax value = videoPlaybackQuality.droppedVideoFrames; Value An unsigned 64-bit value indicating the number of frames that have been dropped since the last time the media in the <video> element was loaded or reloaded. This information can be used to determine whether or not to downgrade the video stream to avoid dropping frames. Frames are typically dropped either before or after decoding them, when it's determined that it will not be possible to draw them to the screen at the correct time. ...
...n dropped since the last time the media in the <video> element was loaded or reloaded. This information can be used to determine whether or not to downgrade the video stream to avoid dropping frames. Frames are typically dropped either before or after decoding them, when it's determined that it will not be possible to draw them to the screen at the correct time. ...
...edia in the <video> element was loaded or reloaded. This information can be used to determine whether or not to downgrade the video stream to avoid dropping frames. Frames are typically dropped either before or after decoding them, when it's determined that it will not be possible to draw them to the screen at the correct time. ...
...And 2 more matches
VideoPlaybackQuality.corruptedVideoFrames - Web APIs
The VideoPlaybackQuality interface's read-only corruptedVideoFrames property the number of corrupted video frames that have been received since the <video> element was last loaded or reloaded. Syntax corruptFrameFount = videoPlaybackQuality.corruptedVideoFrames; Value The number of corrupted video frames that have been received since the <video> element was last loaded or reloaded. It is up to the user agent to determine whether or not to display a corrupted video frame. If a corrupted frame is dropped, then both corruptedVideoFrames and droppedVideoFrames are incremented. ...
...he <video> element was last loaded or reloaded. It is up to the user agent to determine whether or not to display a corrupted video frame. If a corrupted frame is dropped, then both corruptedVideoFrames and droppedVideoFrames are incremented. Example This example determines the percentage of frames which have been corrupted, and if the value is greater than 5%, calls a funciton called downgradeVideo() that would be implemented to switch to a different video that might tax the network less. ...
... to display a corrupted video frame. If a corrupted frame is dropped, then both corruptedVideoFrames and droppedVideoFrames are incremented. Example This example determines the percentage of frames which have been corrupted, and if the value is greater than 5%, calls a funciton called downgradeVideo() that would be implemented to switch to a different video that might tax the network less. var videoElem = document.getElementById("my_vid"); var quality = videoElem.getVideoPlaybackQuality(); if (quality.corruptedVideoFrames/quality.totalVideoFrames > 0.05) { downgradeVideo(videoElem); } Specifications Specification Status Comment Media Playback QualityThe definition of 'VideoPlaybackQuality: corruptedVideoFrames' in that specification. Editor's Draft ...
VideoPlaybackQuality.totalVideoFrames - Web APIs
The VideoPlaybackQuality interface's totalVideoFrames read-only property returns the total number of video frames that have been displayed or dropped since the media was loaded. Syntax value = videoPlaybackQuality.totalVideoFrames; Value The total number of frames that the <video> element has displayed or dropped since the media was loaded into it. Essentially, this is the number of frames the element would have presented had no problems occurred. This value is reset when the media is reloaded or replaced. Example This example calls getVideoPlaybackQuality() to obtain a VideoPlaybackQuality object, then determines what percentage of frames have been lost by either corruption or being dropped. If that exceeds 10% (0.1), a function called lostFramesThresholdExceeded() is called to, perhap...
...et when the media is reloaded or replaced. Example This example calls getVideoPlaybackQuality() to obtain a VideoPlaybackQuality object, then determines what percentage of frames have been lost by either corruption or being dropped. If that exceeds 10% (0.1), a function called lostFramesThresholdExceeded() is called to, perhaps, update a quality indicator to show an increase in frame loss. var videoElem = document.getElementById("my_vid"); var quality = videoElem.getVideoPlaybackQuality(); if ((quality.corruptedVideoFrames + quality.droppedVideoFrames)/quality.totalVideoFrames > 0.1) { lostFramesThresholdExceeded(); } A similar algorithm might be used to attempt to switch to a lower-resolution video that requires less bandwidth, in order to avoid dropping frames. Specifications ...
...ty(); if ((quality.corruptedVideoFrames + quality.droppedVideoFrames)/quality.totalVideoFrames > 0.1) { lostFramesThresholdExceeded(); } A similar algorithm might be used to attempt to switch to a lower-resolution video that requires less bandwidth, in order to avoid dropping frames. Specifications Specification Status Comment Media Playback QualityThe definition of 'VideoPlaybackQuality.totalVideoFrames' in that specification. Editor's Draft Initial definition. ...
HTMLVideoElement.getVideoPlaybackQuality() - Web APIs
The HTMLVideoElement method getVideoPlaybackQuality() creates and returns a VideoPlaybackQuality object containing metrics including how many frames have been lost. The data returned can be used to evaluate the quality of the video stream. Syntax videoPQ = videoElement.getVideoPlaybackQuality(); Return value A VideoPlaybackQuality object providing information about the video element's current playback quality. Example This example updates an element to indicate the total number of video frames that have elapsed so far in the playback process. ...
...t.getVideoPlaybackQuality(); Return value A VideoPlaybackQuality object providing information about the video element's current playback quality. Example This example updates an element to indicate the total number of video frames that have elapsed so far in the playback process. This value includes any dropped or corrupted frames, so it's not the same as "total number of frames played." var videoElem = document.getElementById("my_vid"); var counterElem = document.getElementById("counter"); var quality = videoElem.getVideoPlaybackQuality(); counterElem.innerText = quality.totalVideoFrames; Specifications Specification Status Comment Media Playback QualityThe definition of 'HTMLVideoElement.getVideoPlaybackQuality()' in that specification. Editor's Draft In...
Web video codec guide - Web media technologies
Due to the sheer size of uncompressed video data, it's necessary to compress it significantly in order to store it, let alone transmit it over a network. Imagine the amount of data needed to store uncompressed video: A single frame of high definition (1920x1080) video in full color (4 bytes per pixel) is 8,294,400 bytes. At a typical 30 frames per second, each second of HD video would occupy 248,832,000 bytes (~249 MB). A minute of HD video would need 14.93 GB of storage. A fairly typical 30 minute video conference would need about 447.9 GB of storage, and a 2-hour movie would take almost 1.79 TB (that is, 1790 GB). ...
... frames per second, each second of HD video would occupy 248,832,000 bytes (~249 MB). A minute of HD video would need 14.93 GB of storage. A fairly typical 30 minute video conference would need about 447.9 GB of storage, and a 2-hour movie would take almost 1.79 TB (that is, 1790 GB). Not only is the required storage space enormous, but the network bandwidth needed to transmit an uncompressed video like that would be enormous, at 249 MB/sec--not including audio and overhead. This is where video codecs come in. Just as audio codecs do for the sound data, video codecs compress the video data and encode it into a format that can later be decoded and played back or edited. Most video codecs are lossy, in that the decoded video does not precisely match the source. Some details may be lost; the ...
...o does not precisely match the source. Some details may be lost; the amount of loss depends on the codec and how it's configured, but as a general rule, the more compression you achieve, the more loss of detail and fidelity will occur. Some lossless codecs do exist, but they are typically used for archival and storage for local playback rather than for use on a network. This guide introduces the video codecs you're most likely to encounter or consider using on the web, summaries of their capabilities and any compatibility and utility concerns, and advice to help you choose the right codec for your project's video. Common codecs The following video codecs are those which are most commonly used on the web. For each codec, the containers (file types) that can support them are also listed. Each ...
...And 86 more matches
Audio and Video Delivery - Developer guides
We can deliver audio and video on the web in a number of ways, ranging from 'static' media files to adaptive live streams. This article is intended as a starting point for exploring the various delivery mechanisms of web based media and compatibility with popular browsers. The Audio and Video Elements Whether we are dealing with pre-recorded audio files or live streams, the mechanism for making them available through the browser's <audio> and <video> elements remains pretty much the same. Currently, to support all browsers we need to specify two formats, although with the adoption of MP3 and MP4 formats in Firefox and Opera, this is changing fast. You can find compatibility information in the Guide to media types and formats on the web. ...
...live streams, the mechanism for making them available through the browser's <audio> and <video> elements remains pretty much the same. Currently, to support all browsers we need to specify two formats, although with the adoption of MP3 and MP4 formats in Firefox and Opera, this is changing fast. You can find compatibility information in the Guide to media types and formats on the web. To deliver video and audio, the general workflow is usually something like this: Check what format the browser supports via feature detection (usually a choice of two, as stated above). If the browser doesn't support playback of any of the provided formats natively, either present a still image or use a fallback technology to present the video. Identify how you want to play/instantiate the media (e.g. a <vid...
...lly something like this: Check what format the browser supports via feature detection (usually a choice of two, as stated above). If the browser doesn't support playback of any of the provided formats natively, either present a still image or use a fallback technology to present the video. Identify how you want to play/instantiate the media (e.g. a <video> element, or document.createElement('video') perhaps?) Deliver the media file to the player. HTML Audio <audio controls preload="auto"> <source src="audiofile.mp3" type="audio/mpeg"> <!-- fallback for browsers that don't support mp3 --> <source src="audiofile.ogg" type="audio/ogg"> <!-- fallback for browsers that don't support audio tag --> <a href="audiofile.mp3">download audio</a> </audio> The code above will create an ...
...And 73 more matches
Creating a cross-browser video player - Developer guides
This article describes a simple HTML5 video player that uses the Media and Fullscreen APIs and works across most major desktop and mobile browsers. As well as working fullscreen, the player features custom controls rather than just using the browser defaults. The player controls themselves won't be styled beyond the basics required to get them working; full styling of the player will be taken care of in a future article. Working example Our example video player displays a clip from an open source movie called Tears of Steel, and includes typical video controls. Note: You can see the example running live, or check out the source code on Github. HTML Markup To start off with, let's take a look at the HTML that makes up the player. ...
... full styling of the player will be taken care of in a future article. Working example Our example video player displays a clip from an open source movie called Tears of Steel, and includes typical video controls. Note: You can see the example running live, or check out the source code on Github. HTML Markup To start off with, let's take a look at the HTML that makes up the player. The video First of all the <video> element is defined, contained within a <figure> element that acts as the video container. To anyone familiar with HTML5 markup and the <video> element, there should be nothing here that surprises you. ...
...mple running live, or check out the source code on Github. HTML Markup To start off with, let's take a look at the HTML that makes up the player. The video First of all the <video> element is defined, contained within a <figure> element that acts as the video container. To anyone familiar with HTML5 markup and the <video> element, there should be nothing here that surprises you. ...
...And 50 more matches
Video and audio content - Learn web development
Previous Overview: Multimedia and embedding Next Now that we are comfortable with adding simple images to a webpage, the next step is to start adding video and audio players to your HTML documents! ...
... Previous Overview: Multimedia and embedding Next Now that we are comfortable with adding simple images to a webpage, the next step is to start adding video and audio players to your HTML documents! ...
... Previous Overview: Multimedia and embedding Next Now that we are comfortable with adding simple images to a webpage, the next step is to start adding video and audio players to your HTML documents! ...
...And 42 more matches
Signaling and video calling - Web APIs
A form of discovery and media format negotiation must take place, as discussed elsewhere, in order for two devices on different networks to locate one another. ...
...A form of discovery and media format negotiation must take place, as discussed elsewhere, in order for two devices on different networks to locate one another. ...
...d signaling and involves both devices connecting to a third, mutually agreed-upon server. Through this third server, the two devices can locate one another, and exchange negotiation messages. In this article, we will further enhance the WebSocket chat first created as part of our WebSocket documentation (this article link is forthcoming; it isn't actually online yet) to support opening a two-way video call between users. You can try out this example on Glitch, and you can remix the example to experiment with it as well. You can also look at the full project on GitHub. Note: If you try out the example on Glitch, please note that any changes made to the code will immediately reset any connections. In addition, there is a short timeout period; the Glitch instance is for quick experiments and te...
...And 42 more matches
Audio and video manipulation - Developer guides
The beauty of the web is that you can combine technologies to create new forms. Having native audio and video in the browser means we can use these data streams with technologies such as <canvas>, WebGL or Web Audio API to modify audio and video directly, for example adding reverb/compression effects to audio, or grayscale/sepia filters to video. This article provides a reference to explain what you need to do. Video manipulation The ability to read the pixel values from each frame of a video can be very useful. Video and canvas The <canvas> element provides a surface for drawing graphics onto web pages; it is very powerful and can be coupled tightly with video. The general technique is to: Write a frame from the <video> element to an intermediary <canvas> element. Read the d...
...vides a surface for drawing graphics onto web pages; it is very powerful and can be coupled tightly with video. The general technique is to: Write a frame from the <video> element to an intermediary <canvas> element. Read the data from the intermediary <canvas> element and manipulate it. Write the manipulated data to your "display" <canvas>. Pause and repeat. For example, let's process a video to display it in greyscale. In this case, we'll show both the source video and the output greyscale frames. ...
...from the <video> element to an intermediary <canvas> element. Read the data from the intermediary <canvas> element and manipulate it. Write the manipulated data to your "display" <canvas>. Pause and repeat. For example, let's process a video to display it in greyscale. In this case, we'll show both the source video and the output greyscale frames. Ordinarily, if you were implementing a "play video in greyscale" feature, you'd probably add display: none to the style for the <video> element, to keep the source video from being drawn to the screen while showing only the canvas showing the altered frames. ...
...And 31 more matches
Video and Audio APIs - Learn web development
Previous Overview: Client-side web APIs Next HTML5 comes with elements for embedding rich media in documents -- <video> and <audio> -- which in turn come with their own APIs for controlling playback, seeking, etc. This article shows you how to do common tasks such as creating custom playback controls. Prerequisites: JavaScript basics (see first steps, building blocks, JavaScript objects), the basics of Client-side APIs Objective: To learn how to use browser APIs to control video and audio playback. HTML5 video and audio The <video> and <audio> elements allow us to embed video and audio into web pages. ...
...s such as creating custom playback controls. Prerequisites: JavaScript basics (see first steps, building blocks, JavaScript objects), the basics of Client-side APIs Objective: To learn how to use browser APIs to control video and audio playback. HTML5 video and audio The <video> and <audio> elements allow us to embed video and audio into web pages. As we showed in Video and audio content, a typical implementation looks like this: <video controls> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>Your browser doesn't support HTML5 video. Here is a <a href="rabbit320.mp4">link to the video</a> instead.</p> </video> This creates a video player inside the browser like so: You can review what all the HTML feat...
...One big issue with the native browser controls is that they are different in each browser -- not very good for cross-browser support! Another big issue is that the native controls in most browsers aren't very keyboard-accessible. ...
...And 30 more matches
Video player styling basics - Developer guides
In the previous Cross browser video player article we described how to build a cross-browser HTML5 video player using the Media and Fullscreen APIs. This follow-up article looks at how to style this custom player, including making it responsive. The example in action You can find the code for the updated, styled example on Github, and view it live. Preliminary modifications from the original example This section summarises the modifications that were made to the original video player example to make the styling task easier, before the bulk of the work was started. HTML Markup There are a few changes that were made to the HTML markup shown in the previous article. ...
...de for the updated, styled example on Github, and view it live. Preliminary modifications from the original example This section summarises the modifications that were made to the original video player example to make the styling task easier, before the bulk of the work was started. HTML Markup There are a few changes that were made to the HTML markup shown in the previous article. The custom video controls and <progress> element are now contained within <div> elements, rather than residing inside unordered list items. ...
...player example to make the styling task easier, before the bulk of the work was started. HTML Markup There are a few changes that were made to the HTML markup shown in the previous article. The custom video controls and <progress> element are now contained within <div> elements, rather than residing inside unordered list items. ...
...And 30 more matches
Adding captions and subtitles to HTML5 video - Developer guides
In other articles we looked at how to build a cross browser video player using the HTMLMediaElement and Window.fullScreen APIs, and also at how to style the player. This article will take the same player and show how to add captions and subtitles to it, using the WebVTT format and the <track> element. Captioned video example In this article, we will refer to the Video player with captions example. This example uses an excerpt from the Sintel open movie, created by the Blender Foundation. Note: You can find the source on Github, and also view the example live. HTML5 and Video Captions Before diving into how to add captions to the video player, there are a number of things that we will first mention, which you should be aware of before we start. Captions versus subtitles Capt...
.... They are however implemented in the same way technically, so the material in this article will apply to both. For this article we will refer to the text tracks displayed as subtitles, as their content is aimed at hearing people who have difficulty understanding the language of the film, rather than deaf or hard-of-hearing people. The <track> element HTML5 allows us to specify subtitles for a video using the <track> element. The various attributes of this element allow us to specify such things as the type of content that we're adding, the language it's in, and of course a reference to the text file that contains the actual subtitle information. WebVTT The files that contain the actual subtitle data are simple text files that follow a specified format, in this case the Web Video Text Trac...
...'re adding, the language it's in, and of course a reference to the text file that contains the actual subtitle information. WebVTT The files that contain the actual subtitle data are simple text files that follow a specified format, in this case the Web Video Text Tracks (WebVTT) format. The WebVTT specification is still being worked on, but major parts of it are stable so we can use it today. Video providers (such as the Blender Foundation) provide captions and subtitles in a text format with their videos, but they're usually in the SubRip Text (SRT) format. These can be easily converted to WebVTT using an online converter such as srt2vtt. Modifications to the HTML and CSS This section summarises the modifications made to the previous article's code in order to facilitate the addition of ...
...And 24 more matches
DASH Adaptive Streaming for HTML 5 Video - HTML: Hypertext Markup Language
Dynamic Adaptive Streaming over HTTP (DASH) is an adaptive streaming protocol. This means that it allows for a video stream to switch between bit rates on the basis of network performance, in order to keep a video playing. Browser Support Firefox 21 includes an implementation of DASH for HTML5 WebM video which is turned off by default. It can be enabled via "about:config" and the "media.dash.enabled" preference. Firefox 23 removed support for DASH for HTML5 WebM video. It will be replaced by an implementation of the Media Source Extensions API which will allow support for DASH via Javascript libraries such as dash.js. See bug 778617 for details. ...
...off by default. It can be enabled via "about:config" and the "media.dash.enabled" preference. Firefox 23 removed support for DASH for HTML5 WebM video. It will be replaced by an implementation of the Media Source Extensions API which will allow support for DASH via Javascript libraries such as dash.js. See bug 778617 for details. Using DASH - Server Side First you'll need to convert your WebM video to a DASH manifest with the accompanying video files in various bit rates. ...
...ion of the Media Source Extensions API which will allow support for DASH via Javascript libraries such as dash.js. See bug 778617 for details. Using DASH - Server Side First you'll need to convert your WebM video to a DASH manifest with the accompanying video files in various bit rates. To start with you'll only need the ffpmeg program from ffmpeg.org, with libvpx and libvorbis support for WebM video and audio, at least version 2.5 (probably; this was tested ith 3.2.5). 1. Use your existing WebM file to create one audio file and multiple video files. ...
...And 14 more matches
Multimedia: video - Learn web development
Previous Overview: Performance Next As we learned in the previous section, media, namely images and video, account for over 70% of the bytes downloaded for the average website. We have already taken a look at optimizing images. This article looks at optimizing video to improve web performance. Prerequisites: Basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. Objective: To learn about the various video formats, their impact on performance, and how to reduce video impact on overall page load time while serving the smallest video file size based on each browsers file type support. ...
...software installed, and basic knowledge of client-side web technologies. Objective: To learn about the various video formats, their impact on performance, and how to reduce video impact on overall page load time while serving the smallest video file size based on each browsers file type support. Why optimize your multimedia? ...
..., and basic knowledge of client-side web technologies. Objective: To learn about the various video formats, their impact on performance, and how to reduce video impact on overall page load time while serving the smallest video file size based on each browsers file type support. Why optimize your multimedia? ...
...And 13 more matches
Manipulating video using canvas - Web APIs
This tutorial demonstrates how to perform chroma-keying (also known as the "green screen effect") using JavaScript code. The document content The HTML document used to render this content is shown below. ...
...html> <head> <style> body { background: black; color:#CCCCCC; } #c2 { background-image: url(media/foo.png); background-repeat: no-repeat; } div { float: left; border :1px solid #444444; padding:10px; margin: 10px; background:#3B3B3B; } </style> </head> <body> <div> <video id="video" src="media/video.mp4" controls="true" crossorigin="anonymous"/> </div> <div> <canvas id="c1" width="160" height="96"></canvas> <canvas id="c2" width="160" height="96"></canvas> </div> <script type="text/javascript" src="processor.js"></script> </body> </html> The key bits to take away from this are: This document establishes two canvas elements, with th...
.../div> <div> <canvas id="c1" width="160" height="96"></canvas> <canvas id="c2" width="160" height="96"></canvas> </div> <script type="text/javascript" src="processor.js"></script> </body> </html> The key bits to take away from this are: This document establishes two canvas elements, with the IDs c1 and c2. Canvas c1 is used to display the current frame of the original video, while c2 is used to display the video after performing the chroma-keying effect; c2 is preloaded with the still image that will be used to replace the green background in the video. The JavaScript code is imported from a script named processor.js. The JavaScript code The JavaScript code in processor.js consists of three methods. Initializing the chroma-key player The doLoad() method is cal...
...And 13 more matches
HTMLVideoElement - Web APIs
It also inherits properties and methods of HTMLMediaElement and HTMLElement. The list of supported media formats varies from one browser to the other. You should either provide your video in a single format that all the relevant browsers supports, or provide multiple video sources in enough different formats that all the browsers you need to support are covered. ...
... The HTMLVideoElement interface provides special properties and methods for manipulating video objects. It also inherits properties and methods of HTMLMediaElement and HTMLElement. The list of supported media formats varies from one browser to the other. You should either provide your video in a single format that all the relevant browsers supports, or provide multiple video sources in enough different formats that all the browsers you need to support are covered. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/AP...
...l="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="411" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLMediaElement</text></a><polyline points="331,89 321,84 321,94 331,89" stroke="#D4DDE4" fill="none"/><line x1="321" y1="89" x2="291" y2="89" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/HTMLVideoElement" target="_top"><rect x="131" y="65" width="160" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="211" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLVideoElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits p...
...And 10 more matches
MediaStreamConstraints.video - Web APIs
The MediaStreamConstraints dictionary's video property is used to indicate what kind of video track, if any, should be included in the MediaStream returned by a call to getUserMedia(). To learn more about how constraints work, see Capabilities, constraints, and settings. Syntax var videoConstraints = true | false | MediaTrackConstraints; Value The value of the video property can be specified as either of two types: Boolean If a Boolean value is specified, it simply indicates whether or not a video track should be included in the returned stream; if it's true, a video track is included; if no video source is available or if permission is not given to use the video source, the call to getUserMedia() will fail. If false, no video track is included. MediaTrackConstraints A constrain...
...tream; if it's true, a video track is included; if no video source is available or if permission is not given to use the video source, the call to getUserMedia() will fail. If false, no video track is included. MediaTrackConstraints A constraints dictionary detailing the preferable and/or required values or ranges of values for the track's constrainable properties. If you specify constraints, a video track meeting these constraints is required. Examples Using a Boolean value In this example, we provide a simple value of true for the video property. This tells getUserMedia() that we require a video track, but we don't care about any specifics beyond that. HTML content <p>Click the start button below to begin the demonstration.</p> <div id="startButton" class="button"> Start </div> <vi...
...eeting these constraints is required. Examples Using a Boolean value In this example, we provide a simple value of true for the video property. This tells getUserMedia() that we require a video track, but we don't care about any specifics beyond that. ...
...And 10 more matches
HTMLVideoElement.msZoom - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. ...
...his feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. msZoom is a read/write property which gets or sets whether the video frame is trimmed, on the top and bottom or left and right, to fit the video display. ...
...b: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. msZoom is a read/write property which gets or sets whether the video frame is trimmed, on the top and bottom or left and right, to fit the video display. This proprietary property is specific to Internet Explorer and Microsoft Edge. ...
...And 9 more matches
Live streaming web audio and video - Developer guides
nd if it looks like it's not keeping up, we drop down to a lower bandwidth (and consequently lower quality) stream. In order to have this capability, we need to use formats that facilitate this. Live streaming formats generally allow adaptive streaming by breaking streams into a series of small segments and making those segments available at different qualities and bit rates. ...
...ats that facilitate this. Live streaming formats generally allow adaptive streaming by breaking streams into a series of small segments and making those segments available at different qualities and bit rates. Streaming Audio and Video on Demand Streaming technology is not used exclusively for live streams. ...
... RTP with RTCP allows for adaptive streaming. This is not yet supported natively in most browsers, but be aware that Firefox OS 1.3 supports RTSP. Note: some vendors implement propriety transport protocols, such as RealNetworks and their Real Data Transport (RDT). RTSP 2.0 RTSP 2.0 is currently in development and is not backward compatible with RTSP 1.0. Important: Although the <audio> and <video> tags are protocol agnostic, no browser currently supports anything other than HTTP without requiring plugins, although this looks set to change. Protocols other than HTTP may also be subject to blocking from firewalls or proxy servers. Using streaming protocols The process of using the various protocols is reassuringly familiar if you are used to working with media over HTTP. For example: <...
...And 7 more matches
HTMLVideoElement.msHorizontalMirror - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. msHorizontalMirror is a read/write property which gets or sets whether a video element is flipped horizontally in the display. ...
...duction sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. msHorizontalMirror is a read/write property which gets or sets whether a video element is flipped horizontally in the display. This proprietary property is specific to Internet Explorer and Microsoft Edge. ...
...incompatibilities between implementations and the behavior may change in the future. msHorizontalMirror is a read/write property which gets or sets whether a video element is flipped horizontally in the display. This proprietary property is specific to Internet Explorer and Microsoft Edge. Syntax HTMLVideoElement.msHorizontalMirror: boolean; Value Boolean value set to true flips the video playback horizontally. Video perspective is flipped on a horizontal axis - this may be useful for playback of a webcam video, providing the user with better mirroring of their real behaviors (ie. ...
...And 6 more matches
VideoTrackList: change event - Web APIs
The change event is fired when a video track is made active or inactive, for example by changing the track's selected property. ...
... The change event is fired when a video track is made active or inactive, for example by changing the track's selected property. ...
... The change event is fired when a video track is made active or inactive, for example by changing the track's selected property. ...
...And 5 more matches
VideoTrackList - Web APIs
Retrieve an instance of this object with HTMLMediaElement.videoTracks. The individual tracks can be accessed using array syntax or functions such as forEach() for example. Properties This interface also inherits properties from its parent interface, EventTarget. length Read only The number of tracks in the list. selectedIndex Read only The index of the currently selected track, if any, or -1 otherwise. Event handlers onaddtrack An event handler to be called when the addtrack event is fired, indicating that a new video track has been added to the media element. ...
...ctions such as forEach() for example. Properties This interface also inherits properties from its parent interface, EventTarget. length Read only The number of tracks in the list. selectedIndex Read only The index of the currently selected track, if any, or -1 otherwise. Event handlers onaddtrack An event handler to be called when the addtrack event is fired, indicating that a new video track has been added to the media element. onchange An event handler to be called when the change event occurs -- that is, when the value of the selected property for a track has changed, due to the track being made active or inactive. onremovetrack An event handler to call when the removetrack event is sent, indicating that a video track has been removed from the media element. Methods Th...
... occurs -- that is, when the value of the selected property for a track has changed, due to the track being made active or inactive. onremovetrack An event handler to call when the removetrack event is sent, indicating that a video track has been removed from the media element. Methods This interface also inherits methods from its parent interface, EventTarget. getTrackById() Returns the VideoTrack found within the VideoTrackList whose id matches the specified string. If no match is found, null is returned. Events addtrack Fired when a new video track has been added to the media element. Also available via the onaddtrack property. change Fired when a video track has been made active or inactive. Also available via the onchange property. removetrack Fired when a new video tr...
...And 5 more matches
DisplayMediaStreamConstraints.video - Web APIs
The DisplayMediaStreamConstraints dictionary's video property is used to configure the video track in the stream returned by getDisplayMedia(). This value may simply be a Boolean, where true specifies that a default selection of input source be made (typically the entire display area of the device in use, spanning every screen in a multiple screen configuration). Since a video track must always be included, a value of false results in a TypeError exception being thrown. More precise control over the format of the returned video track may be exercised by instead providing a MediaTrackConstraints object, which is used to process the video data after obtaining it from the device but prior to adding it to the stream. ...
...). Since a video track must always be included, a value of false results in a TypeError exception being thrown. More precise control over the format of the returned video track may be exercised by instead providing a MediaTrackConstraints object, which is used to process the video data after obtaining it from the device but prior to adding it to the stream. Syntax displayMediaStreamConstraints.video = allowVideoFlag; displayMediaStreamConstraints.video = mediaTrackConstraints; displayMediaStreamConstraints = { video: allowVideoFlag | mediaTrackConstraints; } Value The value may be either a Boolean or a MediaTrackConstraints object. If a Boolean is specified, a value of true (the default) indicates that the stream returned by getDisplayMedia() should be in whatever format the user agen...
...ag | mediaTrackConstraints; } Value The value may be either a Boolean or a MediaTrackConstraints object. If a Boolean is specified, a value of true (the default) indicates that the stream returned by getDisplayMedia() should be in whatever format the user agent feels is best. A value of false is not permitted and will throw a TypeError. If a MediaTrackConstraints object is given instead, the video track will be processed to match the settings given in the constraints object. Constraints specific to screen sharing These constraints apply to MediaTrackConstraints objects specified as part of the DisplayMediaStreamConstraints object's video property when using getDisplayMedia() to obtain a stream for screen sharing. cursor A ConstrainDOMString which specifies whether or not to include...
...And 4 more matches
Web Video Text Tracks Format (WebVTT) - Web APIs
The primary purpose of WebVTT files is to add text overlays to a <video>. WebVTT is a text based format, which must be encoded using UTF-8. Where you can use spaces you can also use tabs. There is also a small API available to represent and manage these tracks and the data needed to perform the playback of the text at the correct times. WebVTT files The MIME type of WebVTT is text/vtt. A WebVTT file (.vtt) contains cues, which can be either a single line or multiple lines, as shown below: WEBVTT 00:01.000 --> 00:04.000 - Never drink liquid nitrogen. 00:05.000 --> 00:09.000 - It will perforate your stomach. - You could die. ...
...n watch it with their parents. 1 00:02:15.000 --> 00:02:20.000 - Ta en kopp varmt te. - Det ar inte varmt. 2 00:02:20.000 --> 00:02:25.000 - Har en kopp te. - Det smakar som te. NOTE This last line may not translate well. 3 00:02:25.000 --> 00:02:30.000 - Ta en kopp Styling WebVTT cues You can style WebVTT cues by looking for elements which match the ::cue pseudo-element. Within site CSS video::cue { background-image: linear-gradient(to bottom, dimgray, lightgray); color: papayawhip; } video::cue(b) { color: peachpuff; } Here, all video elements are styled to use a gray linear gradient as their backgrounds, with a foreground color of "papayawhip". In addition, text boldfaced using the <b> element are colored "peachpuff". The HTML snippet below actually handles displaying the ...
...ound-image: linear-gradient(to bottom, dimgray, lightgray); color: papayawhip; } video::cue(b) { color: peachpuff; } Here, all video elements are styled to use a gray linear gradient as their backgrounds, with a foreground color of "papayawhip". In addition, text boldfaced using the <b> element are colored "peachpuff". The HTML snippet below actually handles displaying the media itself. <video controls autoplay src="video.webm"> <track default src="track.vtt"> </video> Within the WebVTT file itself You can also define the style directly in the WebVTT file. In this case, you insert your CSS rules into the file with each rule preceded by the string "STYLE" all by itelf on a line of text, as shown below: WEBVTT STYLE ::cue { background-image: linear-gradient(to bottom, dimgray, li...
...And 4 more matches
Videotrack.language - Web APIs
For example, if the primary language used in the track is United States English, this value would be "en-US". For Brazilian Portuguese, the value would be "pt-BR". ...
... For example, if the primary language used in the track is United States English, this value would be "en-US". ...
... For example, if the primary language used in the track is United States English, this value would be "en-US". ...
...And 3 more matches
msSetVideoRectangle - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The HTMLVideoElement.msSetVideoRectangle() method sets the dimensions of a sub-rectangle within a video. This proprietary method is specific to Internet Explorer and Microsoft Edge. ...
...ck. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The HTMLVideoElement.msSetVideoRectangle() method sets the dimensions of a sub-rectangle within a video. This proprietary method is specific to Internet Explorer and Microsoft Edge. Syntax HTMLVideoElement.msSetVideoRectangle(); Parameters left A number representing left-side position. top A number representing top position. right A number representing right-side position. ...
... This proprietary method is specific to Internet Explorer and Microsoft Edge. Syntax HTMLVideoElement.msSetVideoRectangle(); Parameters left A number representing left-side position. top A number representing top position. right A number representing right-side position. bottom A number representing bottom position. Return value This method does not return a value. ...
...And 2 more matches
MediaRecorder.videoBitsPerSecond - Web APIs
Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
...And 2 more matches
VideoConfiguration - Web APIs
See our web video codec guide for types which may be supported. width: The width of the video. height: The height of the video. bitrate: The number of bits used to encode one second of the video file. framerate: The number of frames making up one second of video playback. ...
...See our web video codec guide for types which may be supported. width: The width of the video. height: The height of the video. bitrate: The number of bits used to encode one second of the video file. framerate: The number of frames making up one second of video playback. ...
...he VideoConfiguration dictionary of the Media Capabilities API is used to define the video file being tested when calling the MediaCapabilities methods encodingInfo() and decodingInfo() to determine whether or not the described video configuration is supported, and how smoothly and how smoooth and power-efficient it can be handled. Properties The VideoConfiguration dictionary is made up of five video properties, including: contentType: A valid video MIME type. See our web video codec guide for types which may be supported. width: The width of the video. height: The height of the video. bitrate: The number of bits used to encode one second of the video file. framerate: The number of frames making up one second of video playback. Examples // Create media configuration to be tested con...
...And 2 more matches
VideoPlaybackQuality.totalFrameDelay - Web APIs
Obsolete since Gecko 30 (Firefox 30 / Thunderbird 30 / SeaMonkey 2.27 / Firefox OS 1.4)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. The VideoPlaybackQuality.totalFrameDelay read-only property returns a double containing the sum of the frame delay since the creation of the associated HTMLVideoElement. ...
...me browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. ...
...e removed at any time. Try to avoid using it. ...
...And 2 more matches
VideoTrack - Web APIs
The VideoTrack interface represents a single video track from a <video> element. The most common use for accessing a VideoTrack object is to toggle its selected property in order to make it the active video track for its <video> element. Properties selected A Boolean value which controls whether or not the video track is active. Only a single video track can be active at any given time, so setting this property to true for one track while another track is active will make that other track inactive. id Read only A DOMString which uniquely identifies the track within the media. This ID can be used to locate a specific track within a video track list by calling VideoTrackList.getTrackById(). The ID can also be used as the fragment part of the URL if the media supports seeking by media fra...
...ifies the track within the media. This ID can be used to locate a specific track within a video track list by calling VideoTrackList.getTrackById(). The ID can also be used as the fragment part of the URL if the media supports seeking by media fragment per the Media Fragments URI specification. kind Read only A DOMString specifying the category into which the track falls. For example, the main video track would have a kind of "main". label Read only A DOMString providing a human-readable label for the track. For example, a track whose kind is "sign" might have a label of "A sign-language interpretation". This string is empty if no label is provided. language Read only A DOMString specifying the video track's primary language, or an empty string if unknown. The language is specified as ...
...imary language, or an empty string if unknown. The language is specified as a BCP 47 (RFC 5646) language code, such as "en-US" or "pt-BR". sourceBuffer Read only The SourceBuffer that created the track. Returns null if the track was not created by a SourceBuffer or the SourceBuffer has been removed from the MediaSource.sourceBuffers attribute of its parent media source. Usage notes To get a VideoTrack for a given media element, use the element's videoTracks property, which returns a VideoTrackList object from which you can get the individual tracks contained in the media: var el = document.querySelector("video"); var tracks = el.videoTracks; You can then access the media's individual tracks using either array syntax or functions such as forEach(). This first example gets the first vid...
...And 2 more matches
Media type and format guide: image, audio, and video content - Web media technologies
Web › Media › Formats
The modern web has powerful features to support the presentation and manipulation of media, with several media-related APIs supporting various types of content. ...
...upported by the major web browsers, along with browser support information and supported features. Web audio codec guide A guide to the audio codecs allowed for by the common media containers, as well as by the major browsers. Includes benefits, limitations, key specifications and capabilities, and use cases. It also covers each browser's support for using the codec in given containers. Web video codec guide This article provides basic information about the video codecs supported by the major browsers, as well as some that are not commonly supported but that you might still run into. It also covers codec capabilities, benefits, limitations, and browser support levels and restrictions. The "codecs" parameter in common media types When specifying the MIME type describing a media format, ...
...he MIME type describing a media format, you can provide details using the codecs parameter as part of the type string. This guide describes the format and possible values of the codecs parameter for the common media types. ...
...And 2 more matches
onMSVideoFormatChanged - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. onMSVideoFormatChanged is an event which occurs when the video format changes. This proprietary property is specific to Internet Explorer and Microsoft Edge. ...
... the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. onMSVideoFormatChanged is an event which occurs when the video format changes. This proprietary property is specific to Internet Explorer and Microsoft Edge. ...
...between implementations and the behavior may change in the future. onMSVideoFormatChanged is an event which occurs when the video format changes. This proprietary property is specific to Internet Explorer and Microsoft Edge. ...
...c to Internet Explorer and Microsoft Edge. ...
onMSVideoFrameStepCompleted - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. onMSVideoFrameStepCompleted is an event which occurs when the video frame has been stepped forward or backward one frame. This proprietary property is specific to Internet Explorer and Microsoft Edge. ...
...There may also be large incompatibilities between implementations and the behavior may change in the future. onMSVideoFrameStepCompleted is an event which occurs when the video frame has been stepped forward or backward one frame. This proprietary property is specific to Internet Explorer and Microsoft Edge. ...
...nge in the future. onMSVideoFrameStepCompleted is an event which occurs when the video frame has been stepped forward or backward one frame. This proprietary property is specific to Internet Explorer and Microsoft Edge. ...
...net Explorer and Microsoft Edge. ...
onMSVideoOptimalLayoutChanged - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. onMSVideoOptimalLayoutChanged is an event which occurs when the msIsLayoutOptimalForPlayback state changes. This proprietary property is specific to Internet Explorer and Microsoft Edge. ...
...r every user. There may also be large incompatibilities between implementations and the behavior may change in the future. onMSVideoOptimalLayoutChanged is an event which occurs when the msIsLayoutOptimalForPlayback state changes. This proprietary property is specific to Internet Explorer and Microsoft Edge. ...
...vior may change in the future. onMSVideoOptimalLayoutChanged is an event which occurs when the msIsLayoutOptimalForPlayback state changes. This proprietary property is specific to Internet Explorer and Microsoft Edge. ...
...ription Event Property object.onMSVideoOptimalLayoutChanged = handler; attachEvent Method object.attachEvent("onMSVideoOptimalLayoutChanged", handler) addEventListener Method object.addEventListener("", handler, useCapture) Synchronous No Bubbles No Cancelable No See also msIsLayoutOptimalForPlayback HTMLVideoElement Microsoft API extensions ...
VideoTrack.kind - Web APIs
Web › API › VideoTrack › kind
The kind property contains a string indicating the category of video contained in the VideoTrack. The kind can be used to determine the scenarios in which specific tracks should be enabled or disabled. See Video track kind strings for a list of the kinds available for video tracks. Syntax var trackKind = VideoTrack.kind; Value A DOMString specifying the type of content the media represents. The string is one of those found in Video track kind strings below. Video track kind strings The kinds available for video tracks are: "alternative" A potential alternative to the main track, such as a different video take or a version of the soundtrack with only the music and no dialogue. "captions" A version of the main video track with captions burnt in. "main" The primary video track. "si...
...This might be used to contain the director's commentary track on a movie, for example. "" (empty string) The track doesn't have an explicit kind, or the kind provided by the track's metadata isn't recognized by the user agent. ...
...This might be used to contain the director's commentary track on a movie, for example. "" (empty string) The track doesn't have an explicit kind, or the kind provided by the track's metadata isn't recognized by the user agent. ...
...n. "commentary" A video track containing a commentary. This might be used to contain the director's commentary track on a movie, for example. "" (empty string) The track doesn't have an explicit kind, or the kind provided by the track's metadata isn't recognized by the user agent. Specifications Specification Status Comment HTML Living StandardThe definition of 'VideoTrack: kind' in that specification. Living Standard ...
VideoTrack.label - Web APIs
Web › API › VideoTrack › label
Otherwise, an empty string ("") is returned. For example, a track whose kind is "sign" might have a label such as "A sign-language interpretation.". Example This example returns an array of track kinds and labels for potential use in a user interface to select video tracks for a specified media element. The list is filtered to only allow certain track kinds through. ...
...ckLabel = VideoTrack.label; Value A DOMString specifying the track's human-readable label, if one is available in the track metadata. Otherwise, an empty string ("") is returned. For example, a track whose kind is "sign" might have a label such as "A sign-language interpretation.". ...
... a label such as "A sign-language interpretation.". Example This example returns an array of track kinds and labels for potential use in a user interface to select video tracks for a specified media element. The list is filtered to only allow certain track kinds through. function getTrackList(el) { var trackList = []; const wantedKinds = [ "main", "alternative", "commentary" ]; el.videoTracks.forEach(function(track) { if (wantedKinds.includes(track.kind)) { trackList.push({ id: track.id, kind: track.kind, label: track.label }); } }); return trackList; } The resulting trackList contains an array of video tracks whose kind is one of those in the array wantedKinds, with each entry providing the track's id, kind, and label. Specifica...
... Living Standard ...
VideoTrackList.onchange - Web APIs
The VideoTrackList property onchange is an event handler which is called when the change event occurs, indicating that a VideoTrack in the VideoTrackList has been made active. The event is passed into the event handler in the form of an Event object; the event doesn't provide any additional information. To determine the new state of media's tracks, you'll have to look at their VideoTrack.selected flags. Note: You can also add a handler for the change event using addEventListener(). Syntax VideoTrackList.onchange = eventHandler; Value Set onchange to a function that should be called whenever a track is made active. Example This snippet establishes a handler for the change event that looks at each of the tracks in the list, calling a function to update the state of a user interface con...
...x VideoTrackList.onchange = eventHandler; Value Set onchange to a function that should be called whenever a track is made active. Example This snippet establishes a handler for the change event that looks at each of the tracks in the list, calling a function to update the state of a user interface control that indicates the current state of the track. ...
...TrackList.onchange = eventHandler; Value Set onchange to a function that should be called whenever a track is made active. Example This snippet establishes a handler for the change event that looks at each of the tracks in the list, calling a function to update the state of a user interface control that indicates the current state of the track. ...
... Living Standard ...
Digital video concepts - Web media technologies
In this article, we explore important concepts that are useful to understand in order to fully grasp how to work with video on the web. Encoding color Representing the colors in an image or video requires several values for each pixel. What those values are depends on how you "split up" the color when converting it to numeric form. There are several color models, and video codec makes use of one or more of these to represent their pixels during the encoding process as well as after decoding the video frames. RGB Most computer graphics models use the RGB color system, wherein some number of bits of data are used to represent each of the red, green, and blue components of the color of an individual pixel, and an image is comprised of a two-dimensional array of these pixels. There a...
... integer components and using floating-point components. When using integer components, RGB color uses 8 bits each of red, green, and blue, as well as potentially 8 bits of alpha (the amount of transparency). YUV Unlike RGB, the YUV (or Y'UV) color encoding system is based around how humans perceive a color image. Doing so allows color data to be represented using fewer total bits of space in a video stream. The name "YUV" is generally used today to describe this color system, even though the term was originally used specifically for analog coding of color, while YCbCr was used for digital color. However, today both terms are used for digital color. The prime symbol, ', indicates that gamma compression is being used. Contemplating human vision We're able to represent an image this way beca...
...nent of the chroma of the color sample. Computed by substracting luma from the gamma corrected red value: V = R' - Y'. Chroma subsampling Chroma subsampling is the process of converting the color pixels into a greyscale image and a matrix of U and V values indicating the colors to map to those pixels. Since the color data is being encoded at a lower resolution than the luma, when decoding the video to draw it to the screen each pixel's color is computed by calculating an appropriate color given the U and V values for the 4x2 block of 8 pixels in which the pixel resides. This decoding operation must mirror the method used during encoding, which is represented by three numbers separated by colons (":"). The first number specifies the number of luminance samples per row encoded from the 4x2...
...uma data, but that each row has 0 chroma samples applied to it. The resulting image, then, is comprised solely of the luminance data--a greyscale image. YUV data representation Because the image is represented using more detail in greyscale than in color, the values of Y', U, and V are not typically stored together, one sample per pixel, the way RGB images are stored in memory. Each frame of video is represented by a matrix of luma values, Y, with each pixel's color computed using the values in the U and V matrices. For example, in the AV1 codec, a record stores the encoded luma for a tile, and a second record contains the chroma data in the form of the U and V values. In broadcast television, the luma signal is the primary signal, while the chrominance data is sent on a subcarrier. The ...
Video presentations - Archive of obsolete content
This article is a jumping-off point to help you find those presentations. Architecture These presentations provide an architectural overview of the codebase. How pages are built using the DOM This presentation describes how documents are loaded and the DOM tree is constructed. (as QuickTime; 198 MB) Laying out and drawing documents (slides) This presentation describes how a document is laid out and painted to the display by the Gecko engine. ...
...art 2) Mike Connor describes how a bug goes from bug report to patch to implemented fix. ...
...g goes from bug report to patch to implemented fix. ...
HTMLMediaElement.videoTracks - Web APIs
The read-only videoTracks property on HTMLMediaElement objects returns a VideoTrackList object listing all of the VideoTrack objects representing the media element's video tracks. The returned list is live; that is, as tracks are added to and removed from the media element, the list's contents change dynamically. Once you have a reference to the list, you can monitor it for changes to detect when new video tracks are added or existing ones removed. See Event handlers in VideoTrackList to learn more about watching for changes to a media element's track list. Syntax var videoTracks = mediaElement.videoTracks; Value A VideoTrackList object representing the list of video tracks included in the media element. The list of tracks can be accessed using array notation, or using the objec...
... Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.videoTracks' in that specification. ...
...t object representing the list of video tracks included in the media element. The list of tracks can be accessed using array notation, or using the object's getTrackById() method. Each track is represented by a VideoTrack object which provides information about the track. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.videoTracks' in that specification. Living Standard No change from HTML5 ...
MediaStream.getVideoTracks() - Web APIs
The getVideoTracks() method of the MediaStream interface returns a sequence of MediaStreamTrack objects representing the video tracks in this stream. Syntax var mediaStreamTracks[] = mediaStream.getVideoTracks(); Parameters None. Return value An array of MediaStreamTrack objects, one for each video track contained in the media stream. Video tracks are those tracks whose kind property is video. The array is empty if the stream contains no video tracks. Note: The order of the tracks is not defined by the specification, and may not be the same from one call to getVideoTracks() to another. ...
...An array of MediaStreamTrack objects, one for each video track contained in the media stream. Video tracks are those tracks whose kind property is video. The array is empty if the stream contains no video tracks. Note: The order of the tracks is not defined by the specification, and may not be the same from one call to getVideoTracks() to another. Early versions of this API included a special VideoStreamTrack interface which was used as the type for each entry in the list of video streams; however, this has since been merged into the main MediaStreamTrack interface. Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses getVideoTracks() to retrieve a track for passing to the ImageCapture() constructor. var imageCapture; navigator.mediaDevic...
...face which was used as the type for each entry in the list of video streams; however, this has since been merged into the main MediaStreamTrack interface. Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses getVideoTracks() to retrieve a track for passing to the ImageCapture() constructor. var imageCapture; navigator.mediaDevices.getUserMedia({video: true}) .then(mediaStream => { document.querySelector('video').srcObject = mediaStream; const track = mediaStream.getVideoTracks()[0]; imageCapture = new ImageCapture(track); return imageCapture.getPhotoCapabilities(); }) Specifications Specification Status Comment Media Capture and StreamsThe definition of 'getVideoTracks()' in that specification. Candidate...
VideoPlaybackQuality.creationTime - Web APIs
The read-only creationTime property on the VideoPlaybackQuality interface reports the number of milliseconds since the browsing context was created this quality sample was recorded. Syntax value = videoPlaybackQuality.creationTime; Value A DOMHighResTimeStamp object which indicates the number of milliseconds that elapased between the time the browsing context was created and the time at which this sample of the video quality was obtained. For details on how the time is determined, see Performance.now(). Example This example calls getVideoPlaybackQuality() to obtain a VideoPlaybackQuality object, then determines what percentage of frames have been lost by either corruption or being dropped. If that exceeds 10% (0.1), a function called lostFramesThresholdExceeded() is called to, perhaps, ...
...time is determined, see Performance.now(). Example This example calls getVideoPlaybackQuality() to obtain a VideoPlaybackQuality object, then determines what percentage of frames have been lost by either corruption or being dropped. If that exceeds 10% (0.1), a function called lostFramesThresholdExceeded() is called to, perhaps, update a quality indicator to show an increase in frame loss. ...
...mple calls getVideoPlaybackQuality() to obtain a VideoPlaybackQuality object, then determines what percentage of frames have been lost by either corruption or being dropped. If that exceeds 10% (0.1), a function called lostFramesThresholdExceeded() is called to, perhaps, update a quality indicator to show an increase in frame loss. var videoElem = document.getElementById("my_vid"); var quality = videoElem.getVideoPlaybackQuality(); if ((quality.corruptedVideoFrames + quality.droppedVideoFrames)/quality.totalVideoFrames > 0.1) { lostFramesThresholdExceeded(); } Specifications Specification Status Comment Media Playback QualityThe definition of 'VideoPlaybackQuality.corruptedVideoFrames' in that specification. Editor's Draft Initial definition. ...
VideoPlaybackQuality - Web APIs
A VideoPlaybackQuality object is returned by the HTMLVideoElement.getVideoPlaybackQuality() method and contains metrics that can be used to determine the playback quality of a video. Properties The VideoPlaybackQuality interface doesn't inherit properties from any other interfaces. creationTime Read only A DOMHighResTimeStamp containing the time in miliseconds between the start of the navigation and the creation of the object. droppedVideoFrames Read only An unsigned long giving the number of video frames dropped since the creation of the associated HTMLVideoElement. totalVideoFrames Read only An unsigned long giving the number of video frames created and dropped since the creation of the associated HTMLVideoElement. ...
...een the start of the navigation and the creation of the object. droppedVideoFrames Read only An unsigned long giving the number of video frames dropped since the creation of the associated HTMLVideoElement. totalVideoFrames Read only An unsigned long giving the number of video frames created and dropped since the creation of the associated HTMLVideoElement. Obsolete properties corruptedVideoFrames Read only An unsigned long giving the number of video frames corrupted since the creation of the associated HTMLVideoElement. A corrupted frame may be created or dropped. totalFrameDelay Read only A double containing the sum of the frame delay since the creation of the associated HTMLVideoElement. The frame delay is the difference between a frame's theoretical presentation time and i...
... the number of video frames corrupted since the creation of the associated HTMLVideoElement. A corrupted frame may be created or dropped. totalFrameDelay Read only A double containing the sum of the frame delay since the creation of the associated HTMLVideoElement. The frame delay is the difference between a frame's theoretical presentation time and its effective display time. Methods The VideoPlaybackQuality interface has no methods, and does not inherit any. Specifications Specification Status Comment Media Playback QualityThe definition of 'VideoPlaybackQuality' in that specification. Editor's Draft Initial definition. ...
VideoTrackList.length - Web APIs
The read-only VideoTrackList property length returns the number of entries in the VideoTrackList, each of which is a VideoTrack representing one video track in the media element. A value of 0 indicates that there are no video tracks in the media. Syntax var trackCount = VideoTrackList.length; Value A number indicating how many video tracks are included in the VideoTrackList. Each track can be accessed by treating the VideoTrackList as an array of objects of type VideoTrack. Example This snippet gets the number of video tracks in the first <video> element found in the DOM by querySelector(). ...
...ere are no video tracks in the media. Syntax var trackCount = VideoTrackList.length; Value A number indicating how many video tracks are included in the VideoTrackList. Each track can be accessed by treating the VideoTrackList as an array of objects of type VideoTrack. Example This snippet gets the number of video tracks in the first <video> element found in the DOM by querySelector(). var videoElem = document.querySelector("video"); var numVideoTracks = 0; if (videoElem.videoTracks) { numVideoTracks = videoElem.videoTracks.length; } Note that this sample checks to be sure HTMLMediaElement.videoTracks is defined, to avoid failing on browsers without support for VideoTrack. Specifications Specification Status Comment HTML Living StandardThe definition of...
...em = document.querySelector("video"); var numVideoTracks = 0; if (videoElem.videoTracks) { numVideoTracks = videoElem.videoTracks.length; } Note that this sample checks to be sure HTMLMediaElement.videoTracks is defined, to avoid failing on browsers without support for VideoTrack. Specifications Specification Status Comment HTML Living StandardThe definition of 'VideoTrackList: length' in that specification. Living Standard ...
VideoTrackList.onaddtrack - Web APIs
The VideoTrackList property onaddtrack is an event handler which is called when the addtrack event occurs, indicating that a new video track has been added to the media element whose video tracks the VideoTrackList represents. The event is passed into the event handler in the form of a TrackEvent object, whose track property identifies the newly-added track. Note: You can also add a handler for the addtrack event using addEventListener(). Syntax VideoTrackList.onaddtrack = eventHandler; Value Set onaddtrack to a function that accepts as input a TrackEvent object which indicates in its track property which video track has been added to the media. ...
... Note: You can also add a handler for the addtrack event using addEventListener(). Syntax VideoTrackList.onaddtrack = eventHandler; Value Set onaddtrack to a function that accepts as input a TrackEvent object which indicates in its track property which video track has been added to the media. Usage notes The addtrack event is called whenever a new track is added to the media element whose video tracks are represented by the VideoTrackList object. This happens when tracks are added to the element when the media is first attached to the element; one addtrack event will occur for each video track in the media resource. Example This snippet establishes a handler for the addtrack event that calls a function, addToTrackList(), passing in the VideoTrack object representing the newly-added tr...
...e added to the element when the media is first attached to the element; one addtrack event will occur for each video track in the media resource. Example This snippet establishes a handler for the addtrack event that calls a function, addToTrackList(), passing in the VideoTrack object representing the newly-added track. In this scenario, that function's role is to add the new track to a list of video tracks available to choose from. document.querySelector("video").videoTracks.onaddtrack = function(event) { addToTrackList(event.track); }; Specifications Specification Status Comment HTML Living StandardThe definition of 'VideoTrackList: onaddtrack' in that specification. Living Standard ...
HTMLVideoElement.msIsLayoutOptimalForPlayback - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. msIsLayoutOptimalForPlayback is a read-only property which indicates whether the video can be rendered more efficiently. This proprietary property is specific to Internet Explorer and Microsoft Edge. Syntax HTMLVideoElement.msIsLayoutOptimalForPlayback: DOMString; Value Boolean value set to true indicates that video is being rendered optimally (better performance and using less battery power). If false, improvements can be made to optimize performance. For msIsLayoutOptimalForPlayback to be true...
...etary property is specific to Internet Explorer and Microsoft Edge. Syntax HTMLVideoElement.msIsLayoutOptimalForPlayback: DOMString; Value Boolean value set to true indicates that video is being rendered optimally (better performance and using less battery power). If false, improvements can be made to optimize performance. For msIsLayoutOptimalForPlayback to be true, avoid the following: Video elements with Cascading Style Sheets (CSS) outlines set. Rendering a video element through a canvas element. Embedding video elements in a Scalable Vector Graphics (SVG). You can listen to the onMSVideoOptimalLayoutChanged event to be notified when the msIsLayoutOptimalForPlayback property changes. *To enable Stereo 3D playback, msIsLayoutOptimalForPlayback must be true. See also HTMLVid...
VideoTrackList.onremovetrack - Web APIs
The VideoTrackList onremovetrack event handler is called when the removetrack event occurs, indicating that a video track has been removed from the media element, and therefore also from the VideoTrackList. The event is passed into the event handler in the form of a TrackEvent object, whose track property identifies the track that was removed from the media element's VideoTrackList. Note: You can also add a handler for the removetrack event using addEventListener(). Syntax VideoTrackList.onremovetrack = eventHandler; Value Set onremovetrack to a function that accepts as input a TrackEvent object which indicates in its track property which video track has been removed from the media element. Example This simple example just fetches the current number of video tracks in the media eleme...
...eoTrackList.onremovetrack = eventHandler; Value Set onremovetrack to a function that accepts as input a TrackEvent object which indicates in its track property which video track has been removed from the media element. Example This simple example just fetches the current number of video tracks in the media element whenever a track is removed from the media element. document.querySelector("my-video").videoTracks.onremovetrack = function(event) { myTrackCount = document.querySelector("my-video").videoTracks.length; }; The current number of video tracks remaining in the media element is obtained from VideoTrackList property length. Specifications Specification Status Comment HTML Living StandardThe definition of 'VideoTrackList: onremovetrack' in that specifi...
Video textures - Web APIs
<< Previous This example demonstrates how to use video files as textures for WebGL surfaces. ...
... << Previous This example demonstrates how to use video files as textures for WebGL surfaces. ...
Guide to streaming audio and video - Web media technologies
<<<...XXXXXX...>>> Protocols In addition to the configuration of the server and the streaming code, there are sometimes special protocols which can be used to optimize performance. HTTPS Live Streaming HTTPS Live Streaming (HLS) is a protocol developed by Apple and supported by Safari on all of their platforms. HLS may also be supported in other environments, although in some cases this support is conditional. ...
...wsers support HLS, Firefox for Android does as well, in order to avoid strange compatibility errors from occurring due to this assumption being incorrect. The desktop version of Android, however, does not support HLS. HLS uses playlists to allow the user to not only select the media to stream, but also to choose among versions or forms of the same media. For example, HLS lets the server stream a video with multiple audio streams which the user can choose from, in order to hear their own language. Additionally, forms of the stream can be provided which are optimized for different network conditions. In this way, live streams can be made flexible and highly performant. As of mid-2017, HLS has been standardized as RFC 8217. ...
Anatomy of a video game - Game development
This article looks at the anatomy and workflow of the average video game from a technical point of view, in terms of how the main loop should run. It helps beginners to the modern game development arena understand what is required when building a game and how web standards like JavaScript lend themselves as tools. Experienced game programmers who are new to web development could also benefit, too. Present, accept, interpret, calculate, repeat The goal of every video game is to present the user(s) with a situation, accept their input, interpret those signals into actions, and calculate a new situation resulting from those acts. Games are constantly looping through these stages, over and over, until some end condition occurs (such as winning, losing, or exiting to go to bed). Not surprisingl...
HTMLVideoElement.msFrameStep() - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The HTMLVideoElement.msFrameStep() method steps the video by one frame forward or one frame backward. This proprietary method is specific to Internet Explorer and Microsoft Edge. Syntax HTMLVideoElement.msFrameStep(forward); Parameters forward A Boolean which if set to true steps the video forward by one frame, if false steps the video backwards by one frame. Return value This method does not return a value. See also HTMLMediaElement Microsoft API extensions ...
HTMLVideoElement.msIsStereo3D - Web APIs
msIsStereo3D is a read-only property which determines whether the system considers the loaded video source to be stereo 3-D or not. This proprietary property is specific to Internet Explorer and Microsoft Edge. Syntax HTMLVideoElement.msIsStereo3D: boolean; Value Boolean value set to true indicates that the video source is stereo 3D. This uses metadata set in MP4 or MPEG-2 file containers and H.264 Supplemental enhancement information (SEI) messages to determine the stereo capability of the source. ...
videoCapabilities - Web APIs
The MediaKeySystemConfiguration.videoCapabilities read-only property returns an array of supported video type and capability pairs. Syntax var videoCapabilities[{contentType: 'contentType', robustness:'robustness'}] = mediaSystemConfiguration.videoCapabilities; Specifications Specification Status Comment Encrypted Media ExtensionsThe definition of 'videoCapabilities' in that specification. Recommendation Initial definition ...
SourceBuffer.videoTracks - Web APIs
The videoTracks read-only property of the SourceBuffer interface returns a list of the video tracks currently contained inside the SourceBuffer. Syntax var myVideoTracks = sourceBuffer.videoTracks; Value An VideoTrackList object. Example TBD Specifications Specification Status Comment Media Source ExtensionsThe definition of 'videoTracks' in that specification. Recommendation Initial definition. ...
VideoTrack.id - Web APIs
Web › API › VideoTrack › id
The id property contains a string which uniquely identifies the track represented by the VideoTrack. This ID can be used with the VideoTrackList.getTrackById() method to locate a specific track within the media associated with a media element. The track ID can also be used as the fragment of a URL that loads the specific track (if the media supports media fragments). Syntax var trackID = VideoTrack.id; Value A DOMString which identifies the track, suitable for use when calling getTrackById() on an VideoTrackList such as the one specified by a media element's videoTracks property. Specifications Specification Status Comment HTML Living StandardThe definition of 'VideoTrack: id' in that specification. Living Standard ...
VideoTrack.selected - Web APIs
The VideoTrack property selected controls whether or not a particular video track is active. Syntax isVideoSelected = VideoTrack.selected; VideoTrack.selected = true | false; Value The selected property is a Boolean whose value is true if the track is active. Only a single video track can be active at any given time, so setting this property to true for one track while another track is active will make that other track inactive. Specifications Specification Status Comment HTML Living StandardThe definition of 'VideoTrack: selected' in that specification. Living Standard ...
VideoTrack.sourceBuffer - Web APIs
The read-only VideoTrack property sourceBuffer returns the SourceBuffer that created the track, or null if the track was not created by a SourceBuffer or the SourceBuffer has been removed from the MediaSource.sourceBuffers attribute of its parent media source. Syntax var sourceBuffer = VideoTrack.sourceBuffer; Value A SourceBuffer or null. Specifications Specification Status Comment Media Source ExtensionsThe definition of 'VideoTrack: sourceBuffer' in that specification. Recommendation ...
VideoTrackList: addtrack event - Web APIs
The addtrack event is fired when a track is added to a VideoTrackList. Bubbles No Cancelable No Interface TrackEvent Event handler property onaddtrack Examples Using addEventListener(): const videoElement = document.querySelector('video'); videoElement.videoTracks.addEventListener('addtrack', (event) => { console.log(`Video track: ${event.track.label} added`); }); Using the onaddtrack event handler property: const videoElement = document.querySelector('video'); videoElement.videoTracks.onaddtrack = (event) => { console.log(`Video track: ${event.track.label} added`); }; Specifications Specification Status HTML Living StandardThe definition of 'addtrack' in that specification. Living Standard ...
VideoTrackList: removetrack event - Web APIs
The removetrack event is fired when a track is removed from a VideoTrackList. Bubbles No Cancelable No Interface TrackEvent Event handler property onremovetrack Examples Using addEventListener(): const videoElement = document.querySelector('video'); videoElement.videoTracks.addEventListener('removetrack', (event) => { console.log(`Video track: ${event.track.label} removed`); }); Using the onremovetrack event handler property: const videoElement = document.querySelector('video'); videoElement.videoTracks.onremovetrack = (event) => { console.log(`Video track: ${event.track.label} removed`); }; Specifications Specification Status HTML Living StandardThe definition of 'removetrack' in that specification. Li...
VideoTrackList.selectedIndex - Web APIs
The read-only VideoTrackList property selectedIndex returns the index of the currently selected track, if any, or -1 otherwise. Syntax var index = VideoTrackList.selectedIndex; Value A number indicating the index of the currently selected track, if any, or -1 otherwise. Specifications Specification Status Comment HTML Living StandardThe definition of 'VideoTrackList: selectedIndex' in that specification. Living Standard ...
Using audio and video in HTML - Web media technologies
The HTML <audio> and <video> elements let you embed audio and video content into a web page. More than that, their underlying interfaces are the key to manipulating and playing back media in general, even offscreen. In this guide, we'll review the media elements and how to use them in HTML content. Note: This guide is a planned update to integrate content from various scattered places on MDN into one cohesive document or document set. The work is not yet scheduled but hopefully will come soon. For now, some of the key information you may be looking for can be found in our Learning Area article on the topic. We don't have a particularly good guide to using these objects offscreen at this time, although Audio and video manipulation may be a good start. ...
Index - Web APIs
Web › API › Index
oBufferSourceNode interface Is a k-rate AudioParam that defines the speed at which the audio asset will be played. 120 AudioBufferSourceNode.start() API, Audio, AudioBufferSourceNode, Media, Method, Reference, Web Audio API, sound, start undefined. 121 AudioConfiguration API, Audio, AudioConfiguration, Experimental, Interface, Media Capabilities API, Reference, Video The AudioConfiguration dictionary of the Media Capabilities API defines the audio file being tested when calling MediaCapabilities.encodingInfo() or MediaCapabilities.decodingInfo() to query whether a specific audio configuration is supported, smooth, and/or power efficient. 122 AudioContext API, Audio, AudioContext, Interface, Reference, Web Audio API, sound The AudioC...
... API, Audio, AudioScheduledSourceNode, Media, Method, Reference, Web Audio API, sound, stop The stop() method on AudioScheduledSourceNode schedules a sound to cease playback at the specified time. If no time is specified, then the sound stops playing immediately. 185 AudioScheduledSourceNode: ended event Audio, HTML DOM, HTMLMediaElement, Media, Media Streams API, Reference, Video, Web Audio API, ended, events The ended event of the AudioScheduledSourceNode interface is fired when the source node has stopped playing. 186 AudioTrack Audio, AudioTrack, HTML, HTML DOM, Interface, Media, Reference, track The AudioTrack interface represents a single audio track from one of the HTML media elements, <audio> or <video>. 187 AudioTrack.enabled...
...ace is fired when the source node has stopped playing. 186 AudioTrack Audio, AudioTrack, HTML, HTML DOM, Interface, Media, Reference, track The AudioTrack interface represents a single audio track from one of the HTML media elements, <audio> or <video>. 187 AudioTrack.enabled Audio, AudioTrack, HTML DOM, Media, Media Controls, Media Track, Property, Reference, Video, enabled, mute, track The AudioTrack property enabled specifies whether or not the described audio track is currently enabled for use. If the track is disabled by setting enabled to false, the track is muted and does not produce audio. 188 AudioTrack.id API, Audio, Audio Track, AudioTrack, HTML DOM, Interface, Media, Property, Read-only, Reference, id, track The id prop...
...And 298 more matches
Capabilities, constraints, and settings - Web APIs
pp exchange information about what constrainable properties the browser's implementation supports and what values it supports for each one. This article discusses capabilities and constraints, as well as media settings, and includes an example we call the Constraint Exerciser. The Constraint Exerciser lets you experiment with the results of different constraint sets being applied to the audio and video tracks coming from the computer's A/V input devices (such as its webcam and microphone). Overview The process works like this (using MediaStreamTrack as an example): If needed, call MediaDevices.getSupportedConstraints() to get the list of supported constraints, which tells you what constrainable properties the browser knows about. This isn't always necessary, since any that aren't known wil...
...ng a specific value for a setting Most simply, each constraint may be a specific value indicating a desired value for the setting. For example: let constraints = { width: 1920, height: 1080, aspectRatio: 1.777777778 }; myTrack.applyConstraints(constraints); In this case, the constraints indicate that any values are fine for nearly all properties, but that a standard high definition (HD) video size is desired, with the standard 16:9 aspect ratio. There's no guarantee that the resulting track will match any of these, but the user agent should do its best to match as many as possible. The prioritization of the properties is simple: if two properties' requested values are mutually exclusive, then the one listed first in the constraint set will be used. As an example, if the browser runni...
...operties. Note: getCapabilities() hasn't been implemented yet by all major browsers. For the time being, you'll have to try to get what you need, and if you can't, decide what to do at that point. See Firefox bug 1179084, for example. Applying constraints The first and most common way to use constraints is to specify them when you call getUserMedia(): navigator.mediaDevices.getUserMedia({ video: { width: { min: 640, ideal: 1920 }, height: { min: 400, ideal: 1080 }, aspectRatio: { ideal: 1.7777777778 } }, audio: { sampleSize: 16, channelCount: 2 } }).then(stream => { videoElement.srcObject = stream; }).catch(handleError); In this example, constraints are applied at getUserMedia() time, asking for an ideal set of options with fallbacks for the video. You ca...
...And 47 more matches
Media container formats (file types) - Web media technologies
See Codecs used by WebRTC for information about codecs commonly used for making WebRTC calls, as well as browser compatibility information around codec support in WebRTC. ...
...See Codecs used by WebRTC for information about codecs commonly used for making WebRTC calls, as well as browser compatibility information around codec support in WebRTC. ...
...nt each track. See Codecs used by WebRTC for information about codecs commonly used for making WebRTC calls, as well as browser compatibility information around codec support in WebRTC. Common container formats While there are a vast number of media container formats, the ones listed below are the ones you are most likely to encounter. Some support only audio while others support both audio and video. The MIME types and extensions for each are listed.The most commonly used containers for media on the web are probably MPEG-4 (MP4), QuickTime Movie (MOV), and the Wavefile Audio File Format (WAV). However, you may also encounter MP3, Ogg, WebM, AVI, and other formats. Not all of these are broadly supported by browsers, however; some combinations of container and codec are sometimes given their o...
...And 31 more matches
Client-side storage - Learn web development
nd a corresponding value. This is useful when you just need to store some simple data, like the user's name, whether they are logged in, what color to use for the background of the screen, etc. The IndexedDB API provides the browser with a complete database system for storing complex data. This can be used for things from complete sets of customer records to even complex data types like audio or video files. You'll learn more about these APIs below. The future: Cache API Some modern browsers support the new Cache API. This API is designed for storing HTTP responses to specific requests, and is very useful for doing things like storing website assets offline so the site can subsequently be used without a network connection. Cache is usually used in combination with the Service Worker API, a...
... the defer attribute specifies that the contents of the <script> element will not execute until the page has finished loading. Storing complex data -- IndexedDB The IndexedDB API (sometimes abbreviated IDB) is a complete database system available in the browser in which you can store complex related data, the types of which aren't limited to simple values like strings or numbers. You can store videos, images, and pretty much anything else in an IndexedDB instance. However, this does come at a cost: IndexedDB is much more complex to use than the Web Storage API. In this section, we'll really only scratch the surface of what it is capable of, but we will give you enough to get started. Working through a note storage example Here we'll run you through an example that allows you to store note...
...pty, inserting a note as appropriate. So that's it! Your example should now work. If you are having trouble with it, feel free to check it against our live example (see the source code also). Storing complex data via IndexedDB As we mentioned above, IndexedDB can be used to store more than just simple text strings. You can store just about anything you want, including complex objects such as video or image blobs. And it isn't much more difficult to achieve than any other type of data. To demonstrate how to do it, we've written another example called IndexedDB video store (see it running live here also). When you first run the example, it downloads all the videos from the network, stores them in an IndexedDB database, and then displays the videos in the UI inside <video> elements. The seco...
...And 29 more matches
Codecs used by WebRTC - Web media technologies
To communicate, the two devices need to be able to agree upon a mutually-understood codec for each track so they can successfully communicate and present the shared media. This guide reviews the codecs that browsers are required to implement as well as other codecs that some or all browsers support for WebRTC. Containerless media WebRTC uses bare MediaStreamTrack objects for each track being shared from one peer to another, without a container or even a MediaStream associated with the tracks. ...
... Containerless media WebRTC uses bare MediaStreamTrack objects for each track being shared from one peer to another, without a container or even a MediaStream associated with the tracks. Which codecs can be within those tracks is not mandated by the WebRTC specification. However, RFC 7742 specifies that all WebRTC-compatible browsers must support VP8 and H.264's Constrained Baseline profile for video, and RFC 7874 specifies that browsers must support at least the Opus codec as well as G.711's PCMA and PCMU formats. These two RFCs also lay out options that must be supported for each codec, as well as specific user comfort features such as echo cancelation. This guide reviews the codecs that browsers are required to implement as well as other codecs that some or all browsers support for WebRTC...
...ts. These two RFCs also lay out options that must be supported for each codec, as well as specific user comfort features such as echo cancelation. This guide reviews the codecs that browsers are required to implement as well as other codecs that some or all browsers support for WebRTC. While compression is always a necessity when dealing with media on the web, it's of additional importance when videoconferencing in order to ensure that the participants are able to communicate without lag or interruptions. Of secondary importance is the need to keep the video and audio synchronized, so that the movements and any ancillary information (such as slides or a projection) are presented at the same time as the audio that corresponds. General codec requirements Before looking at codec-specific capab...
...And 28 more matches
Animating textures in WebGL - Web APIs
<< Previous In this demonstration, we build upon the previous example by replacing our static textures with the frames of an mp4 video file that's playing. This is actually pretty easy to do and fun to watch, so let's get started. You can use similar code to use any sort of data (such as a <canvas>) as the source for your textures. This example uses the glMatrix library to perform its matrix and vertex math. You'll need to include it if you create your own project based on this code. Our sample loads a copy from a CDN in our HTML's <head>. ...
... pretty easy to do and fun to watch, so let's get started. You can use similar code to use any sort of data (such as a <canvas>) as the source for your textures. This example uses the glMatrix library to perform its matrix and vertex math. You'll need to include it if you create your own project based on this code. Our sample loads a copy from a CDN in our HTML's <head>. ...
...let's get started. You can use similar code to use any sort of data (such as a <canvas>) as the source for your textures. This example uses the glMatrix library to perform its matrix and vertex math. You'll need to include it if you create your own project based on this code. Our sample loads a copy from a CDN in our HTML's <head>. ...
...And 25 more matches
The "codecs" parameter in common media types - Web media technologies
At a fundamental level, you can specify the type of a media file using a simple MIME type, such as video/mp4 or audio/mpeg. However, many media types--especially those that support video tracks--can benefit from the ability to more precisely describe the format of the data within them. For instance, just describing a video in an MPEG-4 file with the MIME type video/mp4 doesn't say anything about what format the actual media within takes. For that reason, the codecs parameter can be added to the MIME type describing media content. With it, container-specific information can be provided. This information may include things like the profile of the video codec, the type used for the audio tracks, and so forth. This guide briefly examines the syntax of the media type codecs parameter and how it's...
...e added to the MIME type describing media content. With it, container-specific information can be provided. This information may include things like the profile of the video codec, the type used for the audio tracks, and so forth. This guide briefly examines the syntax of the media type codecs parameter and how it's used with the MIME type string to provide details about the contents of audio or video media beyond simply indicating the container type. ...
... the profile of the video codec, the type used for the audio tracks, and so forth. This guide briefly examines the syntax of the media type codecs parameter and how it's used with the MIME type string to provide details about the contents of audio or video media beyond simply indicating the container type. General syntax A basic MIME media type is expressed by stating the type of media (audio, video, etc), then a slash character (/), then the container format used to contain the media: audio/mpeg An audio file using the MPEG file type, such as an MP3. video/ogg A video file using the Ogg file type. video/mp4 A video file using the MPEG-4 file type. video/quicktime A video file in Apple's QuickTime format. As noted elsewhere, this format was once commonly used on the web but no long...
...And 25 more matches
Accessible multimedia - Learn web development
This article shows how. Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript, an understanding of what accessibility is. Objective: To understand the accessibility issues behind multimedia, and how to overcome them. ...
...iety of content and what needs to be done to ensure its accessibility, ranging from simple text content to data tables, images, native controls such as form elements and buttons, and even more complex markup structures (with WAI-ARIA attributes). This article on the other hand looks at another general class of content that arguably isn't as easy to ensure accessibility for -- multimedia. Images, videos, <canvas> elements, Flash movies, etc., aren't as easily understood by screenreaders or navigated by the keyboard, and we need to give them a helping hand. But don't despair -- here we will help you navigate through the techniques available for making multimedia more accessible. Simple images We already covered simple text alternatives for HTML images in our HTML: A good basis for accessibili...
... back to there for the full details. In short, you should ensure that where possible visual content has an alternative text available for screenreaders to pick up and read to their users. For example: <img src="dinosaur.png" alt="A red Tyrannosaurus Rex: A two legged dinosaur standing upright like a human, with small arms, and a large head with lots of sharp teeth."> Accessible audio and video controls Implementing controls for web-based audio/video shouldn't be a problem, right? Let's investigate. The problem with native HTML5 controls HTML5 video and audio instances even come with a set of inbuilt controls that allow you to control the media straight out of the box. For example (see native-controls.html source code and live): <audio controls> <source src="viper.mp3" type="audio...
...And 21 more matches
Taking still photos with WebRTC - Web APIs
it. Try this sample then read on to learn how it works. You can also jump straight to the code on Github if you like. The HTML markup Our HTML interface has two main operational sections: the stream and capture panel and the presentation panel. Each of these is presented side-by-side in its own <div> to facilitate styling and control. The first panel on the left contains two components: a <video> element, which will receive the stream from WebRTC, and a <button> the user clicks to capture a video frame. <div class="camera"> <video id="video">Video stream not available.</video> <button id="startbutton">Take photo</button> </div> This is straightforward, and we'll see how it ties together when we get into the JavaScript code. Next, we have a <canvas> element into which the c...
...into a few bite-sized pieces to make it easier to explain. Initialization We start by wrapping the whole script in an anonymous function to avoid global variables, then setting up various variables we'll be using. ...
...o avoid global variables, then setting up various variables we'll be using. (function() { var width = 320; // We will scale the photo width to this var height = 0; // This will be computed based on the input stream var streaming = false; var video = null; var canvas = null; var photo = null; var startbutton = null; Those variables are: width Whatever size the incoming video is, we're going to scale the resulting image to be 320 pixels wide. height The output height of the image will be computed given the width and the aspect ratio of the stream. streaming Indicates whether or not there is currently an active stream of video running. video This will be a reference to the <video> element after the page is done loading. canvas This will be a reference to the <c...
...And 20 more matches
Using the Screen Capture API - Web APIs
uld never be visible in the generated stream. logicalSurface A Boolean which if true indicates that the capture should include offscreen areas of the source, if there are any. None of the constraints are applied in any way until after the content to capture has been selected. The contraints alter what you see in the resulting stream. For example, if you specify a width constraint for the video, it's applied by scaling the video after the user selects the area to share. It doesn't establish a restriction on the size of the source itself. Note: Constraints never cause changes to the list of sources available for capture by the Screen Sharing API. This ensures that web applications can't force the user to share specific content by restricting the source list until only one item is left.
... will display some form of indicator so the user is aware that sharing is taking place. Note: For privacy and security reasons, screen sharing sources are not enumerable using enumerateDevices(). Related to this, the devicechange event is never sent when there are changes to the sources available for getDisplayMedia(). Capturing shared audio getDisplayMedia() is most commonly used to capture video of a user's screen (or parts thereof). However, user agents may allow the capture of audio along with the video content. The source of this audio might be the selected window, the entire computer's audio system, or the user's microphone (or a combination of all of the above). Before starting a project that will require sharing of audio, be sure to check the Browser compatibility in MediaDevices.
...the above). Before starting a project that will require sharing of audio, be sure to check the Browser compatibility in MediaDevices.getDisplayMedia() to see if the browsers you wish compaibility with have support for audio in captured screen streams. ...
...And 18 more matches
MediaDevices.getUserMedia() - Web APIs
It returns a Promise that resolves to a MediaStream object. ...
... It returns a Promise that resolves to a MediaStream object. ...
... It returns a Promise that resolves to a MediaStream object. ...
...And 16 more matches
Using the Media Capabilities API - Web APIs
or object and the WorkerNavigator object; in other words, the Media Capabilities API is available both on the main thread and from workers. If the object exists, Media Capabilities API is available. You can, therefore, test for the presence of the API like so: if ("mediaCapabilities" in navigator) { // mediaCapabilities is available } else { // mediaCapabilities IS NOT available } Taking video as an example, to obtain information about video decoding abilities, you create a video decoding configuration which you pass as a parameter to MediaCapabilities.decodingInfo() method. This returns a promise that fulfills with information about the media capabilities as to whether the video can be decoded, and whether decoding will be smooth and power efficient. You can also test audio decoding ...
...ple, to obtain information about video decoding abilities, you create a video decoding configuration which you pass as a parameter to MediaCapabilities.decodingInfo() method. This returns a promise that fulfills with information about the media capabilities as to whether the video can be decoded, and whether decoding will be smooth and power efficient. You can also test audio decoding as well as video and audio encoding. Creating a video decoding configuration The MediaCapabilities.decodingInfo() method takes as a parameter a media decoding configuration. There are very specific ways to go about creating the configuration defined by the MediaDecodingConfiguration dictionary. In our example, we are testing the decoding capabilities of a video configuration. The configuration requires the typ...
...diaCapabilities.decodingInfo() method takes as a parameter a media decoding configuration. There are very specific ways to go about creating the configuration defined by the MediaDecodingConfiguration dictionary. In our example, we are testing the decoding capabilities of a video configuration. The configuration requires the type of media being tested -- e.g. a plain file or MediaSource -- and a VideoConfiguration including values for the contentType, width, height, bitrate, and framerate: The contentType must be a string specifying a valid video MIME type. The width and height are the horizontal and vertical dimensions of the video; these are also used to determine the aspect ratio. The bitrate is the number of bits used to encode one second of video. The framerate is the number of fram...
...And 15 more matches
Perceivable - Accessibility
must be presentable to users in ways they can perceive. Guideline 1.1 -- Providing text alternatives for non-text content The key here is that text can be converted to other forms that people with disabilities can use. For example, it can be spoken by a screenreader, converted to large print, or represented on a braille display. Non-text content refers to multimedia such as images, audio, and video. Success criteria How to conform to the criteria Practical resource 1.1.1 Provide text equivalents (A) All images that convey meaningful content should be given suitable alternative text. Text alternatives. Complex images or charts should have an accessible alternative provided, either on the same page or via a link. Use a regular link instead of a lon...
...lex images or charts should have an accessible alternative provided, either on the same page or via a link. Use a regular link instead of a longdesc attribute. A text description may work, or an accessible data table (see HTML table advanced features and accessibility). See Other text alternative mechanisms for the argument against longdesc. Multimedia content (i.e., audio or video) should at least have a descriptive identification available, such as a caption or similar. See Text alternatives for static caption options, and Audio transcripts, Video text tracks, and Other multimedia content for other alternatives. UI controls such as form elements and buttons should have text labels that describe their purpose. Buttons are simple--you should make sur...
...timedia content for other alternatives. UI controls such as form elements and buttons should have text labels that describe their purpose. Buttons are simple--you should make sure the button text describes the function of the button (e.g., <button>Upload image</button>). For more information on other UI controls, see UI controls. ...
...And 14 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
fluid measurements for our application layout -- essentially, this means using a combination of percentages and ems/rems to size your containers and text, not fixed widths such as pixels. This has a lot of advantages in that the layout will adapt to different viewport dimensions. Let's look at an example. We've written a simple-but-fun prototype for an application called Snapshot, which takes a video stream from your webcam (using getUserMedia()) then allows you to capture stills from that video stream (using HTML5 <canvas>), and save them to a gallery. You can then view previously-captured images and delete them. Other articles will discuss the functionality in more detail, but here we're interested in the layout. Note: You can find the Snapshot app on Github; check out the code and help i...
...nt, and any padding and border widths set on the box will be subtracted from the content width, not added to it. Very useful! Read more about this at * { Box-sizing: Border-box } FTW, by Paul Irish. Flexible replaced elements Things are working fairly well now, but there are still some issues just waiting to present themselves. ...
... include the <video> and <img> elements inside our first two columns, naked and unstyled. Because the size of replaced elements is dictated by the size of the media inserted into them, and the media is a fixed size, they explode out of their containing elements and make a mess of the layout. This is pretty horrible, but generally this kind of problem is easily fixed with some simple CSS: img, video { max-width: 100%; } This tells the replaced elements to remain constrained inside their container's widths, no matter what. However, if they aren't as wide as their containers, they will not stretch to fill them. In the snapshot example, we ended up with slightly different code: x-card:nth-child(1) video, x-card:nth-child(2) img { width: 100%; ... } This is because in our case, we do ...
...And 14 more matches
MediaDevices.ondevicechange - Web APIs
ange included in the event object; to get the updated list of devices, you'll have to use enumerateDevices(). Example In this example, we create a function called updateDeviceList(), which is called once when MediaDevices.getUserMedia() successfully obtains a stream, and then is called any time the device list changes. It displays in the browser window two lists: one of audio devices and one of video devices, with both the device's label (name) and whether it's an input or an output device. Because the example provides a handler for the devicechange event, the list is refreshed any time a media device is attached to or removed from the device running the sample. HTML content <p>Click the start button below to begin the demonstration.</p> <div id="startButton" class="button"> Start </div>...
...evices, with both the device's label (name) and whether it's an input or an output device. Because the example provides a handler for the devicechange event, the list is refreshed any time a media device is attached to or removed from the device running the sample. ...
...th both the device's label (name) and whether it's an input or an output device. Because the example provides a handler for the devicechange event, the list is refreshed any time a media device is attached to or removed from the device running the sample. ...
...And 13 more matches
Setting up adaptive streaming media sources - Developer guides
playlists specifying the name and location of these stream folders. MPEG-DASH Encoding MPEG-DASH is an adaptive bitrate streaming technique that enables streaming of media content over the Internet delivered from conventional HTTP web servers. A media presentation description (MPD) file is used to hold the information on the various streams and the bandwidths they are associated with. In your video source (src) attribute you point to the MPD instead of to the media file as you would with non-adaptive media. The MPD file tells the browser where the various pieces of media are located, it also includes meta data such as mimeType and codecs and there are other details such as byte-ranges in there too - it is an XML document and in many cases will be generated for you. There are a few profile...
...dia file as you would with non-adaptive media. The MPD file tells the browser where the various pieces of media are located, it also includes meta data such as mimeType and codecs and there are other details such as byte-ranges in there too - it is an XML document and in many cases will be generated for you. There are a few profiles we can use. We're going to take a look at Ondemand profile for Video On Demand (VOD) and the LIVE profile. For live services streaming, the LIVE profile is a requirement. The stream switching capabilities are identical between the profiles. Other reasons to use LIVE profile over Ondemand for VOD content may be: Your client or server does not support range requests Your server cannot cache range requests efficiently Your server cannot prefetch range requests...
...er meta-data and can often make up a large portion of the MPD file. Ondemand Profile This profile will allow switching between streams 'on demand' - that is to say that you only need provide a set of contiguous files and specify the bandwidth for each one and the appropriate file will be chosen automatically. Here's a simple example that provides an audio track representation and four separate video representations. <?xml version="1.0" encoding="UTF-8"?> <MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" type="static" mediaPresentationDuration="PT654S" minBufferTime="PT2S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011"> <BaseURL>http://example.com/ondemand/</Ba...
...And 12 more matches
Index - Developer guides
Web › Guide › Index
Started AJAX, API, Advanced, JavaScript, WebMechanics, XMLHttpRequest This article guides you through the AJAX basics and gives you some simple hands-on examples to get you started. 5 WAI ARIA Live Regions/API Support AJAX, Accessibility Firefox 3 contains important improvements to the way the Mozilla engine exposes live changes in a document. 6 Audio and Video Delivery Audio, Guide, HTML, HTML5, Media, Video Whether we are dealing with pre-recorded audio files or live streams, the mechanism for making them available through the browser's <audio> and <video> elements remains pretty much the same. Currently, to support all browsers we need to specify two formats, although with the adoption of MP3 and MP4 formats in Firefox and Opera, this is ch...
...hem available through the browser's <audio> and <video> elements remains pretty much the same. Currently, to support all browsers we need to specify two formats, although with the adoption of MP3 and MP4 formats in Firefox and Opera, this is changing fast. You can find compatibility information in the Guide to media types and formats on the web. 7 Adding captions and subtitles to HTML5 video HTML5, Media, WebVTT, captions, subtitles, track In other articles we looked at how to build a cross browser video player using the HTMLMediaElement and Window.fullScreen APIs, and also at how to style the player. This article will take the same player and show how to add captions and subtitles to it, using the WebVTT format and the <track> element. 8 Creating a cross-browser...
... HTML5, Media, WebVTT, captions, subtitles, track In other articles we looked at how to build a cross browser video player using the HTMLMediaElement and Window.fullScreen APIs, and also at how to style the player. This article will take the same player and show how to add captions and subtitles to it, using the WebVTT format and the <track> element. 8 Creating a cross-browser video player Apps, HTML5, Video, full screen This article describes a simple HTML5 video player that uses the Media and Fullscreen APIs and works across most major desktop and mobile browsers. As well as working fullscreen, the player features custom controls rather than just using the browser defaults. The player controls themselves won't be styled beyond the basics required to get them work...
...And 12 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
iality, Integrity, Availability) (also called the CIA triad or AIC triad) is a model that guides an organization's policies for information security. 47 CMS CMS, Composing, Content management system, Glossary A CMS (Content Management System) is software that allows users to publish, organize, change, or remove various kinds of content, not only text but also embedded images, video, audio, and interactive code. 48 CORS Glossary, Infrastructure, Security CORS (Cross-Origin Resource Sharing) is a system, consisting of transmitting HTTP headers, that determines whether browsers block frontend JavaScript code from accessing responses for cross-origin requests. 49 CORS-safelisted request header CORS, Fetch A CORS-safelisted request heade...
...n. The concept of a constructor can be applied to most object-oriented programming languages. Essentially, a constructor in JavaScript is usually declared at the instance of a class. 89 Continuous Media Glossary, Media Continuous media is data where there is a timing relationship between source and destination. The most common examples of continuous media are audio and motion video. Continuous media can be real-time (interactive), where there is a "tight" timing relationship between source and sink, or streaming (playback), where the relationship is less strict. 90 Control flow CodingScripting, Glossary, JavaScript The control flow is the order in which the computer executes statements in a script. 91 Cookie Glossary, WebMechanics A...
...s and Numbers) is an international nonprofit that maintains the domain name system and the record of IP addresses. 213 ICE CodingScripting, Glossary, Networking, Protocols, WebRTC ICE (Interactive Connectivity Establishment) is a framework used by WebRTC (among other technologies) for connecting two peers to each other, regardless of network topology (usually for audio and/or video chat). This protocol lets two peers find and establish a connection with one another even though they may both be using Network Address Translator (NAT) to share a global IP address with other devices on their respective local networks. 214 IDE CodingScripting, Glossary An Integrated Development Environment (IDE) or Interactive Development environment is a software applicatio...
...And 11 more matches
From object to iframe — other embedding technologies - Learn web development
At this point we'd like to take somewhat of a sideways step, looking at some elements that allow you to embed a wide variety of content types into your webpages: the <iframe>, <embed> and <object> elements. <iframe>s are for embedding other web pages, and the other two allow you to embed PDFs, SVG, and even Flash -- a technology that is on the way out, but which you'll still see semi-regularly. ...
...noticeable with network connections being so slow back then. They did however have many problems, which far outweighed any positives as network speeds got faster, so you don't see them being used anymore. A little while later (late 90s, early 2000s), plugin technologies became very popular, such as Java Applets and Flash -- these allowed web developers to embed rich content into webpages such as videos and animations, which just weren't available through HTML alone. Embedding these technologies was achieved through elements like <object>, and the lesser-used <embed>, and they were very useful at the time. They have since fallen out of fashion due to many problems, including accessibility, security, file size, and more; these days most mobile devices don't support such plugins anymore, and desk...
...ect>, and the lesser-used <embed>, and they were very useful at the time. They have since fallen out of fashion due to many problems, including accessibility, security, file size, and more; these days most mobile devices don't support such plugins anymore, and desktop support is on the way out. Finally, the <iframe> element appeared (along with other ways of embedding content, such as <canvas>, <video>, etc.) This provides a way to embed an entire web document inside another one, as if it were an <img> or other such element, and is used regularly today. With the history lesson out of the way, let's move on and see how to use some of these. Active learning: classic embedding uses In this article we are going to jump straight into an active learning section, to immediately give you a real ide...
...And 11 more matches
Introduction to events - Learn web development
e element, set of elements, the HTML document loaded in the current tab, or the entire browser window. There are many different types of events that can occur. For example: The user selects a certain element or hovers the cursor over a certain element. The user chooses a key on the keyboard. The user resizes or closes the browser window. A web page finishes loading. A form is submitted. A video is played, paused, or finishes. An error occurs. You can gather from this (and from glancing at the MDN Event reference) that there are a lot of events that can be responded to. Each available event has an event handler, which is a block of code (usually a JavaScript function that you as a programmer create) that runs when the event fires. When such a block of code is defined to run in respon...
...n.onmouseout -- The color changes when the mouse pointer hovers over the button, or when the pointer moves off the button, respectively. Some events are general and available nearly anywhere (e.g. an onclick handler can be registered on nearly any element), whereas some are more specific and only useful in certain situations (e.g. it makes sense to use onplay only on specific elements, such as <video>). Inline event handlers -- don't use these You might also see a pattern like this in your code: <button onclick="bgChange()">Press me</button> function bgChange() { const rndCol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; document.body.style.backgroundColor = rndCol; } Note: You can find the full source code for this example on GitHub (also see it running liv...
...-- have fun): Most event handlers you'll encounter have a standard set of properties and functions (methods) available on the event object; see the Event object reference for a full list. Some more advanced handlers, however, add specialist properties containing extra data that they need to function. The Media Recorder API, for example, has a dataavailable event, which fires when some audio or video has been recorded and is available for doing something with (for example saving it, or playing it back). The corresponding ondataavailable handler's event object has a data property available containing the recorded audio or video data to allow you to access it and do something with it. Preventing default behavior Sometimes, you'll come across a situation where you want to prevent an event from...
...And 10 more matches
Recording a media element - Web APIs
While the article Using the MediaStream Recording API demonstrates using the MediaRecorder interface to capture a MediaStream generated by a hardware device, as returned by navigator.mediaDevices.getUserMedia(), you can also use an HTML media element (namely <audio> or <video>) as the source of the MediaStream to be recorded. In this article, we'll look at an example that does just that. HTML content <p>Click the "Start" button to begin video recording for a few seconds. You can stop the video by clicking the creatively-named "Stop" button. The "Download" button will download the received data (although it's in a raw, unwrapped form that isn't very useful). </p> <br> Let's start by looking at the key bits of the HTML. There's a little more than this, but it's just informational...
...load" button will download the received data (although it's in a raw, unwrapped form that isn't very useful). </p> <br> Let's start by looking at the key bits of the HTML. There's a little more than this, but it's just informational rather than being part of the core operation of the app. <div class="left"> <div id="startButton" class="button"> Start </div> <h2>Preview</h2> <video id="preview" width="160" height="120" autoplay muted></video> </div> We present our main interface in two columns. On the left is a start button and a <video> element which displays the video preview; this is the video the user's camera sees. Note that the autoplay attribute is used so that as soon as the stream starts to arrive from the camera, it immediately gets displayed, and the muted attr...
...era sees. Note that the autoplay attribute is used so that as soon as the stream starts to arrive from the camera, it immediately gets displayed, and the muted attribute is specified to ensure that the sound from the user's microphone isn't output to their speakers, causing an ugly feedback loop. <div class="right"> <div id="stopButton" class="button"> Stop </div> <h2>Recording</h2> <video id="recording" width="160" height="120" controls></video> <a id="downloadButton" class="button"> Download </a> </div> On the right we see a stop button and the <video> element which will be used to play back the recorded video. Notice that the playback panel doesn't have autoplay set (so the playback doesn't start as soon as media arrives), and it has controls set, which tells it to sho...
...And 10 more matches
Autoplay guide for media and Web Audio APIs - Web media technologies
Automatically starting the playback of audio (or videos with audio tracks) immediately upon page load can be an unwelcome surprise to users. While autoplay of media serves a useful purpose, it should be used carefully and only when needed. In order to give users control over this, browsers often provide various forms of autoplay blocking. In this guide, we'll cover autoplay functionality in the various media and Web Audio APIs, including a brief overview of how to use autoplay and how to work with browsers to handle autoplay blocking gracefully. Autoplay blocking is not applied to <video> elements when the source media does not have an audio track, or if the audio track is muted. Media with an active audio track are considered to be audible, and autoplay blocking applies to them. Inaud...
...ll as the user of JavaScript code to start playback outside the context of handling user input. That means that both of the following are considered autoplay behavior, and are therefore subject to the browser's autoplay blocking policy: <audio src="/music.mp4" autoplay> and audioElement.play(); The following web features and APIs may be affected by autoplay blocking: The HTML <audio> and <video> elements The Web Audio API From the user's perspective, a web page or app that spontaneously starts making noise without warning can be jarring, inconvenient, or off-putting. Because of that, browsers generally only allow autoplay to occur successfully under specific circumstances. Autoplay availability As a general rule, you can assume that media will be allowed to autoplay only if at leas...
... that we've covered what autoplay is and what can prevent autoplay from being allowed, we'll look at how your web site or app can automatically play media upon page load, how to detect when autoplay fails to occur, and tips for coping when autoplay is denied by the browser. The autoplay attribute The simplest way to automatically play content is to add the autoplay attribute to your <audio> or <video> element. This sets the autoplay property on the element to true, and when autoplay is true, the media will automatically begin to play as soon as possible after the following have occurred: The page is allowed to use autoplay functionality The element has been created during page load Enough media has been received to begin playback and continue to play through to the end of the media witho...
...And 10 more matches
Index - Learn web development
chieve this, this module will cover general best practices (which are demonstrated throughout the HTML, CSS, and JavaScript topics), cross browser testing, and some tips on enforcing accessibility from the start. We'll cover accessibility in special detail. 3 Accessible multimedia Accessibility, Article, Audio, Beginner, CodingScripting, HTML, Images, JavaScript, Learn, Multimedia, Video, captions, subtitles, text tracks This chapter has provided a summary of accessibility concerns for multimedia content, along with some practical solutions. 4 Assessment: Accessibility troubleshooting Accessibility, Assessment, Beginner, CSS, CodingScripting, HTML, JavaScript, Learn, WAI-ARIA In the assessment for this module, we present to you a simple site with a numb...
...ng Beginner, CodingScripting, JavaScript, JavaScripting beginner, Landing, Module, Topic, l10n:priority JavaScript is a programming language that allows you to implement complex things on web pages. Every time a web page does more than just sit there and display static information for you to look at--displaying timely content updates, interactive maps, animated 2D/3D graphics, scrolling video jukeboxes, or more--you can bet that JavaScript is probably involved. 49 Asynchronous JavaScript Beginner, CodingScripting, Guide, JavaScript, Landing, Promises, async, asynchronous, await, callbacks, requestAnimationFrame, setInterval, setTimeout In this module we take a look at asynchronous JavaScript, why it is important, and how it can be used to effectively handle potent...
...ence. Most importantly, you should understand what the Document Object Model is, and how to manipulate it to create useful functionality. 62 Third-party APIs 3rd party, API, Beginner, CodingScripting, Google Maps, Learn, NYTimes, Third party, youtube This article has given you a useful introduction to using third-party APIs to add functionality to your websites. 63 Video and Audio APIs API, Article, Audio, Beginner, CodingScripting, Guide, JavaScript, Learn, Video I think we've taught you enough in this article. The HTMLMediaElement API makes a wealth of functionality available for creating simple video and audio players, and that's only the tip of the iceberg. See the "See also" section below for links to more complex and interesting functionality. ...
...And 9 more matches
HTMLMediaElement.srcObject - Web APIs
b, or File object (though see the compatibility table for what is actually supported). Usage notes Older versions of the Media Source specification required using createObjectURL() to create an object URL then setting src to that URL. Now you can just set srcObject to the MediaStream directly. ...
...rted). Usage notes Older versions of the Media Source specification required using createObjectURL() to create an object URL then setting src to that URL. Now you can just set srcObject to the MediaStream directly. Examples Basic example In this example, a MediaStream from a camera is assigned to a newly-created <video> element. ...
...Older versions of the Media Source specification required using createObjectURL() to create an object URL then setting src to that URL. Now you can just set srcObject to the MediaStream directly. Examples Basic example In this example, a MediaStream from a camera is assigned to a newly-created <video> element. ...
...And 9 more matches
Configuring servers for Ogg media - HTTP
HTML <audio> and <video> elements allow media presentation without the need for the user to install any plug-ins or other software to do so. This guide covers a few server configuration changes that may be necessary for your web server to correctly serve Ogg media files. This information may also be useful if you encounter other media types your server isn't already configured to recognize. Serve media with the correct MIME type *.ogg and *.ogv files containing video (possibly with an audio track as well, of course), should be served with the video/ogg MIME type. *.oga and *.ogg files containing only audio should be served with the audio/ogg MIME type. ...
...ter other media types your server isn't already configured to recognize. Serve media with the correct MIME type *.ogg and *.ogv files containing video (possibly with an audio track as well, of course), should be served with the video/ogg MIME type. *.oga and *.ogg files containing only audio should be served with the audio/ogg MIME type. If you don't know whether the Ogg file contains audio or video, you can serve it with the MIME type application/ogg, and the browser will treat it as a video file. Most servers don't by default serve Ogg media with the correct MIME types, so you'll likely need to add the appropriate configuration for this. ...
...In particular, the article on media container formats will be especially helpful when configuring serers to host media properly. ...
...And 9 more matches
Handling common HTML and CSS problems - Learn web development
ally when you need to support old browsers (such as old IE versions) or you are using features that are implemented using CSS prefixes. In general, most core HTML and CSS functionality (such as basic HTML elements, CSS basic colors and text styling) works across most browsers you'll want to support; more problems are uncovered when you start wanting to use newer features such as Flexbox, or HTML5 video/audio, or even more nascent, CSS Grids or -webkit-background-clip: text. Once you've identified a list of potential problem technologies you will be using, it is a good idea to research what browsers they are supported in, and what related techniques are useful. See Finding help below. HTML fallback behaviour Some problems can be solved by just taking advantage of the natural way in which HTML...
...ample setting display: block; on all of the new semantic elements (such as <article>, <aside>, etc.), but only in old versions of IE that don't recognise them (so, IE 8 and lower). This way new browsers can just use the code as normal, but older IE versions will be able to style these elements too. Note: See IE conditional comments for the best way to do this. ...
...t way to do this. More complex elements like HTML <video>, <audio>, and <canvas> (and other features besides) have natural mechanisms for fallbacks to be added, which work on the same principle as described above. You can add fallback content in between the opening and closing tags, and non-supporting browsers will effectively ignore the outer element and run the nested content. ...
...And 8 more matches
RTCPeerConnection.addTrack() - Web APIs
Syntax rtpSender = rtcPeerConnection.addTrack(track, stream...); Parameters track A MediaStreamTrack object representing the media track to add to the peer connection. stream... ...
...are specified, then the track is streamless. This is perfectly acceptable, although it will be up to the remote peer to decide what stream to insert the track into, if any. This is a very common way to use addTrack() when building many types of simple applications, where only one stream is needed. For example, if all you're sharing with the remote peer is a single stream with an audio track and a video track, you don't need to deal with managing what track is in what stream, so you might as well just let the transceiver handle it for you. Here's an example showing a function that uses getUserMedia() to obtain a stream from a user's camera and microphone, then adds each track from the stream to the peer connection, without specifying a stream for each track: async openCall(pc) { const gumStr...
...o you might as well just let the transceiver handle it for you. Here's an example showing a function that uses getUserMedia() to obtain a stream from a user's camera and microphone, then adds each track from the stream to the peer connection, without specifying a stream for each track: async openCall(pc) { const gumStream = await navigator.mediaDevices.getUserMedia( {video: true, audio: true}); for (const track of gumStream.getTracks()) { pc.addTrack(track); } } The result is a set of tracks being sent to the remote peer, with no stream associations. The handler for the track event on the remote peer will be responsible for determining what stream to add each track to, even if that means simply adding them all to the same stream. The ontrack handler might ...
...And 8 more matches
MediaTrackSettings - Web APIs
he sampleSize property, specifying the linear size, in bits, of each audio sample. CD-quality audio, for example, is 16-bit, so this value would be 16 in that case. volume A double-precision floating point value indicating the current value of the volume property, specifying the volume level of the track. This value will be between 0.0 (silent) to 1.0 (maximum supported volume). Properties of video tracks aspectRatio A double-precision floating point value indicating the current value of the aspectRatio property, specified precisely to 10 decimal places. This is the width of the image in pixels divided by its height in pixels. Common values include 1.3333333333 (for the classic television 4:3 "standard" aspect ratio, also used on tablets such as Apple's iPad), 1.7777777778 (for the 16:9...
... (for the 16:9 high-definition widescreen aspect ratio), and 1.6 (for the 16:10 aspect ratio common among widescreen computers and tablets). facingMode A DOMString indicating the current value of the facingMode property, specifying the direction the camera is facing. The value will be one of: "user" A camera facing the user (commonly known as a "selfie cam"), used for self-portraiture and video calling. "environment" A camera facing away from the user (when the user is looking at the screen). This is typically the highest quality camera on the device, used for general photography. "left" A camera facing toward the environment to the user's left. "right" A camera facing toward the environment to the user's right. frameRate A double-precision floating point value indicat...
...s looking at the screen). This is typically the highest quality camera on the device, used for general photography. "left" A camera facing toward the environment to the user's left. "right" A camera facing toward the environment to the user's right. frameRate A double-precision floating point value indicating the current value of the frameRate property, specifying how many frames of video per second the track includes. If the value can't be determined for any reason, the value will match the vertical sync rate of the device the user agent is running on. height A long integer value indicating the current value of the height property, specifying the height of the track's video data in pixels. width A long integer value indicating the current value of the width property, specifyi...
...And 7 more matches
Transcoding assets for Media Source Extensions - Web APIs
, MSE is designed not to require support for any particular media format or codec. While this is true on paper, browser support varies for specific container/codec combinations. ...
...articular media format or codec. While this is true on paper, browser support varies for specific container/codec combinations. To check if the browser supports a particular container, you can pass a string of the MIME type to the MediaSource.isTypeSupported method: MediaSource.isTypeSupported('audio/mp3'); // false MediaSource.isTypeSupported('video/mp4'); // true MediaSource.isTypeSupported('video/mp4; codecs="avc1.4D4028, mp4a.40.2"'); // true The string is the MIME type of the container, optionally followed by a list of codecs. While the MIME type is fairly simple to figure out, we can get the codec string using the mp4info utility. Currently, MP4 containers with H.264 video and AAC audio codecs have support across all modern browsers, while others don't. To convert our sample media f...
...ile the MIME type is fairly simple to figure out, we can get the codec string using the mp4info utility. Currently, MP4 containers with H.264 video and AAC audio codecs have support across all modern browsers, while others don't. To convert our sample media from a QuickTime MOV container to an MP4 container, we can use ffmpeg. Because the audio codec in the MOV container is already AAC and the video codec is h.264, we can instruct ffmpeg not to perform transcoding. Instead, it will just copy the audio and video tracks over without performing any transcoding, which is relatively faster than having to transcode. $ ffmpeg -i trailer_1080p.mov -c:v copy -c:a copy bunny.mp4 $ ls bunny.mp4 trailer_1080p.mov Checking Fragmentation In order to properly stream MP4, we need the asset to be ...
...And 7 more matches
VTTCue - Web APIs
Web › API › VTTCue
e beginning of the range of the media data to which the cue applies. endTime The time, in seconds and fractions of a second, that describes the end of the range of the media data to which the cue applies. text The raw text of the cue, and rules for its interpretation. Properties This interface also inherits properties from TextTrackCue. VTTCue.region A VTTRegion object describing the video's sub-region that the cue will be drawn onto, or null if none is assigned. VTTCue.vertical Returns an enum representing the cue writing direction. VTTCue.snapToLines Returns true if the VTTCue.line attribute is an integer number of lines or a percentage of the video size. VTTCue.line Returns the line positioning of the cue. This can be the string auto or a number whose interpretation depend...
...ine Returns the line positioning of the cue. This can be the string auto or a number whose interpretation depends on the value of VTTCue.snapToLines. VTTCue.lineAlign Returns an enum representing the alignment of the VTTCue.line. VTTCue.position Returns the indentation of the cue within the line. This can be the string auto or a number representing the percentage of the VTTCue.region, or the video size if VTTCue.region is null. VTTCue.positionAlign Returns an enum representing the alignment of the cue. This is used to determine what the VTTCue.position is anchored to. The default is auto. VTTCue.size Returns a double representing the size of the cue, as a percentage of the video size. VTTCue.textAlign Returns an enum representing the alignment of all the lines of text within the cue ...
... is anchored to. The default is auto. VTTCue.size Returns a double representing the size of the cue, as a percentage of the video size. VTTCue.textAlign Returns an enum representing the alignment of all the lines of text within the cue box. VTTCue.text Returns a DOMString with the contents of the cue. Methods getCueAsHTML() Returns the cue text as a DocumentFragment. ...
...And 7 more matches
HTML attribute reference - HTML: Hypertext Markup Language
automatically capitalized when entered by user autocomplete <form>, <input>, <select>, <textarea> Indicates whether controls in this form can by default have their values automatically completed by the browser. autofocus <button>, <input>, <keygen>, <select>, <textarea> The element should be automatically focused after the page loaded. autoplay <audio>, <video> The audio or video should play as soon as possible. background <body>, <table>, <td>, <th> Specifies the URL of an image file. Note: Although browsers and email clients may still support this attribute, it is obsolete. Use CSS background-image instead. bgcolor <body>, <col>, <colgroup>, <marquee>, <table>, <tbody>, <tfoot>, <td>, <th>, <tr> Backgroun...
...marquee>, <table>, <tbody>, <tfoot>, <td>, <th>, <tr> Background color of the element. Note: This is a legacy attribute. Please use the CSS background-color property instead. border <img>, <object>, <table> The border width. Note: This is a legacy attribute. Please use the CSS border property instead. buffered <audio>, <video> Contains the time range of already buffered media. capture <input> From the HTML Media CaptureThe definition of 'media capture' in that specification.spec, specifies a new file can be captured. challenge <keygen> A challenge string that is submitted along with the public key. charset <meta>, <script> Declares the character encoding of the page or s...
...the number of columns a cell should span. content <meta> A value associated with http-equiv or name depending on the context. contenteditable Global attribute Indicates whether the element's content is editable. contextmenu Global attribute Defines the ID of a <menu> element which will serve as the element's context menu. ...
...And 7 more matches
MIME types (IANA media types) - HTTP
s and sites will not work correctly, and downloaded files may be mishandled. Structure of a MIME type The simplest MIME type consists of a type and a subtype; these are each strings which, when concatenated with a slash (/) between them, comprise a MIME type. No whitespace is allowed in a MIME type: type/subtype The type represents the general category into which the data type falls, such as video or text. The subtype identifies the exact kind of data of the specified type the MIME type represents. For example, for the MIME type text, the subtype might be plain (plain text), html (HTML source code), or calendar (for iCalendar/.ics) files. Each type has its own set of possible subtypes, and a MIME type always has both a type and a subtype, never just one or the other. An optional paramete...
...t file, the MIME type text/plain;charset=UTF-8 is used. MIME types are case-insensitive but are traditionally written in lowercase, with the exception of parameter values, whose case may or may not have specific meaning. Types There are two classes of type: discrete and multipart. Discrete types are types which represent a single file or medium, such as a single text or music file, or a single video. A multipart type is one which represents a document that's comprised of multiple component parts, each of which may have its own individual MIME type; or, a multipart type may encapsulate multiple files being sent together in one transaction. For example, multipart MIME types are used when attaching multiple files to an email. Discrete types The discrete types currently registered with the IAN...
...uch as animated GIF or APNG. Common examples are image/jpeg, image/png, and image/svg+xml. model List at IANA Model data for a 3D object or scene. Examples include model/3mf and model/vml. text List at IANA Text-only data including any human-readable content, source code, or textual data such as comma-separated value (CSV) formatted data. Examples include text/plain, text/csv, and text/html. video List at IANA Video data or files, such as MP4 movies (video/mp4). For text documents without a specific subtype, text/plain should be used. Similarly, for binary documents without a specific or known subtype, application/octet-stream should be used. Multipart types Multipart types indicate a category of document broken into pieces, often with different MIME types; they can also be used -- es...
...And 7 more matches
Web media technologies
Today, there are a large number of APIs available, as well as HTML elements, DOM interfaces, and other features that make it possible to not only perform these tasks, but use media in tandem with other technologies to do truly remarkable things. This article lists the various APIs with links to documentation you may find helpful in mastering them. References HTML These articles cover HTML features for media developers. <audio> The <audio> element is used to play audio in a Web context. ...
...ocumentation you may find helpful in mastering them. References HTML These articles cover HTML features for media developers. <audio> The <audio> element is used to play audio in a Web context. These can be used invisibly as a destination for more complex media, or with visible controls for user-controlled playback of audio files. Accessible from JavaScript as HTMLAudioElement objects. <video> The <video> element is an endpoint for video content in a Web context. It can be used to simply present video files, or as a destination for streamed video content. <video> can also be used as a way to link media APIs with other HTML and DOM technologies, including <canvas> (for frame grabbing and manipulation), for example. Accessible from JavaScript as HTMLVideoElement objects. <track> The ...
...n a Web context. It can be used to simply present video files, or as a destination for streamed video content. <video> can also be used as a way to link media APIs with other HTML and DOM technologies, including <canvas> (for frame grabbing and manipulation), for example. Accessible from JavaScript as HTMLVideoElement objects. <track> The HTML <track> element can be placed within an <audio> or <video> element to provide a reference to a WebVTT format subtitle or caption track to be used when playing the media. Accessible from JavaScript as HTMLTrackElement objects. <source> The HTML <source> element is used within an <audio> or <video> element to specify source media to present. Multiple sources can be used to provide the media in different formats, sizes, or resolutions. Accessible from Ja...
...And 7 more matches
Introduction to automated testing - Learn web development
premise with such applications is that the company that runs each one has a huge server farm that can run many different tests. When you use this service, you provide a URL of the page you want to test along with information, such as what browsers you want it tested in. The app then configures a new VM with the OS and browser you specified, and returns the test results in the form of screenshots, videos, logfiles, text, etc. You can then step up a gear, using an API to access functionality programmatically, which means that such apps can be combined with task runners, such as your own local Selenium environments and others, to create automated tests. Note: There are other commercial browser testing systems available but in this article, we'll focus on LambdaTest, Sauce Labs, and BrowserStack...
...te. As you click on the Start button, a loading screen will appear, providing you with a VM (Virtual Machine) based on your configurations. Once loaded, you can perform live, interactive cross-browser testing with a website. If you notice an issue with the UI, then you can share it with your colleagues by capturing a screenshot of your VM with the screenshot button. You can also record a video of your test session by hitting the recorder button in your test session. With the in-built image editor, highlight your screenshot before you push it to your colleagues. Using the mark as bug button you can push bugs to numerous third-party tools such as Jira, Asana, Trello, and more. That way you can log a bug directly from your test session on LambdaTest to your project management instanc...
...ith the in-built image editor, highlight your screenshot before you push it to your colleagues. Using the mark as bug button you can push bugs to numerous third-party tools such as Jira, Asana, Trello, and more. That way you can log a bug directly from your test session on LambdaTest to your project management instance. Check out all the third-party LambdaTest integrations. Note: All the videos and images captured inside a test session are captured inside the gallery, test logs, and issue tracker at LambdaTest. Sauce Labs Getting started with Sauce Labs Let's get started with a Sauce Labs Trial. Create a Sauce Labs trial account. Sign in. This should happen automatically after you verify your e-mail address. The basics: Manual tests The Sauce Labs dashboard has a lot of opti...
...And 6 more matches
MediaDevices - Web APIs
constraints and how to use them. getDisplayMedia() Prompts the user to select a display or portion of a display (such as a window) to capture as a MediaStream for sharing or recording purposes. Returns a promise that resolves to a MediaStream. ...
... for sharing or recording purposes. Returns a promise that resolves to a MediaStream. getUserMedia() With the user's permission through a prompt, turns on a camera and/or a microphone on the system and provides a MediaStream containing a video track and/or an audio track with the input. Example 'use strict'; // Put variables in global scope to make them available to the browser console. ...
...es. Returns a promise that resolves to a MediaStream. getUserMedia() With the user's permission through a prompt, turns on a camera and/or a microphone on the system and provides a MediaStream containing a video track and/or an audio track with the input. Example 'use strict'; // Put variables in global scope to make them available to the browser console. ...
...And 6 more matches
Web Audio playbackRate explained - Developer guides
The playbackRate property of the <audio> and <video> elements allows us to change the speed, or rate, at which a piece of web audio or video is playing. This article explains playbackRate in detail. playbackRate basics Let's starting by looking at a brief example of playbackRate usage: var myAudio = document.createElement('audio'); myAudio.setAttribute('src','audiofile.mp3'); myAudio.playbackRate = 0.5; Here we create an <audio> element, and set its src to a file of our choice. ...
... example of playbackRate usage: var myAudio = document.createElement('audio'); myAudio.setAttribute('src','audiofile.mp3'); myAudio.playbackRate = 0.5; Here we create an <audio> element, and set its src to a file of our choice. ...
...var myAudio = document.createElement('audio'); myAudio.setAttribute('src','audiofile.mp3'); myAudio.playbackRate = 0.5; Here we create an <audio> element, and set its src to a file of our choice. ...
...And 6 more matches
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
Web › HTML › Element › audio
and closing <audio></audio> tags is shown as a fallback in browsers that don't support the element. Attributes This element's attributes include the global attributes. autoplay A Boolean attribute: if specified, the audio will automatically begin playback as soon as it can do so, without waiting for the entire audio file to finish downloading. 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 pr...
... controls> <source src="myAudio.mp3" type="audio/mpeg"> <source src="myAudio.ogg" type="audio/ogg"> <p>Your browser doesn't support HTML5 audio. Here is a <a href="myAudio.mp4">link to the audio</a> instead.</p> </audio> We offer a substantive and thorough guide to media file types and the audio codecs that can be used within them. Also available is a guide to the codecs supported for video. Other usage notes: If you don't specify the controls attribute, the audio player won't include the browser's default controls. You can, however, create your own custom controls using JavaScript and the HTMLMediaElement API. To allow precise control over your audio content, HTMLMediaElements fire many different events. This also provides a way to monitor the audio's fetching process so you c...
...ovides a way to monitor the audio's fetching process so you can watch for errors or detect when enough is available to begin to play or manipulate it. You can also use the Web Audio API to directly generate and manipulate audio streams from JavaScript code rather than streaming pre-existing audio files. <audio> elements can't have subtitles or captions associated with them in the same way that <video> elements can. See WebVTT and Audio by Ian Devlin for some useful information and workarounds. A good general source of information on using HTML <audio> is the Video and audio content beginner's tutorial. Styling with CSS The <audio> element has no intrinsic visual output of its own unless the controls attribute is specified, in which case the browser's default controls are shown. The defau...
...And 6 more matches
HTMLMediaElement: error event - Web APIs
The error event is fired when the resource could not be loaded due to an error (for example, a network connectivity problem). ...
... The error event is fired when the resource could not be loaded due to an error (for example, a network connectivity problem). ...
... The error event is fired when the resource could not be loaded due to an error (for example, a network connectivity problem). ...
...And 5 more matches
MediaConfiguration - Web APIs
onfiguration MediaCapabilities dictionary of the Media Capabilities API describes how media and audio files must be configured, or defined, to be passed as a parameter of the MediaCapabilities.encodingInfo() and MediaCapabilities.encodingInfo() methods. ...
... or decoding configuration type and a valid audio configuration or video configuration. If you plan on querying encoding information, set the media type to record or transmission. For decoding, set the type to file or media-source. If the media is an audio file, the audio configuration must include a valid audio MIME type as contentType, the number of channels, the bitrate, and the sample rate. Video configurations mush include a valid video MIME type as contentType, the bitrate, and framerate, along with the width and the height of the video file. All of these must be present, as in the examples below, or a TypeError will occur. A valid media decoding configuration, to be submitted as the parameter for mediaCapabilities.decodingInfo() method, has it's `type` set as: file: For plain ...
... record: For recording media. transmission: For media to be electronically transmitted. A valid audio configuration includes: contentType: Valid audio MIME type. channels: Number of channels used by the audio track. bitrate: Number of bits used to encode one second of the audio file. samplerate: Number of audio samples making up one second of the audio file. ...
...And 5 more matches
MediaRecorder() - Web APIs
sing a specific media container (file type), and, further, can specify the exact codec and codec configuration(s) to use by specifying the codecs parameter. Syntax var mediaRecorder = new MediaRecorder(stream[, options]); Parameters stream The MediaStream that will be recorded. ...
... media can come from a stream created using navigator.mediaDevices.getUserMedia() or from an <audio>, <video> or <canvas> element. options Optional A dictionary object that can contain the following properties: mimeType: A MIME type specifying the format for the resulting media; you may simply specify the container format (the browser will select its preferred codecs for audio and/or video), or you may use the codecs parameter and/or the profiles parameter to provide detailed information about which codecs to use and how to configure them. Applications can check in advance if a mimeType is supported by the user agent by calling MediaRecorder.isTypeSupported(). ...
...This can be specified instead of the above two properties. If this is specified along with one or the other of the above properties, this will be used for the one that isn't specified. ...
...And 5 more matches
Microsoft API extensions - Web APIs
Edge) support a number of special Microsoft extensions to the otherwise standard DOM APIs. These extensions are prefixed with MS or ms. Note: These APIs will only work in Microsoft applications, and are not on a standards track. ...
...al Microsoft extensions to the otherwise standard DOM APIs. These extensions are prefixed with MS or ms. Note: These APIs will only work in Microsoft applications, and are not on a standards track. ...
...ise standard DOM APIs. These extensions are prefixed with MS or ms. Note: These APIs will only work in Microsoft applications, and are not on a standards track. ...
...And 5 more matches
Navigator.getUserMedia() - Web APIs
If permission is denied, no compatible input devices exist, or any other error condition occurs, the error callback is executed with a MediaStreamError object describing what went wrong. If the user instead doesn't make a choice at all, neither callback is executed. This is a legacy method. ...
...tion under the modern MediaDevices.getUserMedia() method, as well as the article Capabilities, constraints, and settings. successCallback A function which is invoked when the request for media access is approved. The function is called with one parameter: the MediaStream object that contains the media stream. Your callback can then assign the stream to the desired object (such as an <audio> or <video> element), as shown in the following example: function(stream) { var video = document.querySelector('video'); video.srcObject = stream; video.onloadedmetadata = function(e) { // Do something with the video here. }; } errorCallback When the call fails, the function specified in the errorCallback is invokedwith a MediaStreamError object as its sole argument; this object is is...
...with various browsers' prefixes. Note that this is the deprecated way of doing it: See the Examples section under the MediaDevices.getUserMedia() for modern examples. ...
...And 5 more matches
RTCPeerConnection.createOffer() - Web APIs
to either "sendonly" or "inactive"). In modern implementations, the presence of this member with a value true, will ensure there is at least one transceiver set to receive audio that has not been stopped, and if there isn't one, one will be created. Note: You shouldn't use this legacy property. Instead, use RTCRtpTransceiver to control whether or not to accept incoming audio. offerToReceiveVideo Optional (Legacy) A legacy Boolean option which used to control whether or not to offer to the remote peer the opportunity to try to send video. If this value is false, the remote peer will not be offered to send video data, even if the local side will be sending video data. If this value is true, the remote peer will be offered to send video data, even if the local side will not be sending vide...
...set to either "sendonly" or "inactive"). ...
... the remote peer the opportunity to try to send video. If this value is false, the remote peer will not be offered to send video data, even if the local side will be sending video data. If this value is true, the remote peer will be offered to send video data, even if the local side will not be sending video data. The default behavior is to offer to receive video only if the local side is sending video, not otherwise. To emulate this behavior in modern implementations, the presence of this member with a value false, will set the direction of all existing video transceivers to exclude reception (i.e. set to either "sendonly" or "inactive"). ...
...And 5 more matches
RTCRtpSender.replaceTrack() - Web APIs
Among the use cases for replaceTrack() is the common need to switch between the rear- and front-facing cameras on a phone. With replaceTrack(), you can simply have a track object for each camera and switch between the two as needed. See the example Switching cameras below. ...
...even changes that seem huge can be done without requiring negotation. Here are the changes that can trigger negotiaton: The new track has a resolution which is outside the bounds of the bounds of the current track; that is, the new track is either wider or taller than the current one. The new track's frame rate is high enough to cause the codec's block rate to be exceeded. ...
...ed. The new track is a video track and its raw or pre-encoded state differs from that of the original track. The new track is an audio track with a different number of channels fom the original. Media sources that have built-in encoders -- such as hardware encoders -- may not be able to provide the negotiated codec. Software sources may not implement the negotiated codec. ...
...And 5 more matches
TrackEvent - Web APIs
specification, is used for events which represent changes to a set of available tracks on an HTML media element; these events are addtrack and removetrack. It's important not to confuse TrackEvent with the RTCTrackEvent interface, which is used for tracks which are part of an RTCPeerConnection. Events based on TrackEvent are always sent to one of the media track list types: Events involving video tracks are always sent to the VideoTrackList found in HTMLMediaElement.videoTracks Events involving audio tracks are always sent to the AudioTrackList specified in HTMLMediaElement.audioTracks Events affecting text tracks are sent to the TextTrackList object indicated by HTMLMediaElement.textTracks. Constructor TrackEvent() Creates and initializes a new TrackEvent object with the event...
...TrackEvent() Creates and initializes a new TrackEvent object with the event type specified, as well as optional additional properties. Properties TrackEvent is based on Event, so properties of Event are also available on TrackEvent objects. track Read only The DOM track object the event is in reference to. If not null, this is always an object of one of the media track types: AudioTrack, VideoTrack, or TextTrack). Methods TrackEvent has no methods of its own; however, it is based on Event, so it provides the methods available on Event objects. Example This example sets up a function, handleTrackEvent(), which is callled for any addtrack or removetrack event on the first <video> element found in the document. var videoElem = document.querySelector("video"); videoElem.videoTracks.
...ods of its own; however, it is based on Event, so it provides the methods available on Event objects. Example This example sets up a function, handleTrackEvent(), which is callled for any addtrack or removetrack event on the first <video> element found in the document. ...
...And 5 more matches
WebGL best practices - Web APIs
o complicated emulation when running on desktop OpenGL (such as on macOS). This is because in desktop OpenGL, nothing gets drawn if vertex attrib 0 is not array-enabled. You can use bindAttribLocation to force a vertex attribute to use location 0, and use enableVertexAttribArray(0) to make it array-enabled. Estimate a per-pixel VRAM Budget WebGL doesn't offer APIs to query the maximum amount of video memory on the system because such queries are not portable. Still, applications must be conscious of VRAM usage and not just allocate as much as possible. One technique pioneered by the Google Maps team is the notion of a per-pixel VRAM budget: 1) For one system (e.g. a particular desktop / laptop), decide the maximum amount of VRAM your application should use. 2) Compute the number of pixels c...
...mory usage of depth and stencil formats Depth and stencil attachments and formats are actually inseparable on many devices. You may ask for DEPTH_COMPONENT24 or STENCIL_INDEX8, but you're often getting D24X8 and X24S8 32bpp formats behind the scenes. Assume that the memory usage of depth and stencil formats is rounded up to the nearest four bytes. texImage/texSubImage uploads (particularly with videos) can cause pipeline flushes Most texture uploads from DOM elements will incur a processing pass that will temporarily switch GL Progams internally, causing a pipeline flush. (Pipelines are formalized explicitly in Vulkan[1] et al, but are implicit behind-the-scenes in OpenGL and WebGL. Pipelines are more or less the tuple of shader program, depth/stencil/multisample/blend/rasterization state) ...
...using a pipeline flush. (Pipelines are formalized explicitly in Vulkan[1] et al, but are implicit behind-the-scenes in OpenGL and WebGL. Pipelines are more or less the tuple of shader program, depth/stencil/multisample/blend/rasterization state) In WebGL: ... ...
...And 5 more matches
HTTP Index - HTTP
Web › HTTP › Index
hree phases: 3 An overview of HTTP HTML, HTTP, Overview, WebMechanics, l10n:priority HTTP isthe foundation of any data exchange on the Web and it is a client-server protocol, which means requests are initiated by the recipient, usually the Web browser. A complete document is reconstructed from the different sub-documents fetched, for instance text, layout description, images, videos, scripts, and more 4 Basics of HTTP Guide, HTTP, Overview HTTP is a pretty extensible protocol. It relies on a few basic concepts like the notion of resources and URIs, a simple structure of messages, and a client-server structure for the communication flow. On top of these basic concepts, numerous extensions have appeared over the years, adding new functionality and new sem...
...heme, allow content creators to embed small files inline in documents. 7 Evolution of HTTP Guide, HTTP, NeedsUpdate, NeedsUpdate(HTTP/3) HTTP (HyperText Transfer Protocol) is the underlying protocol of the World Wide Web. HTTP has evolved from an early protocol to exchange files in a semi-trusted laboratory environment, to the modern maze of the Internet, now carrying images, videos in high resolution and 3D. 8 Identifying resources on the Web Domain, HTTP, Path, Scheme, Syntax, URI, URL, URL Syntax, Web, fragment, port, query, resources The target of an HTTP request is called a "resource", whose nature isn't defined further; it can be a document, a photo, or anything else. Each resource is identified by a Uniform Resource Identifier (URI) used througho...
...quest header, Response Header, application/javascript, application/json, application/xml A media type (also known as a Multipurpose Internet Mail Extensions or MIME type) is a standard that indicates the nature and format of a document, file, or assortment of bytes. 10 Incomplete list of MIME types Audio, File Types, Files, HTTP, MIME, MIME Types, PHP, Reference, Text, Types, Video Here is a list of MIME types, associated by type of documents, ordered by their common extensions. 11 Resource URLs Guide, HTTP, Intermediate, Resource Resource URLs, URLs prefixed with the resource: scheme, are used by Firefox and Firefox browser extensions to load resources internally, but some of the information is available to sites the browser connects to as well. ...
...And 5 more matches
HTMLMediaElement: abort event - Web APIs
The abort event is fired when the resource was not fully loaded, but not as the result of an error. ...
... The abort event is fired when the resource was not fully loaded, but not as the result of an error. ...
... The abort event is fired when the resource was not fully loaded, but not as the result of an error. ...
...And 4 more matches
HTMLMediaElement: loadstart event - Web APIs
The loadstart event is fired when the browser has started to load a resource. ...
... The loadstart event is fired when the browser has started to load a resource. ...
... The loadstart event is fired when the browser has started to load a resource. ...
...And 4 more matches
HTMLMediaElement: progress event - Web APIs
The progress event is fired periodically as the browser loads a resource. ...
... The progress event is fired periodically as the browser loads a resource. ...
... The progress event is fired periodically as the browser loads a resource. ...
...And 4 more matches
ImageCapture - Web APIs
Capture API provides methods to enable the capture of images or photos from a camera or other photographic device. It provides an interface for capturing images from a photographic device referenced through a valid MediaStreamTrack. ...
... ImageCapture.getPhotoCapabilities() Returns a Promise that resolves with a PhotoCapabilities object containing the ranges of available configuration options. ...
...ves with a Blob containing the data. ImageCapture.getPhotoCapabilities() Returns a Promise that resolves with a PhotoCapabilities object containing the ranges of available configuration options. ImageCapture.getPhotoSettings() Returns a Promise that resolves with a PhotoSettings object containing the current photo configuration settings. ImageCapture.grabFrame() Takes a snapshot of the live video in a MediaStreamTrack, returning an ImageBitmap, if successful. Example The following code is taken from Chrome's Grab Frame - Take Photo Sample. Since ImageCapture requires some place to capture an image from, the example below starts with a device's media device (in other words a camera). This example shows, roughly, a MediaStreamTrack extracted from a device's MediaStream. The track is the...
...And 4 more matches
MediaSource - Web APIs
d source buffers. Properties MediaSource.sourceBuffers Read only Returns a SourceBufferList object containing the list of SourceBuffer objects associated with this MediaSource. MediaSource.activeSourceBuffers Read only Returns a SourceBufferList object containing a subset of the SourceBuffer objects contained within MediaSource.sourceBuffers -- the list of objects providing the selected video track, enabled audio tracks, and shown/hidden text tracks. MediaSource.readyState Read only Returns an enum representing the state of the current MediaSource, whether it is not currently attached to a media element (closed), attached and ready to receive SourceBuffer objects (open), or attached but the stream has been ended via MediaSource.endOfStream() (ended.) MediaSource.duration Gets an...
...sourceBuffers list. MediaSource.setLiveSeekableRange() Sets the range that the user can seek to in the media element. Static methods MediaSource.isTypeSupported() Returns a Boolean value indicating if the given MIME type is supported by the current user agent -- this is, if it can successfully create SourceBuffer objects for that MIME type. ...
...dicating if the given MIME type is supported by the current user agent -- this is, if it can successfully create SourceBuffer objects for that MIME type. Examples The following simple example loads a video with XMLHttpRequest, playing it as soon as it can. ...
...And 4 more matches
MediaTrackConstraints - Web APIs
ouble-precision integer) specifying the intensity of edges. focusDistance A ConstrainDouble (a double-precision integer) specifying distance to a focused object. zoom A ConstrainDouble (a double-precision integer) specifying the desired focal length. torch A Boolean defining whether the fill light is continuously connected, meaning it stays on as long as the track is active. Properties of video tracks aspectRatio A ConstrainDouble specifying the video aspect ratio or range of aspect ratios which are acceptable and/or required. facingMode A ConstrainDOMString object specifying a facing or an array of facings which are acceptable and/or required. frameRate A ConstrainDouble specifying the frame rate or range of frame rates which are acceptable and/or required. height A Constrain...
...Allowed values are none and crop-and-scale. ...
...required. facingMode A ConstrainDOMString object specifying a facing or an array of facings which are acceptable and/or required. frameRate A ConstrainDouble specifying the frame rate or range of frame rates which are acceptable and/or required. height A ConstrainLong specifying the video height or range of heights which are acceptable and/or required. width A ConstrainLong specifying the video width or range of widths which are acceptable and/or required. resizeMode A ConstrainDOMString object specifying a mode or an array of modes the UA can use to derive the resolution of a video track. Allowed values are none and crop-and-scale. none means that the user agent uses the resolution provided by the camera, its driver or the OS. crop-and-scale means that the user agent can use cropping...
...And 4 more matches
SourceBuffer - Web APIs
if kind, label, and/or language information is not available in the initialization segment of the media to be appended to the SourceBuffer. SourceBuffer.updating Read only A boolean indicating whether the SourceBuffer is currently being updated -- i.e. whether an SourceBuffer.appendBuffer(), SourceBuffer.appendStream(), or SourceBuffer.remove() operation is currently in progress. SourceBuffer.videoTracks Read only A list of the video tracks currently contained inside the SourceBuffer. Event handlers SourceBuffer.onabort Fired whenever SourceBuffer.appendBuffer() or SourceBuffer.appendStream() is ended by a call to SourceBuffer.abort(). SourceBuffer.updating changes from true to false. SourceBuffer.onerror Fired whenever an error occurs during SourceBuffer.appendBuffer() or SourceB...
...ct the new data to conform to. SourceBuffer.remove() Removes media segments within a specific time range from the SourceBuffer. SourceBuffer.removeAsync() Starts the process of asynchronously removing media segments in the specified range from the SourceBuffer. Returns a Promise which is fulfilled once all matching segments have been removed. ...
... segments in the specified range from the SourceBuffer. Returns a Promise which is fulfilled once all matching segments have been removed. Examples The following simple example loads a video chunk by chunk as fast as possible, playing it as soon as it can. ...
...And 4 more matches
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
you like. Note that this code is identical for both peers involved in the connection. Create the signaling and peer connections First, the signaling channel needs to be opened and the RTCPeerConnection needs to be created. The STUN server listed here is obviously not a real one; you'll need to replace stun.myserver.tld with the address of a real STUN server. ...
...gnaling and peer connections First, the signaling channel needs to be opened and the RTCPeerConnection needs to be created. The STUN server listed here is obviously not a real one; you'll need to replace stun.myserver.tld with the address of a real STUN server. ...
...rst, the signaling channel needs to be opened and the RTCPeerConnection needs to be created. The STUN server listed here is obviously not a real one; you'll need to replace stun.myserver.tld with the address of a real STUN server. const constraints = { audio: true, video: true }; const config = { iceServers: [{ urls: "stun:stun.mystunserver.tld" }] }; const selfVideo = document.querySelector("video.selfview"); const remoteVideo = document.querySelector("video.remoteview"); const signaler = new SignalingChannel(); const pc = new RTCPeerConnection(config); This code also gets the <video> elements using the classes "selfview" and "remoteview"; these will contain, respectively, the local user's self-view and the view of the incoming stream from the remote peer. Connecting to a remote peer ...
...And 4 more matches
<track>: The Embed Text Track element - HTML: Hypertext Markup Language
Web › HTML › Element › track
The HTML <track> element is used as a child of the media elements, <audio> and <video>. It lets you specify timed text tracks (or time-based data), for example to automatically handle subtitles. The tracks are formatted in WebVTT format (.vtt files) -- Web Video Text Tracks. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories None Permitted content None, it is an empty element. Tag omission As it is a void element, the start tag must be present and the end tag must not be present. Permitted parents A media element, <audio> or <video>. Im...
...d location of a scene. captions Closed captions provide a transcription and possibly a translation of audio. It may include important non-verbal information such as music cues or sound effects. It may indicate the cue's source (e.g. music, text, character). Suitable for users who are deaf or when the sound is muted. descriptions Textual description of the video content. Suitable for users who are blind or where the video cannot be seen. chapters Chapter titles are intended to be used when the user is navigating the media resource. metadata Tracks used by scripts. Not visible to the user. label A user-readable title of the text track which is used by the browser when listing available text tracks. src ...
... the media resource. metadata Tracks used by scripts. Not visible to the user. label A user-readable title of the text track which is used by the browser when listing available text tracks. src Address of the track (.vtt file). Must be a valid URL. This attribute must be specified and its URL value must have the same origin as the document -- unless the <audio> or <video> parent element of the track element has a crossorigin attribute. srclang Language of the track text data. It must be a valid BCP 47 language tag. If the kind attribute is set to subtitles, then srclang must be defined. Usage notes Track data types The type of data that track adds to the media is set in the kind attribute, which can take values of subtitles, captions, descriptions, chapters...
...And 4 more matches
HTML documentation index - HTML: Hypertext Markup Language
Web › HTML › Index
nner, Development, Guide, HTML, HTML5, Web HTML (Hypertext Markup Language) elements historically were categorized as either "block-level" elements or "inline-level" elements. By default, a block-level element occupies the entire space of its parent element (container), thereby creating a "block." This article helps to explain what this means. 5 DASH Adaptive Streaming for HTML 5 Video Guide, HTML, HTML5 Dynamic Adaptive Streaming over HTTP (DASH) is an adaptive streaming protocol. 6 Date and time formats used in HTML Date, Element, Format, HTML, ISO 8601, Input, Reference, String, Time, Week, datetime, datetime-local, del, ins, month, month-year, week-year Certain HTML elements use date and/or time values. The formats of the strings that specify ...
...item. Every HTML element can have an itemprop attribute specified, and an itemprop consists of a name-value pair. Each name-value pair is called a property, and a group of one or more properties forms an item. Property values are either a string or a URL and can be associated with a very wide range of elements including <audio>, <embed>, <iframe>, <img>, <link>, <object>, <source> , <track>, and <video>. 23 itemref Attribute, Global attribute, HTML, HTML Microdata, Microdata, Reference Properties that are not descendants of an element with the itemscope attribute can be associated with an item using the global attribute itemref. 24 itemscope Attribute, Global attribute, HTML, HTML Microdata, Microdata, Reference itemscope is a boolean global attribute t...
...ute specifies that, optionally, a new file should be captured, and which device should be used to capture that new media of a type defined by the accept attribute. Values include user and environment. 39 HTML attribute: crossorigin Advanced, Attribute, CORS, HTML, NeedsContent, Reference, Security The crossorigin attribute, valid on the <audio>, <img>, <link>, <script>, and <video> elements, provides support for CORS, defining how the element handles crossorigin requests, thereby enabling the configuration of the CORS requests for the element's fetched data. Depending on the element, the attribute can be a CORS settings attribute. 40 HTML attribute: max Attribute, Attributes, Constraint validation, HTML, Reference The max attribute defines the maximum ...
...And 4 more matches
Preloading content with rel="preload" - HTML: Hypertext Markup Language
discovers the <link rel="stylesheet"> and <script> elements in the same chunk of HTML as the preloads, but the benefits can be seen much more clearly the later resources are discovered and the larger they are. For example: Resources that are pointed to from inside CSS, like fonts or images. Resources that JavaScript can request, like JSON, imported scripts, or web workers. Larger images and video files. preload has other advantages too. Using as to specify the type of content to be preloaded allows the browser to: Prioritize resource loading more accurately. Store in the cache for future requests, reusing the resource if appropriate. Apply the correct content security policy to the resource. Set the correct Accept request headers for it. What types of content can be preloaded? ...
...rame> or <iframe>. embed: A resource to be embedded inside an <embed> element. fetch: Resource to be accessed by a fetch or XHR request, such as an ArrayBuffer or JSON file. font: Font file. image: Image file. object: A resource to be embedded inside an <object> element. script: JavaScript file. style: CSS stylesheet. track: WebVTT file. worker: A JavaScript web worker or shared worker. video: Video file, as typically used in <video>. Note: There's more detail about these values and the web features they expect to be consumed by in the Preload spec -- see link element extensions. Also note that the full list of values the as attribute can take is governed by the Fetch spec -- see request destinations. Including a MIME type <link> elements can accept a type attribute, which conta...
... see request destinations. Including a MIME type <link> elements can accept a type attribute, which contains the MIME type of the resource the element points to. This is especially useful when preloading resources -- the browser will use the type attribute value to work out if it supports that resource, and will only download it if so, ignoring it if not. ...
...And 4 more matches
Common MIME types - HTTP
y of MIME media types and maintains a list of all the official MIME types. ...
...s and maintains a list of all the official MIME types. ...
...tains a list of all the official MIME types. ...
...And 4 more matches
Web audio codec guide - Web media technologies
is article, we look at audio codecs used on the web to compress and decompress audio, what their capabilities and use cases are, and offer guidance when choosing audio codecs to use for your content. Additionally, WebRTC implementations generally use a subset of these codecs for their encoding and decoding of media, and may support additional codecs as well, for optimal cross-platform support of video and audio conferencing, and to integrate better with legacy telecommunication solutions. See Codecs used by WebRTC for details. For information about the fundamental concepts behind how digital audio works, see the article Digital audio concepts. Common codecs The list below denotes the codecs most commonly used on the web and which containers (file types) support them. If all you need to know...
... Factors affecting the encoded audio There are two general categories of factors that affect the encoded audio which is output by an audio codec's encoder: details about the source audio's format and contents, and the codec and its configuration during the encoding process. For each ...
... Container support Ogg, WebM, MPEG-TS, MP4 RTP / WebRTC compatible Yes Licensing Fully open and free of any licensing requirements [1] The specified sample rates are effective sample rates. Opus uses an algorithm based on audio bandwidths rather than sample rates. See RFC 6716, section 2 for details. In addition, there is...
...And 4 more matches
Visual typescript game engine - Game development
Project : Visual typescript game engine Version: Sunshine - 2019 2d canvas game engine based on Matter.js 2D physics engine for the web. Written in typescript current version 3.1.3. Text editor used and recommended: Visual Studio Code. Luanch debugger configuration comes with this project. Physics engine based on Matter.js. Multiplatform video chat (for all browsers) implemented. SocketIO used for session staff. MultiRTC2 used for data transfer also for video chat. MultiRTC3 alias 'broadcaster' used for video chat. Client part To make all dependency works in build process we need some plugins. npm install npm run build Navigate in browser /build/app.html to see client app in action -The client part is a browser web application. No reloading or redirecting. This is...
...t app in action -The client part is a browser web application. No reloading or redirecting. This is a single page application. I use HTML request only for loading local/staged HTML (like register, login etc.). Networking is based on WebSocket full-duplex communication only.You must be conform with classic socket connection methodology. webRTC can be used for any proportion. Already implemented: -video chat webRTC (SIP) chat and data communication. Look back on main staff : -Class 'Connector' (native WebSocket) used for user session staff. For main account session staff like login, register etc. Client config If you want web app without any networking then setup: appUseNetwork: boolean = false; You want to use communication for multiplayer but you don't want to use server database ac...
...mer-sever1.maximum"; /** * rtcServerPort Port used to connect multimedia server. * Default value is 12034 */ private rtcServerPort: number = 12034; /** * connectorPort is access port used to connect * session web socket. */ private connectorPort: number = 1234; /** * broadcasterPort Port used to connect multimedia server MultiRTC3. * I will use it for explicit video chat multiplatform support. * Default value is 9001 */ private broadcasterPort: number = 9001; /** * @description Important note for this property: if you * disable (false) you cant use Account system or any other * network. Use 'false' if you wanna make single player game. * In other way keep it 'true'. */ private appUseNetwork = false; /** * appUseAccountsSyste...
...And 3 more matches
Graceful asynchronous programming with Promises - Learn web development
t of time an async operation will take to return its result (unless of course, it takes far too long!), and more interested in being able to respond to it being returned, whenever that is. And of course, it's nice that it doesn't block the rest of the code execution. One of the most common engagements you'll have with promises is with web APIs that return a promise. Let's consider a hypothetical video chat application. The application has a window with a list of the user's friends, and clicking on a button next to a user starts a video call to that user. That button's handler calls getUserMedia() in order to get access to the user's camera and microphone. Since getUserMedia() has to ensure that the user has permission to use those devices and ask the user which microphone to use and which cam...
...ithout promises, everything in the browser becomes unusable until the user decides what to do about the camera and microphone. So instead of waiting for the user, getting the chosen devices enabled, and directly returning the MediaStream for the stream created from the selected sources, getUserMedia() returns a promise which is resolved with the MediaStream once it's available. ...
...he chosen devices enabled, and directly returning the MediaStream for the stream created from the selected sources, getUserMedia() returns a promise which is resolved with the MediaStream once it's available. ...
...And 3 more matches
Multimedia: Images - Learn web development
Prerequisites: Basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. Objective: To learn about the various image formats, their impact on performance, and how to reduce the impact of images on overall page load time. ...
... Prerequisites: Basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. Objective: To learn about the various image formats, their impact on performance, and how to reduce the impact of images on overall page load time. ...
...rmats, their impact on performance, and how to reduce the impact of images on overall page load time. This is a high-level introduction to optimizing multimedia delivery on the web, covering general principles and techniques. For a more in-depth guide, see https://images.guide. Why optimize your multimedia? For the average website, 51% of its bandwidth comes from imagery, followed by video at 25%, so it's safe to say it's important to address and optimize your multi-media content. You need to be considerate of data usage. Many people are on capped data plans or even pay-as-you-go where they are literally paying by the megabyte. This isn't an emerging market problem either. As of 2018, 24% of the United Kingdom still use pay-as-you-go. You also need to be considerate of memory as ...
...And 3 more matches
AudioTrack.enabled - Web APIs
The enabled property is a Boolean whose value is true if the track is enabled; enabled tracks produce audio while the media is playing. Setting enabled to false effectively mutes the audio track, preventing it from contributing to the media's audio performance. Example This example switches between the main and commentary audio tracks of a media element. ...
...value is true if the track is enabled; enabled tracks produce audio while the media is playing. Setting enabled to false effectively mutes the audio track, preventing it from contributing to the media's audio performance. Example This example switches between the main and commentary audio tracks of a media element. ...
...audio while the media is playing. Setting enabled to false effectively mutes the audio track, preventing it from contributing to the media's audio performance. Example This example switches between the main and commentary audio tracks of a media element. ...
...And 3 more matches
HTMLMediaElement: ended event - Web APIs
The ended event is fired when playback or streaming has stopped because the end of the media was reached or because no further data is available. This event occurs based upon HTMLMediaElement (<audio> and <video>) fire ended when playback of the media reaches the end of the media. Bubbles No Cancelable No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onended Specification HTML5 media This event is also defined in Media Capture and Streams and Web Audio API Examples These examples add an event listener for the HTMLMediaElement's ended event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const...
...ction None Event handler property GlobalEventHandlers.onended Specification HTML5 media This event is also defined in Media Capture and Streams and Web Audio API Examples These examples add an event listener for the HTMLMediaElement's ended event, then post a message when that event handler has reacted to the event firing. ...
...dler property GlobalEventHandlers.onended Specification HTML5 media This event is also defined in Media Capture and Streams and Web Audio API Examples These examples add an event listener for the HTMLMediaElement's ended event, then post a message when that event handler has reacted to the event firing. ...
...And 3 more matches
HTMLMediaElement.play() - Web APIs
resulting in a possible delay before the returned promise is resolved. Be sure your code doesn't expect an immediate response. For even more in-depth information about autoplay and autoplay blocking, see our article Autoplay guide for media and Web Audio APIs. ...
...the returned promise is resolved. Be sure your code doesn't expect an immediate response. For even more in-depth information about autoplay and autoplay blocking, see our article Autoplay guide for media and Web Audio APIs. ...
...autoplay and autoplay blocking, see our article Autoplay guide for media and Web Audio APIs. ...
...And 3 more matches
HTMLMedia​Element​.textTracks - Web APIs
However, these events aren't sent directly to the media element itself. ...
...dia element's track list. Syntax var textTracks = mediaElement.textTracks; Value A TextTrackList object representing the list of text tracks included in the media element. The list of tracks can be accessed using array notation, or using the object's getTrackById() method. Each track is represented by a TextTrack object which provides information about the track. ...
...Tracks = mediaElement.textTracks; Value A TextTrackList object representing the list of text tracks included in the media element. The list of tracks can be accessed using array notation, or using the object's getTrackById() method. Each track is represented by a TextTrack object which provides information about the track. ...
...And 3 more matches
msExtendedCode - Web APIs
ge in the future. In the event of an error, the media element's error event will be fired. The element's error property will then contain an msExtendedCode read-only property with platform-specific error code information. ...
... event of an error, the media element's error event will be fired. The element's error property will then contain an msExtendedCode read-only property with platform-specific error code information. ...
...n error, the media element's error event will be fired. The element's error property will then contain an msExtendedCode read-only property with platform-specific error code information. ...
...And 3 more matches
Media Capabilities API - Web APIs
en(result => { console.log('This configuration is ' + (result.supported ? '' : 'not ') + 'supported, ' + (result.smooth ? '' : 'not ') + 'smooth, and ' + (result.powerEfficient ? ...
...The Media Capabilities API enables determining which codecs are supported and how performant a media file will be both in terms of smoothness and power efficiency. ...
...s API provide more powerful features than say MediaRecorder.isTypeSupported() or HTMLMediaElement.canPlayType(), which only address general browser support, not performance. The API also provides abilities to access display property information such as supported color gamut, dynamic range abilities, and real-time feedback about the playback. To test support, smoothness and power efficiency of a video or audio file, you define the media configuration you want to test, and then pass the audio or video configuration as the parameter of the MediaCapabilities interface's encodingInfo() and decodingInfo() methods. Media capabilities information enables websites to enable adaptative streaming to alter the quality of content based on actual user-perceived quality, and react to a pick of CPU/GPU usag...
...And 3 more matches
msPlayToPreferredSourceUri - Web APIs
m Resource Identifier (URI). This URI can point to a cloud based media server allowing streaming directly from the cloud, which can be DRM protected, instead of streaming content from the Windows machine which must be unprotected content. A forward slash ("/") is appended to the URI string when it is sent over the network to a PlayTo device. This is done to conform to URI standards. ...
...URI can point to a cloud based media server allowing streaming directly from the cloud, which can be DRM protected, instead of streaming content from the Windows machine which must be unprotected content. A forward slash ("/") is appended to the URI string when it is sent over the network to a PlayTo device. This is done to conform to URI standards. ...
... point to a cloud based media server allowing streaming directly from the cloud, which can be DRM protected, instead of streaming content from the Windows machine which must be unprotected content. A forward slash ("/") is appended to the URI string when it is sent over the network to a PlayTo device. This is done to conform to URI standards. ...
...And 3 more matches
WebRTC API - Web APIs
The set of standards that comprise WebRTC makes it possible to share data and perform teleconferencing peer-to-peer, without requiring that the user installs plug-ins or any other third-party software. WebRTC consists of several interrelated APIs and protocols which work together to achieve this. ...
...evelopment process easier, with more broadly compatible results. The library is also available as an NPM package. To learn more about Adapter.js, see Improving compatibility using WebRTC adapter.js. WebRTC concepts and usage WebRTC serves multiple purposes; together with the Media Capture and Streams API, they provide powerful multimedia capabilities to the Web, including support for audio and video conferencing, file exchange, screen sharing, identity management, and interfacing with legacy telephone systems including support for sending DTMF (touch-tone dialing) signals. Connections between peers can be made without requiring any special drivers or plug-ins, and can often be made without any intermediary servers. Connections between two peers are represented by the RTCPeerConnection inter...
... Once a connection has been established and opened using RTCPeerConnection, media streams (MediaStreams) and/or data channels (RTCDataChannels) can be added to the connection. Media streams can consist of any number of tracks of media information; tracks, which are represented by objects based on the MediaStreamTrack interface, may contain one of a number of types of media data, including audio, video, and text (such as subtitles or even chapter names). Most streams consist of at least one audio track and likely also a video track, and can be used to send and receive both live media or stored media information (such as a streamed movie). You can also use the connection between two peers to exchange arbitrary binary data using the RTCDataChannel interface. This can be used for back-channel inf...
...And 3 more matches
WebRTC Statistics API - Web APIs
erConnection(pcOptions); statsInterval = window.setInterval(getConnectionStats, 1000); /* add event handlers, etc */ } catch(err) { console.error("Error creating RTCPeerConnection: " + err); } function getConnectionStats() { myPeerConnection.getStats(null).then(stats => { var statsOutput = ""; stats.forEach(report => { if (report.type === "inbound-rtp" && report.kind === "video") { Object.keys(report).forEach(statName => { statsOutput += `<strong>${statName}:</strong> ${report[statName]}<br>\n`; }); } }); document.querySelector(".stats-box").innerHTML = statsOutput; }); } When the promise returned by getStats() is fulfilled, the resolution handler receives as input an RTCStatsReport object containing the statistics information...
...elector(".stats-box").innerHTML = statsOutput; }); } When the promise returned by getStats() is fulfilled, the resolution handler receives as input an RTCStatsReport object containing the statistics information. This object contains a Map of named dictionaries based on RTCStats and its affiliated types. This example specifically looks for the report whose type is inbound-rtp and whose kind is video. This way, we look only at the video-related statistics for the local RTCRtpReceiver responsible for receiving the streamed media. Commonly used statistics Reference The RTCStatsReport object contains a map of named objects based one of the RTCStats dictionary's subclasses. Upon looking up a statistic category by name, you get an object containing the corresponding data. The table below shows ...
...al-candidate Statistics about a local ICE candidate associated with the connection's RTCIceTransports. RTCIceCandidateStats RTCStats media-source Statistics about the media produced by the MediaStreamTrack attached to an RTP sender. The dictionary this key maps to depends on the track's kind. RTCAudioSourceStats or RTCVideoSourceStats RTCMediaSourceStats RTCStats RTCAudioSourceStats or RTCVideoSourceStats outbound-rtp Statistics describing the state of one of the outbound data streams on this connection. RTCOutboundRtpStreamStats RTCSentRtpStreamStats RTCRtpStreamStats ...
...And 3 more matches
HTML: A good basis for accessibility - Learn web development
heme: the importance of using semantic HTML (sometimes called POSH, or Plain Old Semantic HTML). This means using the correct HTML elements for their intended purpose as much as possible. You might wonder why this is so important. After all, you can use a combination of CSS and JavaScript to make just about any HTML element behave in whatever way you want. ...
...d POSH, or Plain Old Semantic HTML). This means using the correct HTML elements for their intended purpose as much as possible. You might wonder why this is so important. After all, you can use a combination of CSS and JavaScript to make just about any HTML element behave in whatever way you want. ...
... You might wonder why this is so important. After all, you can use a combination of CSS and JavaScript to make just about any HTML element behave in whatever way you want. For example, a control button to play a video on your site could be marked up like this: <div>Play video</div> But as you'll see in greater detail later on, it makes sense to use the correct element for the job: <button>Play video</button> Not only do HTML <button>s have some suitable styling applied by default (which you will probably want to override), they also have built-in keyboard accessibility -- users can navigate between buttons using the Tab key and activate their selection using Return or Enter. Semantic HTML doesn't take any longer to write than non-semantic (bad) markup if you do it consistently from the sta...
...And 2 more matches
HTML: A good basis for accessibility - Learn web development
heme: the importance of using semantic HTML (sometimes called POSH, or Plain Old Semantic HTML). This means using the correct HTML elements for their intended purpose as much as possible. You might wonder why this is so important. After all, you can use a combination of CSS and JavaScript to make just about any HTML element behave in whatever way you want. ...
...d POSH, or Plain Old Semantic HTML). This means using the correct HTML elements for their intended purpose as much as possible. You might wonder why this is so important. After all, you can use a combination of CSS and JavaScript to make just about any HTML element behave in whatever way you want. ...
... You might wonder why this is so important. After all, you can use a combination of CSS and JavaScript to make just about any HTML element behave in whatever way you want. For example, a control button to play a video on your site could be marked up like this: <div>Play video</div> But as you'll see in greater detail later on, it makes sense to use the correct element for the job: <button>Play video</button> Not only do HTML <button>s have some suitable styling applied by default (which you will probably want to override), they also have built-in keyboard accessibility -- users can navigate between buttons using the Tab key and activate their selection using Return or Enter. Semantic HTML doesn't take any longer to write than non-semantic (bad) markup if you do it consistently from the sta...
...And 2 more matches
How much does it cost to do something on the Web? - Learn web development
d projects to standard file formats, but each editor saves ongoing projects in its own specialized format. Most of the images on the internet are copyrighted, so it is better to check the license of the file before you use it. Sites like Pixabay provide images under CC0 license, so you can use, edit and publish them even with modification for commercial use. ...
...rnet are copyrighted, so it is better to check the license of the file before you use it. Sites like Pixabay provide images under CC0 license, so you can use, edit and publish them even with modification for commercial use. Media editors If you want to include video or audio into your website, you can either embed online services (for example YouTube, Vimeo, or Dailymotion), or include your own videos (see below for bandwidth costs). For audio files, you can find free software (Audacity, Wavosaur), or paying up to a few hundred dollars (Sony Sound Forge, Adobe Audition). Likewise, video-editing software can be free (PiTiVi, OpenShot for Linux, iMovie for Mac), less than $100 (Adobe Premiere Elements), or several hundred dollars (Adobe Premiere Pro, Avid Media Composer, Final Cut Pro). The so...
...ess Computer / modem You need a computer. Costs can vary tremendously, depending on your budget, and where you live. To publish a barebones website, you only need a basic computer capable of launching an editor, and a Web browser, so the entry level can be quite low. Of course, you'll need a more serious computer if you want to produce complicated designs, touch up photos, or produce audio and video files. You need to upload content to a remote server (see Hosting below), so you need a modem. Your ISP can rent Internet connectivity to you for a few dollars per month, though your budget might vary, depending on your location. ISP access Make sure that you have sufficient bandwidth: Low-bandwidth access may be adequate to support a 'simple' website: reasonably-sized images, texts, some C...
...And 2 more matches
How do I start to design my website? - Learn web development
it drives everything else. List all the goals you want to reach. It can be anything: selling goods to make money, expressing political opinions, meeting new friends, gigging with musicians, collecting cat pictures, or whatever you want. Suppose you are a musician. You could wish to: Let people hear your music. Sell goodies. Meet other musicians. Talk about your music. Teach music through videos. Publish photos of your cats. Find a new girl/boyfriend. Once you have such a list, you need to prioritize. Order the goals from most important to least important: Find a new girl/boyfriend. Let people hear your music. Talk about your music. Meet other musicians. Sell goodies. Teach music through videos. Publish photos of your cats. Doing this simple exercise--writing goals and so...
...First, some of these items are not web-related (e.g., record music, write articles). Often those offline activities matter even more than the web side of the project.
...First, some of these items are not web-related (e.g., record music, write articles). Often those offline activities matter even more than the web side of the project. In sales, for instance, i...
...And 2 more matches
Aprender y obtener ayuda - Learn web development
th looking at the different types of learning materials that are available, to see which ones are most effective for you to learn with. Textual articles You'll find a lot of written articles on the web to teach you about web design. Like most of this course, for example. ...
...eb, some of which we'll mention below. Note: The above text should have given you an important fact -- you aren't expected to remember everything! Professional web developers use tools like MDN Web Docs to look up things they have forgotten all the time. As you'll discover, learning web development is more about problem-solving and learning patterns than it is about learning lots of syntaxes. Videos There are also a number of sites that have video learning content on them. YouTube is an obvious one, with channels such as Mozilla Layout Land, MozillaDeveloper, and Google ChromeDevelopers providing many useful videos. Many people prefer textual articles for more in-depth learning and reference material, and videos for quick explanations of concepts and new features, but it is really up to yo...
... learn is the art of effective web searches -- what search terms do you need to use in your favorite search engine to find the articles you need? It is often fairly obvious what to search for. For example: If you want to find out more about responsive web design, you could search for "responsive web design". If you want to find out more about a specific technology feature, such as the HTML <video> element, or the CSS background-color or opacity properties, or the JavaScript Date.setTime() method, you should just search for the feature's name. If you are looking for some more specific information, you can add other keywords as modifiers, for example "<video> element autoplay attribute", or "Date.setTime parameters". If you want to search for something that has less obvious buzzwords, yo...
...And 2 more matches
AudioContext.createMediaStreamSource() - Web APIs
Syntax audioSourceNode = audioContext.createMediaStreamSource(stream); Parameters stream A MediaStream to serve as an audio source to be fed into an audio processing graph for use and manipulation. Return value A new MediaStreamAudioSourceNode object representing the audio node whose media is obtained from the specified source stream. ...
...tream); Parameters stream A MediaStream to serve as an audio source to be fed into an audio processing graph for use and manipulation. Return value A new MediaStreamAudioSourceNode object representing the audio node whose media is obtained from the specified source stream. ...
...eam. Example In this example, we grab a media (audio + video) stream from navigator.getUserMedia, feed the media into a <video> element to play then mute the audio, but then also feed the audio into a MediaStreamAudioSourceNode. Next, we feed this source audio into a low pass BiquadFilterNode (which effectively serves as a bass booster), then a AudioDestinationNode. The range slider below the <video> element controls the amount of gain given to the lowpass filter -- increase the value of the slider to make the audio sound more bass heavy! Note: You can see this example running live, or view the source. var pre = document.querySelector('pre'); var video = document.querySelector('video'); var myScript = document.querySelector('script'); var range = document.querySelector('input'); // getU...
...And 2 more matches
AudioTrackList: change event - Web APIs
The change event is fired when an audio track is enabled or disabled, for example by changing the track's enabled property. ...
... The change event is fired when an audio track is enabled or disabled, for example by changing the track's enabled property. ...
... The change event is fired when an audio track is enabled or disabled, for example by changing the track's enabled property. ...
...And 2 more matches
Using images - Web APIs
g a URL. Draw the image on the canvas using the drawImage() function. Let's take a look at how to do this. Getting images to draw The canvas API is able to use any of the following data types as an image source: HTMLImageElement These are images created using the Image() constructor, as well as any <img> element. SVGImageElement These are images embedded using the <image> element. HTMLVideoElement Using an HTML <video> element as your image source grabs the current frame from the video and uses it as an image. HTMLCanvasElement You can use another <canvas> element as your image source. These sources are collectively referred to by the type CanvasImageSource. There are several ways to get images for use on a canvas. Using images from the same page We can obtain a reference to...
... image is available immediately without another round trip to the server. Another potential advantage is that it is also possible to encapsulate in one file all of your CSS, JavaScript, HTML, and images, making it more portable to other locations. Some disadvantages of this method are that your image is not cached, and for larger images the encoded url can become quite long. ...
...t another round trip to the server. Another potential advantage is that it is also possible to encapsulate in one file all of your CSS, JavaScript, HTML, and images, making it more portable to other locations. Some disadvantages of this method are that your image is not cached, and for larger images the encoded url can become quite long. ...
...And 2 more matches
HTMLMediaElement.audioTracks - Web APIs
The returned list is live; that is, as tracks are added to and removed from the media element, the list's contents change dynamically. Once you have a reference to the list, you can monitor it for changes to detect when new audio tracks are added or existing ones removed. ...
...ct representing the list of audio tracks included in the media element. The list of tracks can be accessed using array notation, or using the object's getTrackById() method. Each track is represented by a AudioTrack object which provides information about the track. Examples In this example, all of the audio tracks on a given element are muted. HTML The HTML establishes the element itself. ...
...nting the list of audio tracks included in the media element. The list of tracks can be accessed using array notation, or using the object's getTrackById() method. Each track is represented by a AudioTrack object which provides information about the track. Examples In this example, all of the audio tracks on a given element are muted. HTML The HTML establishes the element itself. ...
...And 2 more matches
HTMLMediaElement.autoplay - Web APIs
oplay property reflects the autoplay HTML attribute, indicating whether playback should automatically begin as soon as enough media is available to do so without interruption. A media element whose source is a MediaStream and whose autoplay property is true will begin playback when it becomes active (that is, when MediaStream.active becomes true). Note: Sites which automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so it 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, autoplay can be useful when creating media elements whose source will be set at a later time, under user control. For a much more in-depth look at autoplay, autoplay bloc...
...lay guide for media and Web Audio APIs. Syntax HTMLMediaElement.autoplay = true | false; var autoplay = HTMLMediaElement.autoplay; Value A Boolean whose value is true if the media element will begin playback as soon as enough content has loaded to allow it to do so without interruption. ...
... value is true if the media element will begin playback as soon as enough content has loaded to allow it to do so without interruption. Note: Some browsers offer users the ability to override autoplay in order to prevent disruptive audio or video from playing without permission or in the background. Do not rely on autoplay actually starting playback and instead use play event. Examples ... ...
...And 2 more matches
HTMLMediaElement: canplaythrough event - Web APIs
terface Event Target Element Default Action None Event handler property GlobalEventHandlers.oncanplaythrough Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's canplaythrough event, then post a message when that event handler has reacted to the event firing. ...
... Element Default Action None Event handler property GlobalEventHandlers.oncanplaythrough Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's canplaythrough event, then post a message when that event handler has reacted to the event firing. ...
...t Default Action None Event handler property GlobalEventHandlers.oncanplaythrough Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's canplaythrough event, then post a message when that event handler has reacted to the event firing. ...
...And 2 more matches
Key Values - Web APIs
alues Note: Remote controls typically include keys whose values are already defined elsewhere, such as under Multimedia keys or Audio control keys. Those keys' values will match what's documented in those tables. KeyboardEvent.key Value Description Virtual Keycode Windows Mac Linux Android "AVRInput" [3] Changes the input mode on an external audio/video receiver (AVR) unit. KEYCODE_AVR_INPUT (182) "AVRPower" [3] Toggles the power on an external AVR unit. KEYCODE_AVR_POWER (181) "ColorF0Red" [3] General-purpose media function key, color-coded red. This has index 0 among the colored keys. VK_COLORED_KEY_0 KEYCODE_PROG_RED (183) "ColorF1Green" [3] General-purpose media ...
...KEY_5 KEYCODE_PROG_BROWN "ClosedCaptionToggle" Toggles closed captioning on and off. VK_CC KEYCODE_CAPTIONS (175) "Dimmer" Adjusts the brightness of the device by toggling between two brightness levels or by cycling among multiple brightness levels. VK_DIMMER GDK_KEY_BrightnessAdjust (0x1008FF3B) "DisplaySwap" Cycles among video sources. VK_DISPLAY_SWAP "DVR" Switches the input source to the Digital Video Recorder (DVR). KEYCODE_DVR (173) "Exit" The Exit button, which exits the curreent application or menu. VK_EXIT Qt::Key_Exit (0x0102000a) "FavoriteClear0" Clears the program or content stored in the first favorites list slot. VK_CLEAR_FAV...
... "ListProgram" Lists the current program. VK_LIST "LiveContent" Toggles a display listing currently available live content or programs. VK_LIVE "Lock" Locks or unlocks the currently selected content or pgoram. VK_LOCK "MediaApps" Presents a list of media applications, such as photo viewers, audio and video players, and games. [1] VK_APPS "MediaAudioTrack" The Audio Track key. GDK_KEY_AudioCycleTrack (0x1008FF9B) Qt::Key_AudioCycleTrack (0x01000106) KEYCODE_MEDIA_AUDIO_TRACK (222) "MediaLast" Jumps back to the last-viewed content, program, or other media. VK_LAST Qt::Key_MediaLast (0x0100FFFF) KEYCODE_LAST_CHANNEL (229) "...
...And 2 more matches
MediaStreamAudioSourceNode - Web APIs
nterface was first introduced into the Web Audio API. As such, you can't easily rely on the order matching between any two browsers or browser versions. This is why it is typically wiser to use MediaStreamTrackAudioSourceNode, which provides similar capabilities but was better-defined upon being added to the specification, so it's more reliable. ...
... can't easily rely on the order matching between any two browsers or browser versions. This is why it is typically wiser to use MediaStreamTrackAudioSourceNode, which provides similar capabilities but was better-defined upon being added to the specification, so it's more reliable. ...
...ble. Example In this example, we grab a media (audio + video) stream from navigator.getUserMedia, feed the media into a <video> element to play then mute the audio, but then also feed the audio into a MediaStreamAudioSourceNode. Next, we feed this source audio into a low pass BiquadFilterNode (which effectively serves as a bass booster), then a AudioDestinationNode. The range slider below the <video> element controls the amount of gain given to the lowpass filter -- increase the value of the slider to make the audio sound more bass heavy! Note: You can see this example running live, or view the source. var pre = document.querySelector('pre'); var video = document.querySelector('video'); var myScript = document.querySelector('script'); var range = document.querySelector('input'); // getU...
...And 2 more matches
MediaStreamTrackAudioSourceNode - Web APIs
structor new MediaStreamTrackAudioSourceNode() Creates a new MediaStreamTrackAudioSourceNode object instance with the specified options. Properties The MediaStreamTrackAudioSourceNode interface has no properties of its own; however, it inherits the properties of its parent, AudioNode. Methods Inherits methods from its parent, AudioNode. ...
...ediaStreamTrackAudioSourceNode object instance with the specified options. Properties The MediaStreamTrackAudioSourceNode interface has no properties of its own; however, it inherits the properties of its parent, AudioNode. Methods Inherits methods from its parent, AudioNode. ...
...ode. Example In this example, we grab a media (audio + video) stream from navigator.getUserMedia, feed the media into a <video> element to play then mute the audio, but then also feed the audio into a MediaStreamAudioSourceNode. Next, we feed this source audio into a low pass BiquadFilterNode (which effectively serves as a bass booster), then a AudioDestinationNode. The range slider below the <video> element controls the amount of gain given to the lowpass filter -- increase the value of the slider to make the audio sound more bass heavy! Note: You can see this example running live, or view the source. var pre = document.querySelector('pre'); var video = document.querySelector('video'); var myScript = document.querySelector('script'); var range = document.querySelector('input'); // getU...
...And 2 more matches
MediaStream Recording API - Web APIs
Stream and delivering it to you for processing. The data is delivered by a series of dataavailable events, already in the format you specify when creating the MediaRecorder. You can then process the data further or write it to file as desired. Overview of the recording process The process of recording a stream is simple: Set up a MediaStream or HTMLMediaElement (in the form of an <audio> or <video> element) to serve as the source of the media data. Create a MediaRecorder object, specifying the source stream and any desired options (such as the container's MIME type or the desired bit rates of its tracks). Set MediaRecorder.ondataavailable to an event handler for the dataavailable event; this will be called whenever data is available for you. Once the source media is playing and you've r...
... data. Create a MediaRecorder object, specifying the source stream and any desired options (such as the container's MIME type or the desired bit rates of its tracks). Set MediaRecorder.ondataavailable to an event handler for the dataavailable event; this will be called whenever data is available for you. Once the source media is playing and you've reached the point where you're ready to record video, call MediaRecorder.start() to begin recording. Your dataavailable event handler gets called every time there's data ready for you to do with as you will; the event has a data attribute whose value is a Blob that contains the media data. You can force a dataavailable event to occur, thereby delivering the latest sound to you so you can filter it, save it, or whatever. Recording stops automatica...
...to the MediaRecorder. You can listen for error events by setting up a onerror event handler. Example here, we use an HTML Canvas as source of the MediaStream, and stop recording after 9 seconds. var canvas = document.querySelector("canvas"); // Optional frames per second argument. var stream = canvas.captureStream(25); var recordedChunks = []; console.log(stream); var options = { mimeType: "video/webm; codecs=vp9" }; mediaRecorder = new MediaRecorder(stream, options); mediaRecorder.ondataavailable = handleDataAvailable; mediaRecorder.start(); function handleDataAvailable(event) { console.log("data-available"); if (event.data.size > 0) { recordedChunks.push(event.data); console.log(recordedChunks); download(); } else { // ... } } function download() { var blob =...
...And 2 more matches
Page Visibility API - Web APIs
g resources and improving performance by letting a page avoid performing unnecessary tasks when the document isn't visible. When the user minimizes the window or switches to another tab, the API sends a visibilitychange event to let listeners know the state of the page has changed. You can detect the event and perform some actions or behave differently. For example, if your web app is playing a video, it can pause the video when the user puts the tab into the background, and resume playback when the user returns to the tab. The user doesn't lose their place in the video, the video's soundtrack doesn't interfere with audio in the new foreground tab, and the user doesn't miss any of the video in the meantime. Visibility states of an <iframe> are the same as the parent document. Hiding an <ifra...
...act while they're hidden. Tabs which are playing audio are considered foreground and aren't throttled. Tabs running code that's using real-time network connections (WebSockets and WebRTC) go unthrottled in order to avoid closing these connections timing out and getting unexpectedly closed. IndexedDB processes are also left unthrottled in order to avoid timeouts. ...
...g audio are considered foreground and aren't throttled. Tabs running code that's using real-time network connections (WebSockets and WebRTC) go unthrottled in order to avoid closing these connections timing out and getting unexpectedly closed. IndexedDB processes are also left unthrottled in order to avoid timeouts. Example View live example (video with sound). ...
...And 2 more matches
RTCOutboundRtpStreamStats - Web APIs
terval A floating-point value indicating the average RTCP interval between two consecutive compound RTCP packets. firCount An integer value which indicates the total number of Full Intra Request (FIR) packets which this RTCRtpSender has sent to the remote RTCRtpReceiver. This is an indicator of how often the stream has lagged, requiring frames to be skipped in order to catch up. Valid only for video streams. framesEncoded The number of frames that have been successfully encoded so far for sending on this RTP stream. Only valid for video streams. lastPacketSentTimestamp A DOMHighResTimeStamp indicating the time at which the last packet was sent for this SSRC. The timestamp property, on the other hand, indicates the time at which the RTCOutboundRtpStreamStats object was generated. nackCou...
...TCRtpReceiver. perDscpPacketsSent A record of key-value pairs with strings as the keys mapped to 32-bit integer values, each indicating the total number of packets this RTCRtpSender has transmitted for this source for each Differentiated Services Code Point (DSCP). pliCount An integer specifying the number of times the remote receiver has notified this RTCRtpSender that some amount of encoded video data for one or more frames has been lost, using Picture Loss Indication (PLI) packets. Only available for video streams. qpSum A 64-bit value containing the sum of the QP values for every frame encoded by this RTCRtpSender. Valid only for video streams. qualityLimitationDurations A record mapping each of the quality limitation reasons in the RTCRemoteInboundRtpStreamStats enumeration to a fl...
...g each of the quality limitation reasons in the RTCRemoteInboundRtpStreamStats enumeration to a floating-point value indicating the number of seconds the stream has spent with its quality limited for that reason. qualityLimitationReason A value from the RTCQualityLimitationReason enumerated type explaining why the resolution and/or frame rate is being limited for this RTP stream. Valid only for video streams. remoteId A string which identifies the RTCRemoteInboundRtpStreamStats object that provides statistics for the remote peer for this same SSRC. This ID is stable across multiple calls to getStats(). retransmittedBytesSent The total number of bytes that have been retransmitted for this source as of the time the statistics were sampled. These retransmitted bytes comprise the packets incl...
...And 2 more matches
RTCPeerConnection.removeStream() - Web APIs
The RTCPeerConnection.removeStream() method removes a MediaStream as a local source of audio or video. If the negotiation already happened, a new one will be needed for the remote peer to be able to use it. Because this method has been deprecated, you should instead use removeTrack() if your target browser versions have implemented it. If the signalingState is set to "closed", an InvalidStateError is raised. If the signalingState is set to "stable", the event negotiationneeded is sent on the RTCPeerConnection. Syntax RTCPeerConnection.removeStream(mediaStream); Parameters mediaStream A MediaStream specifying the stream to remove from the connection. ...
...ions have implemented it. If the signalingState is set to "closed", an InvalidStateError is raised. If the signalingState is set to "stable", the event negotiationneeded is sent on the RTCPeerConnection. ...
...nalingState is set to "closed", an InvalidStateError is raised. If the signalingState is set to "stable", the event negotiationneeded is sent on the RTCPeerConnection. ...
...And 2 more matches
Introduction to Web development - Developer guides
rs for beginners Intermediate CSS concepts -- grouping, pseudo-classes and more. JavaScript Beginning Getting started with JavaScript -- what is JavaScript and how can it help you? JavaScript reference guide -- a comprehensive, regularly updated guide to JavaScript for all levels of learning from beginner to advanced. Crockford on JavaScript -- an in-depth video series on the JavaScript language. Eloquent JavaScript -- a comprehensive guide to intermediate and advanced JavaScript methodologies Intermediate A re-introduction to JavaScript -- a recap on the JavaScript programming language aimed at intermediate-level developers Essential JavaScript design patterns -- an introduction to essential JavaScript design patterns ...
...s Introduction to object-oriented JavaScript -- learn about the JavaScript object model. Christian Heilmann's JavaScript best practices -- learn about some of the obvious and (not so) obvious best practices when writing JavaScript. Advanced Learning advanced JavaScript -- John Resig's guide to advanced JavaScript Crockford on Advanced JavaScript -- a three part video series on advanced JavaScript concepts JavaScript Garden -- Documentation of the most quirky parts of JavaScript. Resources W3C Web Education Community Group Wiki Covers web design, HTML and HTML5, CSS, JavaScript and accessibility. This is a good starting point for beginners wishing to learn web development fundamentals across a number of areas. SitePoi...
...lopment fundamentals across a number of areas. SitePoint A reliable reference site for learning HTML, CSS and JavaScript which also mentions feature support across different browsers and known browser bugs. HTMLDog An excellent and comprehensive reference site on HTML and CSS for beginners. Google's HTML, CSS, and Javascript from the Ground Up These easily digestible video tutorials from Google's expert web developers cover the basics of HTML, CSS and JavaScript. CSSTutorial.net Beginner Tutorials A broad range of useful text and video tutorials that cover the basics through to intermediate aspects of CSS. Tizag CSS Tutorials An easy-to-follow reference for those wishing to learn CSS through short, concise tutorials. jQuery Fundamentals ...
...And 2 more matches
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
Web › HTML › Element › source
It is an empty element, meaning that it has no content and does not have a closing tag. It is commonly used to offer the same media content in multiple file formats in order to provide compatibility with a broad range of browsers given their differing support for image file formats and media file formats. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...itory. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories None. Permitted content None, it is an empty element. Tag omission It must have a start tag, but must not have an end tag. Permitted parents A media element--<audio> or <video>--and it must be placed before any flow content or <track> element. A <picture> element, and it must be placed before the <img> element. Implicit ARIA role No corresponding role Permitted ARIA roles No role permitted DOM interface HTMLSourceElement Attributes This element includes the global attributes. media Media query of the resource's in...
...owser to determine, before laying the page out, which image defined in srcset to use. Please note that sizes will have its effect only if width dimension descriptors are provided with srcset instead of pixel ratio values (200w instead of 2x for example). The sizes attribute has an effect only when the <source> element is the direct child of a <picture> element. src Required for <audio> and <video>, address of the media resource. The value of this attribute is ignored when the <source> element is placed inside a <picture> element. srcset A list of one or more strings separated by commas indicating a set of possible images represented by the source for the browser to use. Each string is composed of: One URL specifying an image. A width descriptor, which consists of a string conta...
...And 2 more matches
HTML: Hypertext Markup Language
Web › HTML
by other people, you become an active participant in the World Wide Web. HTML uses "markup" to annotate text, images, and other content for display in a Web browser. HTML markup includes special "elements" such as <head>, <title>, <body>, <header>, <footer>, <article>, <section>, <p>, <div>, <span>, <img>, <aside>, <audio>, <canvas>, <datalist>, <details>, <embed>, <nav>, <output>, <progress>, <video>, <ul>, <ol>, <li> and many others. An HTML element is set off from other text in a document by "tags", which consist of the element name surrounded by "<" and ">". The name of an element inside a tag is case insensitive. That is, it can be written in uppercase, lowercase, or a mixture. For example, the <title> tag can be written as <Title>, <TITLE>, or in any other way. The articles below can...
...ed. Introduction to HTML This module sets the stage, getting you used to important concepts and syntax such as looking at applying HTML to text, how to create hyperlinks, and how to use HTML to structure a web page. Multimedia and embedding This module explores how to use HTML to include multimedia in your web pages, including the different ways that images can be included, and how to embed video, audio, and even entire other webpages. HTML tables Representing tabular data on a webpage in an understandable, accessible way can be a challenge. This module covers basic table markup, along with more complex features such as implementing captions and summaries. HTML forms Forms are a very important part of the Web -- these provide much of the functionality you need for interacting with web...
...y you need for interacting with websites, e.g. registering and logging in, sending feedback, buying products, and more. This module gets you started with creating the client-side/front-end parts of forms. Use HTML to solve common problems Provides links to sections of content explaining how to use HTML to solve very common problems when creating a web page: dealing with titles, adding images or videos, emphasizing content, creating a basic form, etc. Advanced topics CORS enabled image The crossorigin attribute, in combination with an appropriate CORS header, allows images defined by the <img> element to be loaded from foreign origins and used in a <canvas> element as if they were being loaded from the current origin. CORS settings attributes Some HTML elements that provide support for...
...And 2 more matches
Handling media support issues in web content - Web media technologies
The availability of choices is good for the user, in that they can choose the format that suits their needs best. There is a drawback, however: because there are so many to choose from, with so many different kinds of licenses and design principles involved, each web browser developer is left to its own devices when deciding which media file types and codecs to support. ...
...ide covers techniques you can use to develop web content that meets your media needs while providing the most broadly compatible experience possible. Topics we will examine fallbacks, baseline media formats, and error handling practices that will let your content work in as many situations as possible. Using poster frames A poster frame is a still image that's representative of the content of a video. ...
...web content that meets your media needs while providing the most broadly compatible experience possible. Topics we will examine fallbacks, baseline media formats, and error handling practices that will let your content work in as many situations as possible. Using poster frames A poster frame is a still image that's representative of the content of a video. ...
...And 2 more matches
Index - Archive of obsolete content
In the past, this had to be simulated by treating the raw data as a string and using the charCodeAt() method to read the bytes from the data buffer. 213 Tabbox No su...
...icated, but experience has taught us that this is much better than having separate versions of nanojit. 488 IO Guide/Directory Keys "Directory Keys" are the keys for nsIDirectoryService, see description. The actual keys are: 489 Introducing the Audio API extension Deprecated The Audio Data API extension extends the HTML5 specification of the <audio> and <video> media elements by exposing audio metadata and raw audio data. This enables users to visualize audio data, to process this audio data and to create new audio data. 490 Isp Data Administration, enterprise This page will explain how to create a .rdf or .xml file that you can place in the $INSTALLFOLDER/default/isp to do a variety of things. This page applies to Thunderbird (Mai...
...time. This article provides an overview and some practical examples of using the JavaScript debugger in web applications and web page scripting. This introduction is the first in a series of articles on Venkman and JavaScript debugging. Even if you are already using Venkman, the features, procedures, and tips described here will make you a more confident web developer and debugger. 688 Video presentations Presentations Mozilla is actively working to produce video presentations that can help you learn how the Mozilla codebase works and how to take advantage of its technology in your own applications and extensions. This article is a jumping-off point to help you find those presentations. 689 When To Use ifdefs Developing Mozilla The mozilla codebase is u...
...e same process as the browser, any leaks or crashes in the plugin will affect the entire browser: 3619 NPAPI plugin developer guide Add-ons, Advanced, Guide, Landing, Plug-ins Plugins are shared libraries that users can install to display content that the application itself can't display natively. For example, the Adobe Flash plug-in is used to access Flash content (including videos and certain interactive applications), and the QuickTime and RealPlayer plugins are used to play special format videos in a web page. 3620 NPAPI plugin reference Deprecated, Landing, NPAPI, Plugins, Reference The articles below describe each of the APIs related to NPAPI plugins. 3621 Browser-side plug-in API Landing, Method, NPAPI, Plugins, Reference, Referenc...
Creating hyperlinks - Learn web development
are what makes the Web a web. Hyperlinks allow us to link documents to other documents or resources, link to specific parts of documents, or make apps available at a web address. Almost any web content can be converted to a link so that when clicked or otherwise activated the web browser goes to another web address (URL). Note: A URL can point to HTML files, text files, images, text documents, video and audio files, or anything else that lives on the Web. If the web browser doesn't know how to display or handle the file, it will ask you if you want to open the file (in which case the duty of opening or handling the file is passed to a suitable native app on the device) or download the file (in which case you can try to deal with it later on). For example, the BBC homepage contains a many l...
...lative URL, the browser just looks up the file that's being requested on the same server. If you use absolute URLs where relative URLs would do, you're constantly making your browser do extra work, meaning that it will perform less efficiently. Linking to non-HTML resources -- leave clear signposts When linking to a resource that will be downloaded (like a PDF or Word document), streamed (like video or audio), or has another potentially unexpected effect (opens a popup window, or loads a Flash movie), you should add clear wording to reduce any confusion. For example: If you're on a low bandwidth connection, click a link, and then a multiple megabyte download starts unexpectedly. If you don't have the Flash player installed, click a link, and then suddenly get taken to a page that requir...
... link, and then a multiple megabyte download starts unexpectedly. If you don't have the Flash player installed, click a link, and then suddenly get taken to a page that requires Flash. ...
... starts unexpectedly. If you don't have the Flash player installed, click a link, and then suddenly get taken to a page that requires Flash. Let's look at some examples, to see what kind of text can be used here: <p><a href="http://www.example.com/large-report.pdf"> Download the sales report (PDF, 10MB) </a></p> <p><a href="http://www.example.com/video-stream/" target="_blank"> Watch the video (stream opens in separate tab, HD quality) </a></p> <p><a href="http://www.example.com/car-game"> Play the car game (requires Flash) </a></p> Use the download attribute when linking to a download When you are linking to a resource that's to be downloaded rather than opened in the browser, you can use the download attribute to provide a default save filename. Here's an example with a download...
Mozilla splash page - Learn web development
Previous Overview: Multimedia and embedding In this assessment, we'll test your knowledge of some of the techniques discussed in this module's articles, getting you to add some images and video to a funky splash page all about Mozilla! Prerequisites: Before attempting this assessment you should have already worked through the rest of the Multimedia and embedding module. Objective: To test knowledge around embedding images and video in web pages, frames, and HTML responsive image techniques. Starting point To start off this assessment, you need to grab the HTML and all the images available in the mdn-splash-page-start directory on github. Save the contents of index.html in a file called index.html on your local drive, in a new directory. Then save pattern...
...ed to touch the CSS, just the HTML inside the <body> element -- as long as you insert the correct markup, the styling will make it look correct. Project brief In this assessment we are presenting you with a mostly-finished Mozilla splash page, which aims to say something nice and interesting about what Mozilla stands for, and provide some links to further resources. Unfortunately, no images or video have been added yet -- this is your job! You need to add some media to make the page look nice and make more sense. The following subsections detail what you need to do: Preparing images Using your favourite image editor, create 400px wide and 120px wide versions of: firefox_logo-only_RGB.png firefox-addons.jpg mozilla-dinosaur-head.png Call them something sensible, e.g. firefoxlogo400.p...
...hem. Save a copy of both of these inside the same directory as index.html. Note: You should optimise your JPG and PNG images to make them as small as possible, while still looking ok. tinypng.com is a great service for doing this easily. Adding a logo to the header Inside the <header> element, add an <img> element that will embed the small version of the Firefox logo in the header. Adding a video to the main article content Just inside the <article> element (right below the opening tag), embed the YouTube video found at https://www.youtube.com/watch?v=ojcNcvb1olg, using the appropriate YouTube tools to generate the code. The video should be 400px wide. Adding responsive images to the further info links Inside the <div> with the class of further-info you will find four <a> elements -- e...
...help,. A link to the example you want assessed or need help with, in an online editor. ...
Test your skills: Multimedia and embedding - Learn web development
Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Multimedia and embedding 1 In this task we want you to embed a simple audio file onto the page. You need to: Add the path to the audio file to an appropriate attribute to embed it on the page. ...
... Add an attribute to make browsers display some default controls. Add some appropriate fallback text for browsers that don't support <audio>. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Multimedia and embedding 2 In this task we want you to mark up a slightly more complex video player, with multiple sources, subtitles, and other features besides. You need to: Add an attribute to make browsers display some default controls. Add some appropriate fallback text for browsers that don't support <video>. Add multiple sources, containing the paths to the video files. The files are called video.mp4 and video.webm, and are in a folder inside the current folder called media. ...
...les, and other features besides. You need to: Add an attribute to make browsers display some default controls. Add some appropriate fallback text for browsers that don't support <video>. Add multiple sources, containing the paths to the video files. The files are called video.mp4 and video.webm, and are in a folder inside the current folder called media. Let the browser know in advance what video formats the sources point to, so it can make an informed choice of which one to download ahead of time. Give the <video> a width and height equal to its intrinsic size (320 by 240 pixels). Make the video muted by default. Display the text tracks contained in the media folder, in a file called subtitles_en.vtt, when the video is playing. You must explicitly set the type as subtitles, and the su...
...Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Multimedia and embedding 3 For this final task you have two tasks to do: Embed a PDF into the page. The PDF is called mypdf.pdf, and is contained in the media folder. Go to a sharing site like YouTube or Google Maps, and embed a video or other media item into the page. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these examples in the Interactive Editors above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an...
Introduction to web APIs - Learn web development
s such as rectangles or circles, import an image onto the canvas, and apply a filter to it such as sepia or grayscale using the Canvas API, or create a complex 3D scene with lighting and textures using WebGL. Such APIs are often combined with APIs for creating animation loops (such as window.requestAnimationFrame()) and others to make constantly updating scenes like cartoons and games. ...
...ng and textures using WebGL. Such APIs are often combined with APIs for creating animation loops (such as window.requestAnimationFrame()) and others to make constantly updating scenes like cartoons and games. Audio and Video APIs like HTMLMediaElement, the Web Audio API, and WebRTC allow you to do really interesting things with multimedia such as creating custom UI controls for playing audio and video, displaying text tracks like captions and subtitles along with your videos, grabbing video from your web camera to be manipulated via a canvas (see above) or displayed on someone else's computer in a web conference, or adding effects to audio tracks (such as gain, distortion, panning, etc). Device APIs are basically APIs for manipulating and retrieving data from modern device hardware in a way t...
...uite of APIs enables you to use various parts of the Facebook ecosystem to benefit your app, for example by providing app login using Facebook login, accepting in-app payments, rolling out targetted ad campaigns, etc. The Telegram APIs allows you to embed content from Telegram channels on your website, in addition to providing support for bots. The YouTube API, which allows you to embed YouTube videos on your site, search YouTube, build playlists, and more. The Pinterest API provides tools to manage Pinterest boards and pins to include them in your website. The Twilio API, which provides a framework for building voice and video call functionality into your app, sending SMS/MMS from your apps, and more. The Mastodon API enables you to manipulate features of the Mastodon social network progr...
...do with them in your JavaScript code. ...
HTML performance features - Learn web development
This module intends to walk you through the key HTML performance features that can drastically improve the quality of your webpage. ...
...ance features that can drastically improve the quality of your webpage. Prerequisites: Basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. Objective: To learn about the impact of HTML elements and attributes on web performance optimization. ...
... Responsive images Preloading content with rel="preload" - (https://w3c.github.io/preload/ ) async / defer attributes <iframe> <object> <script> rel attribute Conclusion Previous Overview: Performance Next In this module The "why" of web performance What is web performance? How do users perceive performance? ...
...iew: Performance Next In this module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. ...
Handling common accessibility problems - Learn web development
y think of making sure websites/apps are usable by people with disabilities, for example: Visually impaired people using screen readers or magnification/zoom to access text People with motor function impairments using the keyboard (or other non-mouse features) to activate website functionality. People with hearing impairments relying on captions/subtitles or other text alternatives for audio/video content. However, it is wrong to say that accessibility is just about disabilities. Really, the aim of accessibility is to make your websites/apps usable by as many people in as many contexts as possible, not just those users using high-powered desktop computers. Some examples might include: Users on mobile devices. Users on alternative browsing devices such as TVs, watches, etc. Users of ...
...tool, and should not be removed. Building in keyboard accessibility Sometimes it is not possible to avoid losing keyboard accessibility. You might have inherited a site where the semantics are not very good (perhaps you've ended up with a horrible CMS that generates buttons made with <div>s), or you are using a complex control that does not have keyboard accessibility built in, like the HTML5 <video> element (amazingly, Opera is the only browser that allows you to tab through the <video> element's default browser controls). You have a few options here: Create custom controls using <button> elements (which we can tab to by default!) and JavaScript to wire up their functionality. See Creating a cross-browser video player for some good examples of this. Create keyboard shortcuts via JavaScr...
...that contain relevant content. This should contain a description of the image that successfully conveys its meaning and content on the page, to be picked up by a screenreader and read out to the user. Note: For more information, read Text alternatives. Missing alt text can be tested for in a number of ways, for example using accessibility Auditing tools. Alt text is slightly more complex for video and audio content. There is a way to define text tracks (e.g. subtitles) and display them when video is being played, in the form of the <track> element, and the WebVTT format (see Adding captions and subtitles to HTML5 video for a detailed tutorial). Browser compatibility for these features is fairly good, but if you want to provide text alternatives for audio or support older browsers, a simple...
...- JavaScript should only be used to enhance functionality, not build it in entirely. Good uses of JavaScript include: Providing client-side form validation, which alerts users to problems with their form entries quickly, without having to wait for the server to check the data. If it isn't available, the form will still work, but validation might be slower. Providing custom controls for HTML5 <video>s that are accessible to keyboard-only users (as we said earlier, the default browser controls aren't keyboard-accessible in most browsers). Note: WebAIM's Accessible JavaScript provides some useful further details about considerations for accessible JavaScript. More complex JavaScript implementations can create issues with accessibility -- you need to do what you can. For example, it would ...
Setting up your own test automation environment - Learn web development
Y = '{accessKey}'; // gridUrl: gridUrl can be found at automation dashboard const GRID_HOST = 'hub.lambdatest.com/wd/hub'; function searchTextOnGoogle() { // Setup Input capabilities const capabilities = { platform: 'windows 10', browserName: 'chrome', version: '67.0', resolution: '1280x800', network: true, visual: true, console: true, video: true, name: 'Test 1', // name of the test build: 'NodeJS build' // name of the build }; // URL: https://{username}:{accessToken}@hub.lambdatest.com/wd/hub const gridUrl = 'https://' + USERNAME + ':' + KEY + '@' + GRID_HOST; // setup and build selenium driver object const driver = new webdriver.Builder() .usingServer(gridUrl) .withCapabilities(capabilities) ...
...cute your test: node index.js The test will be sent to LambdaTest, and the output of your test will be reflected on your LambdaTest console. If you wish to extract these results for reporting purpose from LambdaTest platform then you can do so by using LambdaTest restful API. Now if you go to your LambdaTest Automation dashboard, you'll see your test listed; from here you'll be able to see videos, screenshots, and other such data. You can retrieve network, command, exception, and Selenium logs for every test within your test build. You will also find a video recording of your Selenium script execution. Note: The HELP button on LambdaTest Automation Dashboard will provide you with an ample amount of information to help you get started with LambdaTest automation. You can also follow ...
... node bstack_google_test The test will be sent to BrowserStack, and the test result will be returned to your console. This shows the importance of including some kind of result reporting mechanism! Now if you go back to the BrowserStack automation dashboard page, you'll see your test listed: If you click on the link for your test, you'll get to a new screen where you will be able to see a video recording of the test, and multiple detailed logs of information pertaining to it. Note: The Resources menu option on the Browserstack automation dashboard contains a wealth of useful information on using it to run automated tests. See Node JS Documentation for writing automate test scripts in Node JS for the node-specific information. Explore the docs to find out all the useful things BrowserS...
...make sure you keep them secure). Run your test with the following command: node sauce_google_test The test will be sent to Sauce Labs, and the test result will be returned to your console. This shows the importance of including some kind of result reporting mechanism! Now if you go to your Sauce Labs Automated Test dashboard page, you'll see your test listed; from here you'll be able to see videos, screenshots, and other such data. Note: Sauce Labs' Platform Configurator is a useful tool for generating capability objects to feed to your driver instances, based on what browser/OS you want to test on. Note: for more useful details on testing with Sauce Labs and Selenium, check out Getting Started with Selenium for Automated Website Testing, and Instant Selenium Node.js Tests. Fil...
Guide to the Fullscreen API - Web APIs
This article demonstrates how to use the Fullscreen API to place a given element into full-screen mode, as well as how to detect when the browser enters or exits full-screen mode. Activating full-screen mode Given an element that you'd like to present in full-screen mode (such as a <video>, for example), you can present it in full-screen mode by simply calling its requestFullscreen() method. ...
...trates how to use the Fullscreen API to place a given element into full-screen mode, as well as how to detect when the browser enters or exits full-screen mode. Activating full-screen mode Given an element that you'd like to present in full-screen mode (such as a <video>, for example), you can present it in full-screen mode by simply calling its requestFullscreen() method. Let's consider this <video> element: <video controls id="myvideo"> <source src="somevideo.webm"></source> <source src="somevideo.mp4"></source> </video> We can put that video into full-screen mode as follows: var elem = document.getElementById("myvideo"); if (elem.requestFullscreen) { elem.requestFullscreen(); } This code checks for the existence of the requestFullscreen() method before calling it. Presentation...
...lementations at this time: Gecko automatically adds CSS rules to the element to stretch it to fill the screen: "width: 100%; height: 100%". WebKit doesn't do this; instead, it centers the fullscreen element at the same size in a screen that's otherwise black. To get the same fullscreen behavior in WebKit, you need to add your own "width: 100%; height: 100%;" CSS rules to the element yourself: #myvideo:-webkit-full-screen { width: 100%; height: 100%; } On the other hand, if you're trying to emulate WebKit's behavior on Gecko, you need to place the element you want to present inside another element, which you'll make fullscreen instead, and use CSS rules to adjust the inner element to match the appearance you want. Notification When fullscreen mode is successfully engaged, the document w...
... would allow fullscreen mode to be requested. Things your users want to know You'll want to be sure to let your users know that they can press the Esc key (or F11) to exit fullscreen mode. In addition, navigating to another page, changing tabs, or switching to another application (using, for example, Alt-Tab) while in fullscreen mode exits fullscreen mode as well. Example In this example, a video is presented in a web page. Pressing the Return or Enter key lets the user toggle between windowed and fullscreen presentation of the video. View Live Examples Watching for the Enter key When the page is loaded, this code is run to set up an event listener to watch for the Enter key. document.addEventListener("keydown", function(e) { if (e.keyCode == 13) { toggleFullScreen(); } }, fal...
GlobalEventHandlers.onplay - Web APIs
The onplay property of the GlobalEventHandlers mixin is the EventHandler for processing play events. Syntax element.onplay = handlerFunction; var handlerFunction = element.onplay; handlerFunction should be either null or a JavaScript function specifying the handler for the event. ...
... The onplay property of the GlobalEventHandlers mixin is the EventHandler for processing play events. Syntax element.onplay = handlerFunction; var handlerFunction = element.onplay; handlerFunction should be either null or a JavaScript function specifying the handler for the event. ...
...is the EventHandler for processing play events. Syntax element.onplay = handlerFunction; var handlerFunction = element.onplay; handlerFunction should be either null or a JavaScript function specifying the handler for the event. ...
.... Syntax element.onplay = handlerFunction; var handlerFunction = element.onplay; handlerFunction should be either null or a JavaScript function specifying the handler for the event. Example <p>This example demonstrates how to assign an "onplay" event to a video element.</p> <video controls onplay="alertPlay()"> <source src="mov_bbb.mp4" type="video/mp4"> <source src="mov_bbb.ogg" type="video/ogg"> Your browser does not support HTML5 video. </video> <p>Video courtesy of <a href="http://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p> <script> function alertPlay() { alert("The video has started to play."); } </script> Specification Specification Status Comment HTML Living StandardThe definition of 'onplay' in that specification. Living ...
HTMLMediaElement: canplay event - Web APIs
No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.oncanplay Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's canplay event, then post a message when that event handler has reacted to the event firing. ...
... Target Element Default Action None Event handler property GlobalEventHandlers.oncanplay Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's canplay event, then post a message when that event handler has reacted to the event firing. ...
...rget Element Default Action None Event handler property GlobalEventHandlers.oncanplay Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's canplay event, then post a message when that event handler has reacted to the event firing. ...
... handler property GlobalEventHandlers.oncanplay Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's canplay event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('canplay', (event) => { console.log('Video can start, but not sure it will play through.'); }); Using the oncanplay event handler property: const video = document.querySelector('video'); video.oncanplay = (event) => { console.log('Video can start, but not sure it will play through.'); }; Specifications Specification Status HTML Living StandardThe definition of 'canplay media event' in that specification. Liv...
HTMLMediaElement: durationchange event - Web APIs
terface Event Target Element Default Action None Event handler property GlobalEventHandlers.ondurationchange Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's durationchange event, then post a message when that event handler has reacted to the event firing. ...
... Element Default Action None Event handler property GlobalEventHandlers.ondurationchange Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's durationchange event, then post a message when that event handler has reacted to the event firing. ...
...t Default Action None Event handler property GlobalEventHandlers.ondurationchange Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's durationchange event, then post a message when that event handler has reacted to the event firing. ...
... Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's durationchange event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('durationchange', (event) => { console.log('Not sure why, but the duration of the video has changed.'); }); Using the ondurationchange event handler property: const video = document.querySelector('video'); video.ondurationchange = (event) => { console.log('Not sure why, but the duration of the video has changed.'); }; Specifications Specification Status HTML Living StandardThe definition of 'durationchange media event' in that specification. Living Sta...
HTMLMediaElement: loadeddata event - Web APIs
er property GlobalEventHandlers.onloadeddata Specification HTML5 media Note that this event will not fire in mobile/tablet devices if data-saver is on in browser settings. Examples These examples add an event listener for the HTMLMediaElement's loadeddata event, then post a message when that event handler has reacted to the event firing. ...
...rs.onloadeddata Specification HTML5 media Note that this event will not fire in mobile/tablet devices if data-saver is on in browser settings. Examples These examples add an event listener for the HTMLMediaElement's loadeddata event, then post a message when that event handler has reacted to the event firing. ...
...ddata Specification HTML5 media Note that this event will not fire in mobile/tablet devices if data-saver is on in browser settings. Examples These examples add an event listener for the HTMLMediaElement's loadeddata event, then post a message when that event handler has reacted to the event firing. ...
...'s loadeddata event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('loadeddata', (event) => { console.log('Yay! The readyState just increased to ' + 'HAVE_CURRENT_DATA or greater for the first time.'); }); Using the onloadeddata event handler property: const video = document.querySelector('video'); video.onloadeddata = (event) => { console.log('Yay! The readyState just increased to ' + 'HAVE_CURRENT_DATA or greater for the first time.'); }; Specifications Specification Status HTML Living StandardThe definition of 'loadeddata media event' in that specification. Living Standard HTML5The definition of 'loadeddata m...
HTMLMediaElement: playing event - Web APIs
No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onplaying Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's playing event, then post a message when that event handler has reacted to the event firing. ...
... Target Element Default Action None Event handler property GlobalEventHandlers.onplaying Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's playing event, then post a message when that event handler has reacted to the event firing. ...
...rget Element Default Action None Event handler property GlobalEventHandlers.onplaying Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's playing event, then post a message when that event handler has reacted to the event firing. ...
... handler property GlobalEventHandlers.onplaying Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's playing event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('playing', (event) => { console.log('Video is no longer paused'); }); Using the onplaying event handler property: const video = document.querySelector('video'); video.onplaying = (event) => { console.log('Video is no longer paused.'); }; Specifications Specification Status HTML Living StandardThe definition of 'playing media event' in that specification. Living Standard HTML5The definition of 'p...
HTMLMediaElement: ratechange event - Web APIs
Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onratechange Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's ratechange event, then post a message when that event handler has reacted to the event firing. ...
... Target Element Default Action None Event handler property GlobalEventHandlers.onratechange Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's ratechange event, then post a message when that event handler has reacted to the event firing. ...
... Element Default Action None Event handler property GlobalEventHandlers.onratechange Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's ratechange event, then post a message when that event handler has reacted to the event firing. ...
... Examples These examples add an event listener for the HTMLMediaElement's ratechange event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('ratechange', (event) => { console.log('The playback rate changed.'); }); Using the onratechange event handler property: const video = document.querySelector('video'); video.onratechange = (event) => { console.log('The playback rate changed.'); }; Specifications Specification Status HTML Living StandardThe definition of 'ratechange media event' in that specification. Living Standard HTML5The definition of 'ratechange media event' in that specification. Recommendation ...
HTMLMediaElement: seeked event - Web APIs
No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onseeked Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's seeked event, then post a message when that event handler has reacted to the event firing. ...
... Target Element Default Action None Event handler property GlobalEventHandlers.onseeked Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's seeked event, then post a message when that event handler has reacted to the event firing. ...
...Target Element Default Action None Event handler property GlobalEventHandlers.onseeked Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's seeked event, then post a message when that event handler has reacted to the event firing. ...
...ent handler property GlobalEventHandlers.onseeked Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's seeked event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('seeked', (event) => { console.log('Video found the playback position it was looking for.'); }); Using the onseeked event handler property: const video = document.querySelector('video'); video.onseeked = (event) => { console.log('Video found the playback position it was looking for.'); }; Specifications Specification Status HTML Living StandardThe definition of 'seeked media event' in that specification. Li...
HTMLMediaElement: seeking event - Web APIs
No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onseeking Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's seeking event, then post a message when that event handler has reacted to the event firing. ...
... Target Element Default Action None Event handler property GlobalEventHandlers.onseeking Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's seeking event, then post a message when that event handler has reacted to the event firing. ...
...rget Element Default Action None Event handler property GlobalEventHandlers.onseeking Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's seeking event, then post a message when that event handler has reacted to the event firing. ...
... handler property GlobalEventHandlers.onseeking Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's seeking event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('seeking', (event) => { console.log('Video is seeking a new position.'); }); Using the onseeking event handler property: const video = document.querySelector('video'); video.onseeking = (event) => { console.log('Video is seeking a new position.'); }; Specifications Specification Status HTML Living StandardThe definition of 'seeking media event' in that specification. Living Standard HTML5The definit...
HTMLMediaElement: stalled event - Web APIs
No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onstalled Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's stalled event, then post a message when that event handler has reacted to the event firing. ...
... Target Element Default Action None Event handler property GlobalEventHandlers.onstalled Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's stalled event, then post a message when that event handler has reacted to the event firing. ...
...rget Element Default Action None Event handler property GlobalEventHandlers.onstalled Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's stalled event, then post a message when that event handler has reacted to the event firing. ...
... Examples These examples add an event listener for the HTMLMediaElement's stalled event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('stalled', (event) => { console.log('Failed to fetch data, but trying.'); }); Using the onstalled event handler property: const video = document.querySelector('video'); video.onstalled = (event) => { console.log('Failed to fetch data, but trying.'); }; Specifications Specification Status HTML Living StandardThe definition of 'stalled media event' in that specification. Living Standard HTML5The definition of 'stalled media event' in that specification. Recommendation ...
HTMLMediaElement: suspend event - Web APIs
No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onsuspend Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's suspend event, then post a message when that event handler has reacted to the event firing. ...
... Target Element Default Action None Event handler property GlobalEventHandlers.onsuspend Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's suspend event, then post a message when that event handler has reacted to the event firing. ...
...rget Element Default Action None Event handler property GlobalEventHandlers.onsuspend Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's suspend event, then post a message when that event handler has reacted to the event firing. ...
... Examples These examples add an event listener for the HTMLMediaElement's suspend event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('suspend', (event) => { console.log('Data loading has been suspended.'); }); Using the onsuspend event handler property: const video = document.querySelector('video'); video.onsuspend = (event) => { console.log('Data loading has been suspended.'); }; Specifications Specification Status HTML Living StandardThe definition of 'suspend media event' in that specification. Living Standard HTML5The definition of 'suspend media event' in that specification. Recommendation ...
HTMLMediaElement: volumechange event - Web APIs
Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onvolumechange Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's volumechange event, then post a message when that event handler has reacted to the event firing. ...
...rget Element Default Action None Event handler property GlobalEventHandlers.onvolumechange Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's volumechange event, then post a message when that event handler has reacted to the event firing. ...
...ement Default Action None Event handler property GlobalEventHandlers.onvolumechange Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's volumechange event, then post a message when that event handler has reacted to the event firing. ...
... Examples These examples add an event listener for the HTMLMediaElement's volumechange event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('volumechange', (event) => { console.log('The volume changed.'); }); Using the onvolumechange event handler property: const video = document.querySelector('video'); video.onvolumechange = (event) => { console.log('The volume changed.'); }; Specifications Specification Status HTML Living StandardThe definition of 'volumechange media event' in that specification. Living Standard HTML5The definition of 'volumechange media event' in that specification. Recommendation ...
HTMLMediaElement: waiting event - Web APIs
No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onwaiting Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's waiting event, then post a message when that event handler has reacted to the event firing. ...
... Target Element Default Action None Event handler property GlobalEventHandlers.onwaiting Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's waiting event, then post a message when that event handler has reacted to the event firing. ...
...rget Element Default Action None Event handler property GlobalEventHandlers.onwaiting Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's waiting event, then post a message when that event handler has reacted to the event firing. ...
... handler property GlobalEventHandlers.onwaiting Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's waiting event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('waiting', (event) => { console.log('Video is waiting for more data.'); }); Using the onwaiting event handler property: const video = document.querySelector('video'); video.onwaiting = (event) => { console.log('Video is waiting for more data.'); }; Specifications Specification Status HTML Living StandardThe definition of 'waiting media event' in that specification. Living Standard HTML5The defin...
HTMLMediaElement - Web APIs
The HTMLVideoElement and HTMLAudioElement elements both inherit this interface. ...
... The HTMLMediaElement interface adds to HTMLElement the properties and methods needed to support basic media-related capabilities that are common to audio and video. The HTMLVideoElement and HTMLAudioElement elements both inherit this interface. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 30%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 180" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="m...
...LMediaElement.src Is a DOMString that reflects the src HTML attribute, which contains the URL of a media resource to use. HTMLMediaElement.srcObject Is a MediaStream representing the media to play or that has played in the current HTMLMediaElement, or null if not assigned. HTMLMediaElement.textTracks Read only Returns the list of TextTrack objects contained in the element. HTMLMediaElement.videoTracks Read only Returns the list of VideoTrack objects contained in the element. HTMLMediaElement.volume Is a double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). Event handlers HTMLMediaElement.onencrypted Sets the EventHandler called when the media is encrypted. HTMLMediaElement.onwaitingforkey Sets the EventHandler called when playback is blocked while waiting fo...
...dia up to its end without having to stop for further buffering of content. durationchange Fired when the duration attribute has been updated. emptied Fired when the media has become empty; for example, when the media has already been loaded (or partially loaded), and the HTMLMediaElement.load() method is called to reload it. ended Fired when playback stops when end of the media (<audio> or <video>) is reached or because no further data is available. error Fired when the resource could not be loaded due to an error. loadeddata Fired when the first frame of the media has finished loading. loadedmetadata Fired when the metadata has been loaded loadstart Fired when the browser has started to load a resource. pause Fired when a request to pause play is handled and the activity has en...
The HTML DOM API - Web APIs
s any supporting types and interfaces they rely upon. The functional areas included in the HTML DOM API include: Access to and control of HTML elements via the DOM. Access to and manipulation of form data. Interacting with the contents of 2D images and the context of an HTML <canvas>, for example to draw on top of them. Management of media connected to the HTML media elements (<audio> and <video>). Dragging and dropping of content on webpages. Access to the browser navigation history Supporting and connective interfaces for other APIs such as Web Components, Web Storage, Web Workers, WebSocket, and Server-sent events. HTML DOM concepts and usage In this article, we'll focus on the parts of the HTML DOM that involve engaging with HTML elements. Discussion of other areas, such as Dra...
...ing the ability for the element to be contained by another element, and to contain other elements itself. Of special importance is what is gained by inheriting from EventTarget: the ability to receive and handle events such as mouse clicks, play and pause events, and so forth. There are elements that share commonalities and thus have an additional intermediary type. For example, the <audio> and <video> elements both present audiovisual media. The corresponding types, HTMLAudioElement and HTMLVideoElement, are both based upon the common type HTMLMediaElement, which in turn is based upon HTMLElement and so forth. HTMLMediaElement defines the methods and properties held in common between audio and video elements. These element-specific interfaces make up the majority of the HTML DOM API, and are...
...nt HTMLQuoteElement HTMLScriptElement HTMLSelectElement HTMLSlotElement HTMLSourceElement HTMLSpanElement HTMLStyleElement HTMLTableCaptionElement HTMLTableCellElement HTMLTableColElement HTMLTableElement HTMLTableRowElement HTMLTableSectionElement HTMLTemplateElement HTMLTextAreaElement HTMLTimeElement HTMLTitleElement HTMLTrackElement HTMLUListElement HTMLUnknownElement HTMLVideoElement Deprecated HTML Element Interfaces HTMLMarqueeElement Obsolete HTML Element Interfaces HTMLBaseFontElement HTMLFontElement HTMLFrameElement HTMLFrameSetElement HTMLIsIndexElement HTMLMenuItemElement Web app and browser integration interfaces These interfaces offer access to the browser window and document that contain the HTML, as well as to the browser...
...faces represent objects used by the Canvas API as well as the <img> element and <picture> elements. CanvasGradient CanvasPattern CanvasRenderingContext2D ImageBitmap ImageBitmapRenderingContext ImageData OffscreenCanvas OffscreenCanvasRenderingContext2D Path2D TextMetrics Media interfaces The media interfaces provide HTML access to the contents of the media elements: <audio> and <video>. AudioTrack AudioTrackList MediaError TextTrack TextTrackCue TextTrackCueList TextTrackList TimeRanges TrackEvent VideoTrack VideoTrackList Drag and drop interfaces These interfaces are used by the HTML_Drag_and_Drop_API to represent individual draggable (or dragged) items, groups of dragged or draggable items, and to handle the drag and drop process. DataTransfer DataTran...
MediaDevices.getDisplayMedia() - Web APIs
ecorded using the MediaStream Recording API or transmitted as part of a WebRTC session. See Using the Screen Capture API for more details and an example. Syntax var promise = navigator.mediaDevices.getDisplayMedia(constraints); Parameters constraints Optional An optional MediaStreamConstraints object specifying requirements for the returned MediaStream. Since getDisplayMedia() requires a video track, the returned stream will have one even if no video track is expressly requested by the constraints object. Return value A Promise that resolves to a MediaStream containing a video track whose contents come from a user-selected screen area, as well as an optional audio track. Note: Browser support for audio tracks varies, both in terms of whether or not they're supported at all by the ...
... user action, such as an event handler. Another potential cause for this event: the document in whose context getDisplayMedia() was called is not fully active; for example, perhaps it is not the frontmost tab. NotAllowedError Permission to access a screen area was denied by the user, or the current browsing instance is not permitted access to screen sharing. NotFoundError No sources of screen video are available for capture. NotReadableError The user selected a screen, window, tab, or other source of screen data, but a hardware or operating system level error or lockout occurred, preventing the sharing of the selected source. OverconstrainedError After creating the stream, applying the specified constraints fails because no compatible stream could be generated. TypeError The specified...
...what other content might be getting captured and shown to other users. Example In the example below, a startCapture() method is created which initiates screen capture given a set of options specified by the displayMediaOptions parameter. The options are specified in the form of a MediaStreamConstraints object which specifies the preferred stream configuration and the display surface from which video is to be captured. async function startCapture(displayMediaOptions) { let captureStream = null; try { captureStream = await navigator.mediaDevices.getDisplayMedia(displayMediaOptions); } catch(err) { console.error("Error: " + err); } return captureStream; } This uses await to asynchronously wait for getDisplayMedia() to resolve with a MediaStream which contains the display co...
... Specifications Specification Status Comment Screen CaptureThe definition of 'MediaDevices.getDisplayMedia()' in that specification. Working Draft Initial definition ...
MediaRecorder.isTypeSupported - Web APIs
pe) Parameters mimeType The MIME media type to check. Return value true if the MediaRecorder implementation is capable of recording Blob objects for the specified MIME type. Recording may still fail if there are insufficient resources to support the recording and encoding process. If the value is false, the user agent is incapable of recording the specified format. ...
...eck. Return value true if the MediaRecorder implementation is capable of recording Blob objects for the specified MIME type. Recording may still fail if there are insufficient resources to support the recording and encoding process. If the value is false, the user agent is incapable of recording the specified format. ...
...ecorder implementation is capable of recording Blob objects for the specified MIME type. Recording may still fail if there are insufficient resources to support the recording and encoding process. If the value is false, the user agent is incapable of recording the specified format. ...
...rding Blob objects for the specified MIME type. Recording may still fail if there are insufficient resources to support the recording and encoding process. If the value is false, the user agent is incapable of recording the specified format. Example var types = ["video/webm", "audio/webm", "video/webm\;codecs=vp8", "video/webm\;codecs=daala", "video/webm\;codecs=h264", "audio/webm\;codecs=opus", "video/mpeg"]; for (var i in types) { console.log( "Is " + types[i] + " supported? " + (MediaRecorder.isTypeSupported(types[i]) ? "Maybe!" : "Nope :(")); } Specifications Specification Status Comment MediaStream RecordingThe definition of 'isTypeSupported()' in that specification. Working Dra...
MediaStream Image Capture API - Web APIs
The MediaStream Image Capture API is an API for capturing images or videos from a photographic device. In addition to capturing data, it also allows you to retrieve information about device capabilities such as image size, red-eye reduction and whether or not there is a flash and what they are currently set to. Conversely, the API allows the capabilities to be configured within the constraints what the device allows. MediaStream image capture concepts and usage The process of retrieving an image or video stream happens as described below. The example code is adapted from Chrome's Image Capture examples. First, get a reference to a device by calling MediaDevices.getUserMedia(). ...
...ows the capabilities to be configured within the constraints what the device allows. MediaStream image capture concepts and usage The process of retrieving an image or video stream happens as described below. The example code is adapted from Chrome's Image Capture examples. First, get a reference to a device by calling MediaDevices.getUserMedia(). The example below simply says give me whatever video device is available, though the getUserMedia() method allows more specific capabilities to be requested. This method returns a Promise that resolves with a MediaStream object. navigator.mediaDevices.getUserMedia({ video: true }) .then(mediaStream => { // Do something with the stream. }) Next, isolate the visual part of the media stream. Do this by calling MediaStream.getVideoTracks(). ...
...You can do this by calling applyConstraints() on the track object before doing anything else. ...
...not. if(!capabilities.zoom) { return; } track.applyConstraints({ advanced : [{ zoom: zoom.value }] }); Finally, pass the MediaStreamTrack object to the ImageCapture() constructor. Though a MediaStream holds several types of tracks and provides multiple methods for retrieving them, the ImageCapture constructor will throw a DOMException of type NotSupportedError if MediaStreamTrack.kind is not "video". let imageCapture = new ImageCapture(track); Interfaces ImageCapture An interface for capturing images from a photographic device referenced through a valid MediaStreamTrack. PhotoCapabilities Provides available configuration options for an attached photographic device. Retrieve a PhotoCapabilities object by calling ImageCapture.getPhotoCapabilities(). Specifications Specifi...
MediaTrackConstraints.cursor - Web APIs
If needed, you can determine whether or not this constraint is supported by checking the value of MediaTrackSupportedConstraints.cursor as returned by a call to MediaDevices.getSupportedConstraints(). ...
...onstraints.cursor as returned by a call to MediaDevices.getSupportedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. ...
...uld be rendered into the video track in the MediaStream returned by the call to getDisplayMedia(). See How constraints are defined in Capabilities, constraints, and settings for an explanation of how to define constraints. Usage notes You can check the setting selected by the user agent after the display media has been created by getDisplayMedia() by calling getSettings() on the display media's video MediaStreamTrack, then checking the value of the returned MediaTrackSettings object's cursor object. For example, if your app needs to alter the stream by inserting a representation of the cursor position if the stream doesn't include the rendered cursor, you can determine the need to do so by using code like this: let insertFakeCursorFlag = false; if (displayStream.getVideoTracks()[0].getSet...
... example, the cursor property is configured to request that the cursor be visible when in motion, falling back to always being visible if the user agent doesn't support in-motion only cursor rendering. let displayMediaOptions = { cursor: ["motion", "always"] }; Example: Require that the cursor not be visible This constraints object explicitly requires that the cursor not be rendered into the video track. let displayMediaOptions = { cursor: { exact: "none" } }; Specifications Specification Status Comment Screen CaptureThe definition of 'MediaTrackConstraints.cursor' in that specification. Unknown Initial specification. ...
MediaTrackSupportedConstraints.cursor - Web APIs
sor; Value A Boolean value which is true if the cursor constraint is supported by the device and user agent. Example This method sets up the constraints object specifying the options for the call to getDisplayMedia(). It adds the cursor constraint only if it is known to be supported by the browser. ...
...e if the cursor constraint is supported by the device and user agent. Example This method sets up the constraints object specifying the options for the call to getDisplayMedia(). It adds the cursor constraint only if it is known to be supported by the browser. Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem. ...
...getDisplayMedia(). It adds the cursor constraint only if it is known to be supported by the browser. Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem. ...
...ling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem. async function captureWithCursor() { let supportedConstraints = navigator.mediaDevices.getSupportedConstraints(); let displayMediaOptions = { video: { displaySurface: "browser" }, audio: false; }; if (supportedConstraints.cursor) { displayMediaOptions.video.cursor = "always"; } try { videoElem.srcObject = await navigator.mediaDevices.getDisplayMedia(displayMediaOptions); } catch(err) { /* handle the error */ } } Specifications Specification Status Comment Screen CaptureThe definition of 'MediaTrackSupportedConstraints.cursor' in that specification. Unknown Initial definition ...
MediaTrackSupportedConstraints.displaySurface - Web APIs
raint is supported by the device and user agent. Example This method sets up the constraints object specifying the options for the call to getDisplayMedia(). It adds the displaySurface constraint (requesting that only full-screen sharing be allowed) only if it is known to be supported by the browser. ...
... agent. Example This method sets up the constraints object specifying the options for the call to getDisplayMedia(). It adds the displaySurface constraint (requesting that only full-screen sharing be allowed) only if it is known to be supported by the browser. Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem. ...
...aint (requesting that only full-screen sharing be allowed) only if it is known to be supported by the browser. Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem. ...
.... Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem. async function capture() { let supportedConstraints = navigator.mediaDevices.getSupportedConstraints(); let displayMediaOptions = { video: { }, audio: false; }; if (supportedConstraints.displaySurface) { displayMediaOptions.video.displaySurface = "monitor"; } try { videoElem.srcObject = await navigator.mediaDevices.getDisplayMedia(displayMediaOptions); } catch(err) { /* handle the error */ } } Specifications Specification Status Comment Screen CaptureThe definition of 'MediaTrackSupportedConstraints.displaySurface' in that specification. Working Draft Initial definition ...
MediaTrackSupportedConstraints.logicalSurface - Web APIs
ject specifying the options for the call to getDisplayMedia(). It adds the logicalSurface constraint (requesting that only logical display surfaces--those which may not be entirely visible onscreen--be included among the options available to the user) only if it is known to be supported by the browser. ...
...to getDisplayMedia(). It adds the logicalSurface constraint (requesting that only logical display surfaces--those which may not be entirely visible onscreen--be included among the options available to the user) only if it is known to be supported by the browser. Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem. ...
...reen--be included among the options available to the user) only if it is known to be supported by the browser. Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem. ...
.... Capturing is then started by calling getDisplayMedia() and attaching the returned stream to the video element referenced by the variable videoElem. async function capture() { let supportedConstraints = navigator.mediaDevices.getSupportedConstraints(); let displayMediaOptions = { video: { }, audio: false; }; if (supportedConstraints.logicalSurface) { displayMediaOptions.video.logicalSurface = "monitor"; } try { videoElem.srcObject = await navigator.mediaDevices.getDisplayMedia(displayMediaOptions); } catch(err) { /* handle the error */ } } Specifications Specification Status Comment Screen CaptureThe definition of 'MediaTrackSupportedConstraints.logicalSurface' in that specification. Working Draft Initial definition ...
Media Source API - Web APIs
The Media Source API, formally known as Media Source Extensions (MSE), provides functionality enabling plugin-free web-based streaming media. Using MSE, media streams can be created via JavaScript, and played using <audio> and <video> elements. Media Source Extensions concepts and usage Playing video and audio has been available in web applications without plugins for a few years now, but the basic features offered have really only been useful for playing single whole tracks. We can't, for example, combine/split arraybuffers. Streaming media has up until recently been the domain of Flash, with technologies like Flash Media Server serving video streams using the RTMP protocol. The MSE standard With Media Source Extensions (MSE), this is changing. MSE allows us to replace the usual single ...
...ming clients (such as those using DASH or HLS) to be built on its extensible API. Creating assets that work with MSE in modern browsers is a laborious process, taking significant time, computing power, and energy. The usage of external utilities to massage the content into a suitable format is required. While browser support for the various media containers with MSE is spotty, usage of the H.264 video codec, AAC audio codec, and MP4 container format is a common baseline. MSE also provides an API for runtime detection of container and codec support. If you do not require explicit control of video quality over time, the rate at which content is fetched, or the rate at which memory is evicted, then the <video> and <source> tags may well be a simple and adequate solution. DASH Dynamic Adaptive ...
...ng content and preparing it for use with DASH, DASH file servers, and DASH client libraries written in JavaScript. Interfaces MediaSource Represents a media source to be played via an HTMLMediaElement object. SourceBuffer Represents a chunk of media to be passed into an HTMLMediaElement via a MediaSource object. SourceBufferList A simple container list for multiple SourceBuffer objects. VideoPlaybackQuality Contains information about the quality of video being played by a <video> element, such as number of dropped or corrupted frames. Returned by the HTMLVideoElement.getVideoPlaybackQuality() method. TrackDefault Provides a SourceBuffer with kind, label, and language information for tracks that do not contain this information in the initialization segments of a media chunk. TrackD...
... to other interfaces URL.createObjectURL() Creates an object URL pointing to a MediaSource object that can then be specified as the src value of an HTML media element to play a media stream. HTMLMediaElement.seekable When a MediaSource object is played by an HTML media element, this property will return a TimeRanges object that contains the time ranges that the user is able to seek to. HTMLVideoElement.getVideoPlaybackQuality() Returns a VideoPlaybackQuality object for the currently played video. AudioTrack.sourceBuffer, VideoTrack.sourceBuffer, TextTrack.sourceBuffer Returns the SourceBuffer that created the track in question. Specifications Specification Status Comment Media Source Extensions Recommendation Initial definition. ...
RTCInboundRtpStreamStats - Web APIs
so be incremented when FEC packets arrive in-band along with media content; this can happen with Opus, for example. firCount An integer value which indicates the total number of Full Intra Request (FIR) packets which this receiver has sent to the sender. This is an indicator of how often the stream has lagged, requiring frames to be skipped in order to catch up. This value is only available for video streams. framesDecoded A long integer value indicating the total number of frames of video which have been correctly decoded so far for this media source. This is the number of frames that would have been rendered if none were dropped. Only valid for video streams. lastPacketReceivedTimestamp A DOMHighResTimeStamp indicating the time at which the last packet was received for this source. The ...
...sDiscarded. perDscpPacketsReceived A record of key-value pairs with strings as the keys mapped to 32-bit integer values, each indicating the total number of packets this receiver has received on this RTP stream from this source for each Differentiated Services Code Point (DSCP). pliCount An integer specifying the number of times the receiver has notified the sender that some amount of encoded video data for one or more frames has been lost, using Picture Loss Indication (PLI) packets. This is only available for video streams. qpSum A 64-bit value containing the sum of the QP values for every frame decoded by this RTP receiver. You can determine the average QP per frame by dividing this value by framesDecoded. Valid only for video streams. receiverId A string indicating which identifies ...
... been lost, using Picture Loss Indication (PLI) packets. This is only available for video streams. qpSum A 64-bit value containing the sum of the QP values for every frame decoded by this RTP receiver. You can determine the average QP per frame by dividing this value by framesDecoded. Valid only for video streams. receiverId A string indicating which identifies the RTCAudioReceiverStats or RTCVideoReceiverStats object associated with the stream's receiver. This ID is stable across multiple calls to getStats(). remoteId A string which identifies the RTCRemoteOutboundRtpStreamStats object that provides statistics for the remote peer for this same SSRC. This ID is stable across multiple calls to getStats(). sliCount An integer indicating the number of times the receiver sent a Slice Loss I...
...o getStats(). remoteId A string which identifies the RTCRemoteOutboundRtpStreamStats object that provides statistics for the remote peer for this same SSRC. This ID is stable across multiple calls to getStats(). sliCount An integer indicating the number of times the receiver sent a Slice Loss Indication (SLI) frame to the sender to tell it that one or more consecutive (in terms of scan order) video macroblocks have been lost or corrupted. Available only for video streams. trackId A string which identifies the statistics object representing the receiving track; this object is one of two types: RTCReceiverAudioTrackAttachmentStats or RTCReceiverVideoTrackAttachmentStats. This ID is stable across multiple calls to getStats(). Examples Specifications Specification Status ...
RTCPeerConnection.ontrack - Web APIs
u provide that accepts as input a RTCTrackEvent object describing the new track and how it's being used. This information includes the MediaStreamTrack object representing the new track, the RTCRtpReceiver and RTCRtpTransceiver, and a list of MediaStream objects which indicates which stream or streams the track is part of.. ...
...ect describing the new track and how it's being used. This information includes the MediaStreamTrack object representing the new track, the RTCRtpReceiver and RTCRtpTransceiver, and a list of MediaStream objects which indicates which stream or streams the track is part of.. ...
... information includes the MediaStreamTrack object representing the new track, the RTCRtpReceiver and RTCRtpTransceiver, and a list of MediaStream objects which indicates which stream or streams the track is part of.. Example This example, taken from the code for the article Signaling and video calling, connects the incoming track to the <video> element which will be used to display the incoming video. ...
...k, the RTCRtpReceiver and RTCRtpTransceiver, and a list of MediaStream objects which indicates which stream or streams the track is part of.. Example This example, taken from the code for the article Signaling and video calling, connects the incoming track to the <video> element which will be used to display the incoming video. pc.ontrack = function(event) { document.getElementById("received_video").srcObject = event.streams[0]; document.getElementById("hangup-button").disabled = false; }; The first line of our ontrack event handler takes the first stream in the incoming track and sets the srcobject attribute to that. This connects that stream of video to the element so that it begins to be presented to the user. The second line of code simply enables a "hang up" button, which the user...
RTCRtpReceiver.getCapabilities() static function - Web APIs
rs on the current device. You can, similarly, obtain the capabilities of RTCRtpSenders by calling the static function RTCRtpSender.getCapabilities(). Syntax let rtpCapabilities = RTCRtpReceiver.getCapabilities(kind); Parameters kind A DOMString indicating the type of media for which you wish to get the device's capability to receive. All browsers support the primary media kinds: audio and video. Return value An RTCRtpCapabilities object stating what capabilities the browser has for receiving the specified media kind over an RTCPeerConnection. If the browser doesn't have any support for the given media kind, the returned value is null. Description As a static function, this is always called using the form: capabilities = RTCRtpReceiver.getCapabilities("audio"); The returned set of...
...often), the media capabilities can in whole or in part provide a cross-origin method for identifying a user. For that reason, in privacy-sensitive contexts, the browser may choose to obscure the capabilities; this might be done, for example, by leaving out rarely-used codec configurations. ...
...itive contexts, the browser may choose to obscure the capabilities; this might be done, for example, by leaving out rarely-used codec configurations. Example The function below returns a Boolean indicating whether or not the device supports receiving H.264 video on a WebRTC connection. Since RTCRtpReceiver.getCapabilities() actually only indicates probable support, attempting to receive H.264 video might still fail even after getting a positive response from this function. ...
...unction below returns a Boolean indicating whether or not the device supports receiving H.264 video on a WebRTC connection. Since RTCRtpReceiver.getCapabilities() actually only indicates probable support, attempting to receive H.264 video might still fail even after getting a positive response from this function. function canReceiveH264() { let capabilities = RTCRtpReceiver.getCapabilities("video"); capabilities.codecs.forEach((codec) => { if (codec.mimeType === "video/H264") { return true; } }); return false; } Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCRtpReceiver.getCapabilities()' in that specification. Candidate Recommendation ...
RTCRtpStreamStats - Web APIs
n RTCStats, and inherits its properties. In addition, some or all of the following properties are available. Standard fields included for all media types codecId A DOMString which uniquely identifies the object which was inspected to produce the RTCCodecStats object associated with this RTP stream. kind A DOMString whose value is "audio" if the associated MediaStreamTrack is audio-only or "video" if the track contains video. This value will match that of the media type indicated by RTCCodecStats.codec, as well as the track's kind property. Previously called mediaType. ssrc The 32-bit integer which identifies the source of the RTP packets this RTCRtpStreamStats object covers. This value is generated per the RFC 3550 specification. trackId A DOMString which uniquely identifies the RTCM...
... the media stream. Their primary purpose is to examine the error resiliency of the connection, as they provide information about lost packets, lost frames, and how heavily compressed the data is. firCount A count of the total number of Full Intra Request (FIR) packets received by the sender. This statistic is only available to the device which is receiving the stream and is only available for video tracks. A FIR packet is sent by the receiving end of the stream when it falls behind or has lost packets and is unable to continue decoding the stream; the sending end of the stream receives the FIR packet and responds by sending a full frame instead of a delta frame, thereby letting the receiver "catch up." The higher this number is, the more often a problem of this nature arose, which can be a ...
...of times the receiver notified the sender that one or more RTP packets has been lost by sending a Negative ACKnowledgement (NACK, also called "Generic NACK") packet to the sender. This value is only available to the receiver. pliCount The number of times the receiving end of the stream sent a Picture Loss Indiciation (PLI) packet to the sender, indicating that it has lost some amount of encoded video data for one or more frames. Only the receiver has this value, and it's only valid for video tracks. qpSum The sum of the Quantization Parameter (QP) values associated with every frame received to date on the video track described by this RTCRtpStreamStats object. In general, the higher this number is, the more heavily compressed the video track was. Combined with RTCReceivedRtpStreamStats.fram...
...you can approximate the average QP over those frames, keeping in mind that codecs often vary the quantizer values even within frames. Also keep in mind that the values of QP can vary from codec to codec, so this value is only potentially useful when compared against the same codec. sliCount The number of times the receiver notified the sender that one or more consecutive (in scan order) encoded video macroblocks have been lost or corrupted; this notification is sent by the receiver to the sender using a Slice Loss Indication (SLI) packet. This is a fairly technical part of how codecs work and while the higher this value is, the more errors occurred in the stream, generally most of the time this value is only interesting to very intensively hardcore media developers. Specifications ...
RTCTrackEvent - Web APIs
c RTCRtpReceiver (which is specified by the event's receiver property). In addition, the MediaStreamTrack specified by the receiver's track is the same one specified by the event's track, and the track has been added to any associated remote MediaStream objects. You can add a track event listener to be notified when the new track is available so that you can, for example, attach its media to a <video> element, using either RTCPeerConnection.addEventListener() or the ontrack event handler property. Note: It may be helpful to keep in mind that you receive the track event when a new inbound track has been added to your connection, and you call addTrack() to add a track to the far end of the connection, thereby triggering a track event on the remote peer. Example This simple example creates ...
...rack event handler property. Note: It may be helpful to keep in mind that you receive the track event when a new inbound track has been added to your connection, and you call addTrack() to add a track to the far end of the connection, thereby triggering a track event on the remote peer. ...
.... Note: It may be helpful to keep in mind that you receive the track event when a new inbound track has been added to your connection, and you call addTrack() to add a track to the far end of the connection, thereby triggering a track event on the remote peer. ...
...on, and you call addTrack() to add a track to the far end of the connection, thereby triggering a track event on the remote peer. Example This simple example creates an event listener for the track event which sets the srcObject of the <video> element with the ID videobox to the first stream in the list passed in the event's streams array. peerConnection.addEventListener("track", e => { let videoElement = document.getElementById("videobox"); videoElement.srcObject = e.streams[0]; }, false); Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCTrackEvent' in that specification. Candidate Recommendation Initial specification. ...
getTrackById - Web APIs
If no match is found, this method returns null. The tracks are searched in their natural order; that is, in the order defined by the media resource itself, or, if the resource doesn't define an order, the relative order in which the tracks are declared by the media resource. ...
...If no match is found, this method returns null. The tracks are searched in their natural order; that is, in the order defined by the media resource itself, or, if the resource doesn't define an order, the relative order in which the tracks are declared by the media resource. ...
...If no match is found, this method returns null. The tracks are searched in their natural order; that is, in the order defined by the media resource itself, or, if the resource doesn't define an order, the relative order in which the tracks are declared by the media resource. ...
...d string. If no match is found, this method returns null. The tracks are searched in their natural order; that is, in the order defined by the media resource itself, or, if the resource doesn't define an order, the relative order in which the tracks are declared by the media resource. Specifications Specification Status Comment HTML Living StandardThe definition of 'VideoTrackList.getTrackById()' in that specification. Living Standard ...
WebGLRenderingContext.texImage2D() - Web APIs
, width, height, border, format, type, ArrayBufferView? pixels); void gl.texImage2D(target, level, internalformat, format, type, ImageData? pixels); void gl.texImage2D(target, level, internalformat, format, type, HTMLImageElement? pixels); void gl.texImage2D(target, level, internalformat, format, type, HTMLCanvasElement? pixels); void gl.texImage2D(target, level, internalformat, format, type, HTMLVideoElement? pixels); void gl.texImage2D(target, level, internalformat, format, type, ImageBitmap? pixels); // WebGL2: void gl.texImage2D(target, level, internalformat, width, height, border, format, type, GLintptr offset); void gl.texImage2D(target, level, internalformat, width, height, border, format, type, HTMLCanvasElement source); void gl.texImage2D(target, level, internalformat, width, height, ...
...et, level, internalformat, width, height, border, format, type, GLintptr offset); void gl.texImage2D(target, level, internalformat, width, height, border, format, type, HTMLCanvasElement source); void gl.texImage2D(target, level, internalformat, width, height, border, format, type, HTMLImageElement source); void gl.texImage2D(target, level, internalformat, width, height, border, format, type, HTMLVideoElement source); void gl.texImage2D(target, level, internalformat, width, height, border, format, type, ImageBitmap source); void gl.texImage2D(target, level, internalformat, width, height, border, format, type, ImageData source); void gl.texImage2D(target, level, internalformat, width, height, border, format, type, ArrayBufferView srcData, srcOffset); Parameters target A GLenum specifying t...
... gl.RGB: Discards the alpha components and reads the red, green and blue components. gl.RGBA: Red, green, blue and alpha components are read from the color buffer. gl.LUMINANCE: Each color component is a luminance component, alpha is 1.0. gl.LUMINANCE_ALPHA: Each comp...
...is gl.UNSIGNED_BYTE. A Uint16Array must be used if type is either gl.UNSIGNED_SHORT_5_6_5, gl.UNSIGNED_SHORT_4_4_4_4, gl.UNSIGNED_SHORT_5_5_5_1, gl.UNSIGNED_SHORT or ext.HALF_FLOAT_OES. A Uint32Array must be used if type is gl.UNSIGNED_INT or ext.UNSIGNED_INT_24_8_WEBGL. A Float32Array must be used if type is gl.FLOAT. ImageData, HTMLImageElement, HTMLCanvasElement, HTMLVideoElement, ImageBitmap. offset (WebGL 2 only) A GLintptr byte offset into the WebGLBuffer's data store. Used to upload data to the currently bound WebGLTexture from the WebGLBuffer bound to the PIXEL_UNPACK_BUFFER target. Return value None. Examples gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); Specifications Specification Status C...
Compressed texture formats - Web APIs
Textures are uncompressed on the fly when being accessed by a shader. ...
...Textures are uncompressed on the fly when being accessed by a shader. ...
...Textures are uncompressed on the fly when being accessed by a shader. Note that this advantage doesn't translate to network bandwidth: while the formats are better than uncompressed data, they are in general far worse than standard image formats such as PNG and JPG. ...
...gl.COMPRESSED_TEXTURE_FORMATS). (E.g. ext.COMPRESSED_RGBA_S3TC_DXT1_EXT for the WEBGL_compressed_texture_s3tc extension.) These can then be used with compressedTexImage[23]D or compressedTexSubImage[23]D instead of texImage2D calls. Note that WebGL makes no functionality available to compress or decompress textures: they must already be in a compressed format and can then be directly uploaded to video memory. All formats support 2D textures. Which formats support TEXTURE_2D_ARRAY and TEXTURE_3D targets (in combination with compressedTexImage3D) are noted in the following table. Compressed texture extensions and which targets they support. Extension Notes TEXTURE_2D_ARRAY TEXTURE_3D WEBGL_compressed_texture_astc Yes Yes WEBGL_compressed_text...
Web Audio API - Web APIs
audio functions with dynamic effects. Audio nodes are linked into chains and simple webs by their inputs and outputs. They typically start with one or more sources. Sources provide arrays of sound intensities (samples) at very small timeslices, often tens of thousands of them per second. These could be either computed mathematically (such as OscillatorNode), or they can be recordings from sound/video files (like AudioBufferSourceNode and MediaElementAudioSourceNode) and audio streams (MediaStreamAudioSourceNode). In fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave. Outputs of these nodes could be linked to inputs of others, which mix or modify these streams of soun...
...the execution of the audio processing, or decoding. You need to create an AudioContext before you do anything else, as everything happens inside a context. AudioContextOptions The AudioContextOptions dictionary is used to provide options when instantiating a new AudioContext. AudioNode The AudioNode interface represents an audio-processing module like an audio source (e.g. an HTML <audio> or <video> element), audio destination, intermediate processing module (e.g. a filter like BiquadFilterNode, or volume control like GainNode). AudioParam The AudioParam interface represents an audio-related parameter, like one of an AudioNode. It can be set to a specific value or a change in value, and can be scheduled to happen at a specific time and following a specific pattern. AudioParamMap Provide...
...this form, the audio can then be put into an AudioBufferSourceNode. AudioBufferSourceNode The AudioBufferSourceNode interface represents an audio source consisting of in-memory audio data, stored in an AudioBuffer. It is an AudioNode that acts as an audio source. MediaElementAudioSourceNode The MediaElementAudioSourceNode interface represents an audio source consisting of an HTML5 <audio> or <video> element. It is an AudioNode that acts as an audio source. MediaStreamAudioSourceNode The MediaStreamAudioSourceNode interface represents an audio source consisting of a MediaStream (such as a webcam, microphone, or a stream being sent from a remote computer). If multiple audio tracks are present on the stream, the track whose id comes first lexicographically (alphabetically) is used. It is an ...
...The keyboard allows you to switch among the standard waveforms as well as one custom waveform, and you can control the master gain using a volume slider beneath the keyboard. This example makes use of the following Web API interfaces: AudioContext, OscillatorNode, PeriodicWave, and GainNode.Migrating from webkitAudioContextIn this article, we cover the diffe...
Content categories - Developer guides
A few other elements belong to this category, but only if a specific condition is fulfilled: <area>, if it is a descendant of a <map> element <link>, if the itemprop attribute is present <meta>, if the itemprop attribute is present <style>, if the scoped attribute is present Sectioning content Elements belonging to the sectioning content model create a section in the ...
... A few other elements belong to this category, but only if a specific condition is fulfilled: <a>, if it contains only phrasing content <area>, if it is a descendant of a <map> element <del>, if it contains only phrasing content <ins>, if it contains only phrasing content <link>, if the itemprop attribute is present ...
...if the itemprop attribute is present <map>, if it contains only phrasing content <meta>, if the itemprop attribute is present Embedded content Embedded content imports another resource or inserts content from another mark-up language or namespace into the document. Elements that belong to this category include: <audio>, <canvas>, <embed>, <iframe>, <img>, <math>, <object>, <picture>, <svg>, <video>. Interactive content Interactive content includes elements that are specifically designed for user interaction. Elements that belong to this category include: <a>, <button>, <details>, <embed>, <iframe>, <keygen>, <label>, <select>, and <textarea>. Some elements belong to this category only under specific conditions: <audio>, if the controls attribute is present <img>, if the usemap attr...
...details>, <embed>, <iframe>, <keygen>, <label>, <select>, and <textarea>. Some elements belong to this category only under specific conditions: <audio>, if the controls attribute is present <img>, if the usemap attribute is present <input>, if the type attribute is not in the hidden state <menu>, if the type attribute is in the toolbar state <object>, if the usemap attribute is present <video>, if the controls attribute is present Palpable content Content is palpable when it's neither empty or hidden; it is content that is rendered and is substantive. Elements whose model is flow content or phrasing content should have at least one node which is palpable. Form-associated content Form-associated content comprises elements that have a form owner, exposed by a form attribute. A form...
HTML5 - Developer guides
Web › Guide › HTML › HTML5
erous resources about HTML5 technologies, classified into several groups based on their function. Semantics: allowing you to describe more precisely what your content is. Connectivity: allowing you to communicate with the server in new and innovative ways. Offline and storage: allowing webpages to store data on the client-side locally and operate offline more efficiently. Multimedia: making video and audio first-class citizens in the Open Web. 2D/3D graphics and effects: allowing a much more diverse range of presentation options. Performance and integration: providing greater speed optimization and better usage of computer hardware. Device access: allowing for the usage of various input and output devices. Styling: letting authors write more sophisticated themes. Semantics Sect...
...ing greater speed optimization and better usage of computer hardware. Device access: allowing for the usage of various input and output devices. Styling: letting authors write more sophisticated themes. Semantics Sections and outlines in HTML5 A look at the new outlining and sectioning elements in HTML5: <section>, <article>, <nav>, <header>, <footer> and <aside>. Using HTML5 audio and video The <audio> and <video> elements embed and allow the manipulation of new multimedia content. Forms improvements A look at the constraint validation API, several new attributes, new values for the <input> attribute type and the new <output> element. New semantic elements Beside sections, media and forms elements, there are numerous new elements, like <mark>, <figure>, <figcaption>, <data>, <t...
...a permanent connection between the page and the server and to exchange non-HTML data through that means. Server-sent events Allows a server to push events to a client, rather than the classical paradigm where the server could send data only in response to a client's request. WebRTC This technology, where RTC stands for Real-Time Communication, allows connecting to other people and controlling videoconferencing directly in the browser, without the need for a plugin or an external application. Offline & storage Offline resources: The application cache Firefox fully supports the HTML5 offline resource specification. Most others have offline resource support at some level. Online and offline events Firefox 3 supports WHATWG online and offline events, which let applications and extension...
...arches on this data using indexes. Using files from web applications Support for the new HTML5 File API has been added to Gecko, making it possible for web applications to access local files selected by the user. This includes support for selecting multiple files using the <input> of type file HTML element's new multiple attribute. There also is FileReader. Multimedia Using HTML5 audio and video The <audio> and <video> elements embed and allow the manipulation of new multimedia content. WebRTC This technology, where RTC stands for Real-Time Communication, allows connecting to other people and controlling videoconferencing directly in the browser, without the need for a plugin or an external application. Track and WebVTT The <track> element allows subtitles and chapters. WebVTT is a ...
Developer guides
n to help make use of specific web technologies and APIs. HTML learning area HyperText Markup Language (HTML) is the core language of nearly all web content. Most of what you see on screen in your browser is described, fundamentally, using HTML. CSS learning area Cascading Style Sheets (CSS) is a stylesheet language used to define the presentation of a document written in HTML. Audio and video delivery We can deliver audio and video on the web in several ways, ranging from 'static' media files to adaptive live streams. This article is intended as a starting point for exploring the various delivery mechanisms of web-based media and compatibility with popular browsers. Audio and video manipulation The beauty of the web is that you can combine technologies to create new forms. Having n...
...This article provides a reference to explain what you need to do. ...
...This article provides a reference to explain what you need to do. ...
...This article provides a reference to explain what you need to do. Events developer guide Events refer to two things: a design pattern used for the asynchronous handling of various incidents which occur in the lifetime of a web page; and the naming, characterization, and use of a large number of incidents of different types. ...
HTML attribute: accept - HTML: Hypertext Markup Language
It is still possible (in most cases) for users to toggle an option in the file chooser that makes it possible to override this and select any file they wish,...
...It is still possible (in most cases) for users to toggle an option in the file chooser that makes it possible to override this and select any file they wish, and then choose in...
...nt is validated server-side. Examples When set on a file input type, the native file picker that opens up should only enable selecting files of the correct file type. Most operating systems lighten the files that don't match the criteria and aren't selectable. <p> <label for="soundFile">Select an audio file:</label> <input type="file" id="soundFile" accept="audio/*"> </p> <p> <label for="videoFile">Select a video file:</label> <input type="file" id="videoFile" accept="video/*"> </p> <p> <label for="imageFile">Select some images:</label> <input type="file" id="imageFile" accept="image/*" multiple> </p> Note the last example allows you to select multiple iamges. See the multiple attribute for more information. Unique file type specifiers A unique file type specifier is a stri...
...ring that describes a type of file that may be selected by the user in an <input> element of type file. Each unique file type specifier may take one of the following forms: A valid case-insensitive filename extension, starting with a period (".") character. For example: .jpg, .pdf, or .doc. A valid MIME type string, with no extensions. The string audio/* meaning "any audio file". The string video/* meaning "any video file". The string image/* meaning "any image file". The accept attribute takes as its value a string containing one or more of these unique file type specifiers, separated by commas. For example, a file picker that needs content that can be presented as an image, including both standard image formats and PDF files, might look like this: <input type="file" accept="image/*,...
List of default Accept values - HTTP
ccept parameter. ...
...r. ...
...*/* Chrome image/webp,image/apng,image/*,*/*;q=0.8 source Internet Explorer 8 or earlier */* See IE and the Accept Header (IEInternals' MSDN blog) Internet Explorer 9 image/png,image/svg+xml,image/*;q=0.8, */*;q=0.5 See Fiddler is better with Internet Explorer 9 (IEInternals' MSDN blog) Values for a video When a video is requested, via the <video> HTML element, most browsers use specific values. User Agent Value Comment Firefox earlier than 3.6 no support for <video> Firefox 3.6 and later video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5 See bug 489071 source Chrome */* source Internet Explorer 8 or earlier no support for <video> ...
...ug 489071 source Chrome */* source Internet Explorer 8 or earlier no support for <video> Values for audio resources When an audio file is requested, like via the <audio> HTML element, most browsers use specific values. User Agent Value Comment Firefox 3.6 and later audio/webm,audio/ogg,audio/wav,audio/*;q=0.9,application/ogg;q=0.7,video/*;q=0.6,*/*;q=0.5 See bug 489071 source Safari, Chrome */* source Internet Explorer 8 or earlier no support for <audio> Internet Explorer 9 ? Values for scripts When a script is requested, like via the <script> HTML element, some browsers use specific values. User Agent Value Comment Firefox */* See bug 17078...
Web Performance
ve as possible, as soon as possible, while asynchronously loading in the longer tail parts of the experience. There are tools, APIs, and best practices that help us measure and improve web performance. We cover them in this section: Key performance guides Animation performance and frame rateAnimation on the web can be done via SVG, JavaScript, including <canvas> and WebGL, CSS animation, <video>, animated gifs and even animated PNGs and other image types. The performance cost of animating a CSS property can vary from one property to another, and animating expensive CSS properties can result in jank as the browser struggles to hit a smooth frame rate.Critical rendering pathThe Critical Rendering Path is the sequence of steps the browser goes through to convert the HTML, CSS, and JavaScri...
... source order of your mark-up can impact the performance or your website. By minimizing the number of DOM nodes, making sure the best order and attributes are used for including content such as styles, scripts, media, and third-party scripts, you can drastically improve the user experience. This article looks in detail at how HTML can be used to ensure maximum performance. ...
...u can drastically improve the user experience. This article looks in detail at how HTML can be used to ensure maximum performance. Multimedia: images and video The lowest hanging fruit of web performance is often media optimization. Serving different media files based on each user agent's capability, size, and pixel density is possible. Additional tips like removing audio tracks from background videos can improve performance even further. In this article we discuss the impact video, audio, and image content has on performance, and the methods to ensure that impact is as minimal as possible. CSS performance features CSS may be a less important optimization focus for improved performance, but there are some CSS features that impact performance more than others. In this article we look at some...
...LS latency for third parties. Reading performance charts Developer tools provide information on performance, memory, and network requests. Knowing how to read waterfall charts, call trees, traces, flame charts , and allocations in your browser developer tools will help you understand waterfall and flame charts in other performance tools. Alternative media formats When it comes to images and videos, there are more formats than you're likely aware of. Some of these formats can take your highly optimized media-rich pages even further by offering additional reductions in file size. In this guide we'll discuss some alternative media formats, how to use them responsibly so that non-supporting browsers don't get left out in the cold, and some advanced guidance on transcoding your existing assets...
List of Mozilla-Based Applications - Archive of obsolete content
owser for Unix Kirix Strata data browser Kiwix offline version of Wikipedia Kneemail prayer, praise, and journal application Komodo and Komodo Edit and Open Komodo development tools Mozilla-based application (pre-XULRunner style), XUL UI KompoZer wysiwyg HTML editor unofficial bug-fix release of NVu Kylo video browser Uses Gecko BioFortis Labmatrix web-accessible software application used for information management and integration of patient clinical, specimen, genetic and molecular assay data Based on XUL Liaison Groupware client for Novell's email and collaboration server Previously called MozNGW Linbox Kiosk Browser (fr) web browser Dedicated browser f...
...system Makes use of some MPL files such as libsecurity_asn1 Maemo Browser browser for Maemo Internet tablet Development name is MicroB MagooClient business process management tool Uses Mozilla Rhino Mantra security tool McCoy secure update tool for add-ons XULRunner application MediaCoder media converter Transcoder for video, audio, and even devices such as Zen, Zune, PocketPCs, iPods, and PSPs Mekhala browser Part of the KhmerOS Linux distro midbrowser mobile web browser Mockery mockup creation tool Built on XULRunner mongoDB database project Uses SpiderMonkey Moyura email client Part of the KhmerOS Linux distro MozCards, JoliS...
... Other places to find Mozilla applications include: http://www.m...
Common Firefox theme issues and solutions - Archive of obsolete content
area The Responsive design view tool (Tools > Web Developer > Responsive Design View) needs background styling for the unused area of the content window. Debugger Debugger toolbar buttons are missing icons On the Debugger (Tools > Web Developer > Debugger) the toolbar buttons are missing their icons. Miscellaneous issues HTML 5 media controls HTML 5 media controls are not styled The HTML5 video control bar is not styled. Please go to Mozilla's Mission page using both your theme and the default theme and try the video on that page. This issue needs to be corrected in the next version of your theme. HTML 5 media control bar is missing full screen button The fullscreen icon is missing from the HTML5 video control bar. To test this go to Mozilla's Mission page. Warning: If you copy over ...
...o on that page. This issue needs to be corrected in the next version of your theme. HTML 5 media control bar is missing full screen button The fullscreen icon is missing from the HTML5 video control bar. To test this go to Mozilla's Mission page. Warning: If you copy over the Firefox 11 or newer style rules and graphics from the media folder in omni.ja you need to make the following changes in videocontrols.css or the pause and mute buttons will break in Firefox 10. Change the style rules: .playButton[paused] {...} .muteButton[muted] {...} To: .playButton[paused="true"] {...} .muteButton[muted="true"] {...} Error console warnings Unknown namespace for videocontrols.css The error console is reporting the following issue: Warning: Unknown namespace prefix 'html'. Ruleset ignored du...
...refox 10. Change the style rules: .playButton[paused] {...} .muteButton[muted] {...} To: .playButton[paused="true"] {...} .muteButton[muted="true"] {...} Error console warnings Unknown namespace for videocontrols.css The error console is reporting the following issue: Warning: Unknown namespace prefix 'html'. Ruleset ignored due to bad selector. Source file: chrome://global/skin/media/videocontrols.css The solution to this issue is to add the following name space to the second line of the file right after, and in addition to, the existing @namespace: @namespace html url("http://www.w3.org/1999/xhtml"); You can generate the error console message by going to Mozilla's Mission page. If you are using the extension Console2 you can easily filter out content related messages to see jus...
Plug-in Development Overview - Gecko Plugin API Reference
The resource code for this language and character set combination is 040904E4. Unix On Unix, plug-ins are found according to the section How Gecko Finds Plug-ins. To determine the M...
... Note: The resource method described below is deprecated. Plugins should use the Info.plist approach, and only use the following method as a supplement to support older browsers. If neither is present, Gecko will check the plugins resources. 'STR#' 128 should contain a list of MIME types and file extensions in alternating strings. For example: str 128 MIME type String 1 video/quicktime String 2 mov, moov String 3 audio/aiff String 4 aiff String 5 image/jpeg String 6 jpg Several other optional strings may contain useful information about the plug-in. Plug-ins must support 'STR#' 128 but are not required to support any of these others: STR#' 127 can contain a list of MIME type descriptions correspondi...
... String 6 jpg Several other optional strings may contain useful information about the plug-in. Plug-ins must support 'STR#' 128 but are not required to support any of these others: STR#' 127 can contain a list of MIME type descriptions corresponding to the types in 'STR#' 128 . For example, this description list corresponds to the types in the previous example: String 1: "QuickTime Video", String 4: "AIFF Audio", and String 5: "JPEG Image Format." STR#' 126: String 1 can contain a descriptive message about the plug-in. This message, which is in HTML format, is displayed by the browser in its "About Plug-ins" page. String 2 can contain the name of the plug-in, thus allowing the name the user sees to be different from the name of the file on disk. Drawing a Plug-in Instance ...
What is accessibility? - Learn web development
the operating system, like VoiceOver (macOS, iPadOS, iOS), Narrator (Microsoft Windows), ChromeVox (on Chrome OS), and TalkBack (Android). It is a good idea to familiarise yourself with screen readers; you should also set up a screen reader and have a play around with it, to get an idea of how it works. See our cross-browser testing screen readers guide for more details on using them. The below video also provides a brief example of what the experience is like. In terms of statistics, the World Health Organization estimates that "285 million people are estimated to be visually impaired worldwide: 39 million are blind and 246 have low vision." (see Visual impairment and blindness). That's a large and significant population of users to just miss out on because your site isn't coded properly ...
...ing at all. Hearing-impaired people do use ATs (see Assistive Devices for People with Hearing, Voice, Speech, or Language Disorders), but there are not really special ATs specific for computer/web use. There are, however, specific techniques for providing textual alternatives to audio content which range from simple text transcripts to text tracks (i.e. captions) that can be displayed along with video. An article, later on, will discuss these. Hearing-impaired people also represent a significant userbase -- "466 million people worldwide have disabling hearing loss", says the World Health Organization's Deafness and hearing loss fact sheet. People with mobility impairments These people have disabilities concerning movement, which might involve purely physical issues (such as loss of limb or ...
...itions of cognitive impairments, people with them experience a common set of functional problems. These include difficulty with understanding content, remembering how to complete tasks, and confusion caused by inconsistent webpage layouts. ...
How can we design for all types of users? - Learn web development
either to set its width (using the width property) or its maximum width so that it never gets too large (using the max-width property). If you want an elastic/responsive website, and you don't know what the browser's default width is, you can use the max-width property to allow up to 70 characters per line and no more: div.container { max-width:70em; } Alternative content for images, audio, and video Websites often include stuff besides plain text. Images Images can be either decorative or informative, but there's no guarantee that your users can see them. For example, Visually impaired users rely on a screen reader, which can only handle text. Your readers may be using a very strict intranet that blocks images originating from a CDN. Your readers may have disabled images to save band...
...rt with a table providing the same data), or resort to a longdesc attribute. This attribute's value is a URL pointing towards a resource explicitly describing in detail the image's content. Note: the use and even the existence of longdesc has been debated for quite some time. Please refer to the W3C's Image Description Extension (longdesc) for the full explanation and thorough examples. Audio/video You must also provide alternatives to multimedia content. Subtitling/close-captioning You should include captions in your video to cater to visitors who can't hear the audio. Some users have hearing challenges, lack functioning speakers, or work in a noisy environment (like on the train). Transcript Subtitles only work if somebody watches the video. Many users don't have time, or lack the ...
... Image compression Some users may choose to display images, but still have limited bandwidth available, especially in developing countries and on mobile devices. ...
What is accessibility? - Learn web development
imited bandwidth? They'll go somewhere else. In general, we must think about our product from the viewpoints of all our target customers, and adapt accordingly. Hence accessibility. Web accessibility In the specific context of the web, accessibility means that anyone can benefit from your content, regardless of disability, location, technical limitations, or other circumstances. ...
... product from the viewpoints of all our target customers, and adapt accordingly. Hence accessibility. Web accessibility In the specific context of the web, accessibility means that anyone can benefit from your content, regardless of disability, location, technical limitations, or other circumstances. Let's consider video: Hearing impairment How does a hearing-impaired person benefit from a video? You have to provide subtitles --or even better, a full text transcript. Also, make sure people can adjust the volume to accommodate their unique needs. Visual impairment Again, provide a text transcript that a user can consult without needing to play the video, and an audio-description (an off-screen voice that describes what is happening in the video). Pausing capacity Users may have troub...
...s --or even better, a full text transcript. Also, make sure people can adjust the volume to accommodate their unique needs. Visual impairment Again, provide a text transcript that a user can consult without needing to play the video, and an audio-description (an off-screen voice that describes what is happening in the video). Pausing capacity Users may have trouble understanding someone in a video. Let them pause the video to read the subtitles or process the information. Keyboard capacity Let the user tab into/out of a video, play it, and pause it without being trapped in it. The basics of Web accessibility A few necessities for basic Web accessibility include: Whenever your site needs an image to convey meaning, include text as an alternative for visually-challenged users or thos...
Images in HTML - Learn web development
src attribute at an image hosted on someone else's website that you don't have permission to link to. This is called "hotlinking". Again, stealing someone's bandwidth is illegal. It also slows down your page, leaving you with no control over whether the image is removed or replaced with something embarrassing. Our above code would give us the following result: Note: Elements like <img> and <video> are sometimes referred to as replaced elements. This is because the element's content and size are defined by an external resource (like an image or video file), not by the contents of the element itself. Note: You can find the finished example from this section running on Github (see the source code too.) Alternative text The next attribute we'll look at is alt. Its value is supposed to b...
... when the image is gone. Try turning images off in your browser and see how it looks. A figure doesn't have to be an image. It is an independent unit of content that: Expresses your meaning in a compact, easy-to-grasp way. Could go in several places in the page's linear flow. Provides essential information supporting the main text. A figure could be several images, a code snippet, audio, video, equations, a table, or something else. Active learning: creating a figure In this active learning section, we'd like you to take the finished code from the previous active learning section, and turn it into a figure: Wrap it in a <figure> element. Copy the text out of the title attribute, remove the title attribute, and put the text inside a <figcaption> element below the image. If you m...
...ur skills! You've reached the end of this article, but can you remember the most important information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: HTML images. Summary That's all for now. We have covered images and captions in detail. In the next article we'll move it up a gear, looking at how to use HTML to embed video and audio in web pages. Overview: Multimedia and embedding Next In this module Images in HTML Video and audio content From <object> to <iframe> -- other embedding technologies Adding vector graphics to the Web Responsive images Mozilla splash page ...
Multimedia and Embedding - Learn web development
We've looked at a lot of text so far in this course, but the web would be really boring only using text. Let's start looking at how to make the web come alive with more interesting content! This module explores how to use HTML to include multimedia in your web pages, including the different ways that images can be included, and how to embed video, audio, and even entire webpages. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this module, you should have a reasonable understanding of the basics of HTML, as previously covered in Introduction to HTML. If you've not worked through this module (or something similar), work through it first, the...
...hrough all the fundamentals of embedding multimedia on webpages. Images in HTML There are other types of multimedia to consider, but it is logical to start with the humble <img> element used to embed a simple image in a webpage. In this article we'll look at how to use it in more depth, including basics, annotating it with captions using <figure>, and how it relates to CSS background images. Video and audio content Next, we'll look at how to use the HTML5 <video> and <audio> elements to embed video and audio on our pages, including basics, providing access to different file formats to different browsers, adding captions and subtitles, and how to add fallbacks for older browsers. From <object> to <iframe> -- other embedding technologies At this point we'd like to take somewhat of a sidew...
...different devices. ...
What is JavaScript? - Learn web development
avaScript is, what it can do, and how it fits into a web site. A high-level definition JavaScript is a scripting or programming language that allows you to implement complex features on web pages -- every time a web page does more than just sit there and display static information for you to look at -- displaying timely content updates, interactive maps, animated 2D/3D graphics, scrolling video jukeboxes, etc. -- you can bet that JavaScript is probably involved. It is the third layer of the layer cake of standard web technologies, two of which (HTML and CSS) we have covered in much more detail in other parts of the Learning Area. HTML is the markup language that we use to structure and give meaning to our web content, for example defining paragraphs, headings, and data tables, or e...
...you can bet that JavaScript is probably involved. It is the third layer of the layer cake of standard web technologies, two of which (HTML and CSS) we have covered in much more detail in other parts of the Learning Area. HTML is the markup language that we use to structure and give meaning to our web content, for example defining paragraphs, headings, and data tables, or embedding images and videos in the page. CSS is a language of style rules that we use to apply styling to our HTML content, for example setting background colors and fonts, and laying out our content in multiple columns. JavaScript is a scripting language that enables you to create dynamically updating content, control multimedia, animate images, and pretty much everything else. (Okay, not everything, but it is amazing w...
...e saw above in our simple demo) for example, that's the DOM in action. The Geolocation API retrieves geographical information. This is how Google Maps is able to find your location and plot it on a map. The Canvas and WebGL APIs allow you to create animated 2D and 3D graphics. People are doing some amazing things using these web technologies --see Chrome Experiments and webglsamples. Audio and Video APIs like HTMLMediaElement and WebRTC allow you to do really interesting things with multimedia, such as play audio and video right in a web page, or grab video from your web camera and display it on someone else's computer (try our simple Snapshot demo to get the idea). Note: Many of the above demos won't work in an older browser -- when experimenting, it's a good idea to use a modern browser...
Handling common JavaScript problems - Learn web development
ingle line, making it take up far less file size. It is ugly, but you don't need to read it when it is finished! This is best done using a minification tool like Uglify (there's also an online version -- see JSCompress.com) When using APIs, make sure you turn off the API features when they are not being used; some API calls can be really expensive on processing power. For example, when showing a video stream, make sure it is turned off when you can't see it. When tracking a device's location using repeated Geolocation calls, make sure you turn it off when the user stops using it. Animations can be really costly for performance. A lot of JavaScript libraries provide animation capabilities programmed by JavaScript, but it is much more cost effective to do the animations via native browser featu...
... things will be disallowed that would otherwise be acceptable. It is arguably a good idea to use strict mode, as it makes for better, more efficient code, however it has limited/patchy support across browsers (see Strict mode in browsers). Typed arrays allow JavaScript code to access and manipulate raw binary data, which is necessary as browser APIs for example start to manipulate streams of raw video and audio data. These are available in IE10 and above, and all modern browsers. There are also many new APIs appearing in recent browsers, which don't work in older browsers, for example: IndexedDB API, Web Storage API, and others for storing website data on the client-side. Web Workers API for running JavaScript in a separate thread, helping to improve performance. WebGL API for real 3D g...
... many new APIs appearing in recent browsers, which don't work in older browsers, for example: IndexedDB API, Web Storage API, and others for storing website data on the client-side. Web Workers API for running JavaScript in a separate thread, helping to improve performance. WebGL API for real 3D graphics. Web Audio API for advanced audio manipulation. WebRTC API for multi-person, real-time video/audio connectivity (e.g. video conferencing). There are a few strategies for handling incompatibilities between browsers relating to feature support; let's explore the most common ones. Note: These strategies do not exist in separate silos -- you can, of course combine them as needed. For example, you could use feature detection to determine whether a feature is supported; if it isn't, you co...
Embedding API for Accessibility
ndFile); SetCharPref("alert.audio.script_waiting", pathToSoundFile); SetCharPref("alert.audio.redirect_waiting", pathToSoundFile); SetCharPref("alert.audio.refresh_waiting", pathToSoundFile); SetCharPref("alert.audio.plugin_content_waiting", pathToSoundFile); SetCharPref("alert.audio.video_waiting", pathToSoundFile); SetCharPref("alert.audio.audio_waiting", pathToSoundFile); SetCharPref("alert.audio.timed_event_waiting", pathToSoundFile); /* These alerts will also be mirrored visually, either on the status bar or elsewhere */ No Background images ...
...directs", acceptRedirects); No Content refreshes SetBoolPref("browser.accept.refreshes", acceptRefreshes); No Plugin content SetBoolPref("browser.accept.plugin_content.[plugin_name_goes_here]", acceptPluginContent); No Video SetBoolPref("browser.accept.video", acceptVideo); No Audio SetBoolPref("browser.accept.audio", acceptAudio); No Timed events SetBoolPref("browser.accept.timed_events", acceptTimedEvents); No ...
...hoose to load the content. This is a much better alternative than having the user go through a long series of confirm boxes for each new page, for each type of content. For each preference named "browser.accept.*", there is also an "alert.audio.*" preference, to allow configuration of sound files to go with each type of content. The audio file could be a clip of a human voice saying "You've got video" or even a simple beep. How we expose this through the user interface is another matter. Accepting Special Content on an Instance Basis After being notified of special content, the user needs to be able to select specific unloaded content for loading. One way of doing this is to build up the nsIWebBrowserAccessible interface, so that there is a method to force loading each type of content j...
nsIDOMHTMLSourceElement
dom/interfaces/html/nsIDOMHTMLSourceElement.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9.1.2 Inherits from: nsIDOMHTMLElement The source element allows authors to specify multiple media resources for media elements. It does not specify anything on its own. Attributes Attribute Type Description src DOMString The src attribute gives the address of the media resource. The value must be a valid URL. This attribute must be present. ...
...anything on its own. Attributes Attribute Type Description src DOMString The src attribute gives the address of the media resource. The value must be a valid URL. This attribute must be present. Note that dynamically manipulating this value after the page has loaded has no effect on the containing element; instead, change the src attribute of that element (audio or video) instead. type DOMString The type attribute gives the type of the media resource, to help the user agent determine if it can play this media resource before fetching it. If specified, its value must be a valid MIME type. The codecs parameter may be specified and might be necessary to specify exactly how the resource is encoded. media Unimplemented DOMString The media...
...a valid MIME type. The codecs parameter may be specified and might be necessary to specify exactly how the resource is encoded. media Unimplemented DOMString The media attribute gives the intended media type of the media resource, to help the user agent determine if this media resource is useful to the user before fetching it. Its value must be a valid media query. Example <video controls> <source src="foo.webm" type="video/webm; codecs=&quot;vp9, opus&quot;"> Your browser does not support the <code>video</code> element. </video> This example specifies that a video object with playback controls should be drawn, playing the file "foo.ogg". The type is specified as "video/ogg", and the source element also specifies that the video file uses the Dirac and Speex codecs. ...
nsIFeed
See also nsIFeedContainer ...
... See also nsIFeedContainer ...
...ask of values; at some point, the type may include more than one of these values ORed together. Read only. Constants Constant Value Description TYPE_FEED 0 A standard text-based feed. TYPE_AUDIO 1 An audio feed, such as a podcast. TYPE_IMAGE 2 An image feed, such as a photocast. TYPE_VIDEO 4 A video feed, such as a videocast. See also nsIFeedContainer ...
Plug-in Basics - Plugins
ing to text in the page, such as the Adobe Flash plug-in. When Gecko encounters the object or embed element in a document, it attempts to find and display the file represented by the data and src attributes, respectively. The height and width attributes of the object element determine the size of the embedded plug-in in the HTML page. For example, this object element calls a plug-in that displays video: <object data="newave.avi" type="video/avi" width="320" height="200" autostart="true" loop="true"> </object> A hidden plug-in is a type of embedded plug-in that is not drawn on the screen when it is invoked. It is created by using the hidden attribute of the embed element. Here's an example: <embed src="audiplay.aiff" type="audio/x-aiff" hidden="true"> Note: Whether a plug-...
...e private, plug-in-specific attributes and use them in the embed attribute to pass extra information between the HTML page and the plug-in code. The browser ignores these nonstandard attributes when parsing the HTML, but it passes all attributes to the plug-in, allowing the plug-in to examine the list for any private attributes that could modify its behavior. For example, a plug-in that displays video could have private attributes that determine whether to start the plug-in automatically or loop the video automatically on playback, as in the following embed element: <embed src="myavi.avi" width="100" height="125" autostart="true" loop="true"> With this embed element, Gecko passes the values to the plug-in, using the arg parameters of the NPP_New call that creates the plug-in instance. ar...
...ributes as follows: src: Load the data file and determine the MIME type of the data. width and height: Set the area of the page handled by the plug-in to 100 by 125 pixels. autostart and loop: Ignore these private attributes and pass them along to the plug-in with the rest of the attributes. The plug-in must scan its list of attributes to determine whether it should automatically start the video and loop it on playback. Note that with an object element, param values are also sent in this array after the attributes, separated by a param entry. Plug-in references The Mozilla Plug-ins project page << PreviousNext >> ...
Plug-in Development Overview - Plugins
The resource code for this language and character set combination is 040904E4. Unix On Unix, plug-ins are found according to the section How Gecko Finds Plug-ins. To determine the M...
... Note: The resource method described below is deprecated. Plugins should use the Info.plist approach, and only use the following method as a supplement to support older browsers. If neither is present, Gecko will check the plugins resources. 'STR#' 128 should contain a list of MIME types and file extensions in alternating strings. For example: str 128 MIME type String 1 video/quicktime String 2 mov, moov String 3 audio/aiff String 4 aiff String 5 image/jpeg String 6 jpg Several other optional strings may contain useful information about the plug-in. Plug-ins must support 'STR#' 128 but are not required to support any of these others: STR#' 127 can contain a list of MIME type descriptions correspondi...
... String 6 jpg Several other optional strings may contain useful information about the plug-in. Plug-ins must support 'STR#' 128 but are not required to support any of these others: STR#' 127 can contain a list of MIME type descriptions corresponding to the types in 'STR#' 128 . For example, this description list corresponds to the types in the previous example: String 1: "QuickTime Video", String 4: "AIFF Audio", and String 5: "JPEG Image Format." STR#' 126: String 1 can contain a descriptive message about the plug-in. This message, which is in HTML format, is displayed by the browser in its "About Plug-ins" page. String 2 can contain the name of the plug-in, thus allowing the name the user sees to be different from the name of the file on disk. Drawing a Plug-in Instance ...
DocumentOrShadowRoot.fullscreenElement - Web APIs
h this property is read-only, it will not throw if it is modified (even in strict mode); the setter is a no-operation and it will be ignored. Syntax var element = document.fullscreenElement; Return value The Element object that's currently in full-screen mode; if full-screen mode isn't currently in use by the document>, the returned value is null. ...
...nt; Return value The Element object that's currently in full-screen mode; if full-screen mode isn't currently in use by the document>, the returned value is null. ...
...e Element object that's currently in full-screen mode; if full-screen mode isn't currently in use by the document>, the returned value is null. Example This example presents a function, isVideoInFullscreen(), which looks at the value returned by fullscreenElement; if the document is in full-screen mode (fullscreenElement isn't null) and the full-screen element's nodeName is VIDEO, indicating a <video> element, the function returns true, indicating that the video is in full-screen mode. function isVideoInFullscreen() { if (document.fullscreenElement && document.fullscreenElement.nodeName == 'VIDEO') { return true; } return false; } Specifications Specification Status Comment Fullscreen APIThe definition of 'Document.fullscreenElement' in that specificat...
Element.requestFullscreen() - Web APIs
r code has toggled full-screen mode on and off, you should establish listeners for the fullscreenchange event on the Document. It's also important to listen for fullscreenchange to be aware when, for example, the user manually toggles full-screen mode, or when the user switches applications, causing your application to temporarily exit full-screen mode. ...
...portant to listen for fullscreenchange to be aware when, for example, the user manually toggles full-screen mode, or when the user switches applications, causing your application to temporarily exit full-screen mode. Examples This function toggles the first <video> element found in the document into and out of full-screen mode. ...
...We don't need to do anything special if successful, but if the request fails, our promise's catch() handler presents an alert with an appropriate error message. If, on the other hand, full-screen mode is already in effect, we call document.exitFullscreen() to disable full-screen mode. ...
HTMLMediaElement.captureStream() - Web APIs
() property of the HTMLMediaElement interface returns a MediaStream object which is streaming a real-time capture of the content being rendered in the media element. This can be used, for example, as a source for a WebRTC RTCPeerConnection. Syntax var mediaStream = mediaElement.captureStream() Parameters None. ...
... document.querySelector('.playAndRecord').addEventListener('click', function() { var playbackElement = document.getElementById("playback"); var captureStream = playbackElement.captureStream(); playbackElement.play(); }); See Recording a media element for a longer and more intricate example and explanation. ...
...ideo data by other media processing code, or as a source for WebRTC. Example In this example, an event handler is established so that clicking a button starts capturing the contents of a media element with the ID "playback" into a MediaStream. The stream can then be used for other purposes--like a source for streaming over WebRTC, to allow sharing prerecorded videos with another person during a video call. document.querySelector('.playAndRecord').addEventListener('click', function() { var playbackElement = document.getElementById("playback"); var captureStream = playbackElement.captureStream(); playbackElement.play(); }); See Recording a media element for a longer and more intricate example and explanation. Specifications Specification Status Comment Media C...
HTMLMediaElement.playbackRate - Web APIs
ckRate is negative, the media is not played backwards. The audio is muted when the fast forward or slow motion is outside a useful range (for example, Gecko mutes the sound outside the range 0.25 to 5.0). The pitch of the audio is corrected by default and is the same for every speed. Some browsers implement the non-standard HTMLMediaElement.preservesPitch property to control this. ...
... is negative, the media is not played backwards. The audio is muted when the fast forward or slow motion is outside a useful range (for example, Gecko mutes the sound outside the range 0.25 to 5.0). The pitch of the audio is corrected by default and is the same for every speed. Some browsers implement the non-standard HTMLMediaElement.preservesPitch property to control this. ...
...same for every speed. Some browsers implement the non-standard HTMLMediaElement.preservesPitch property to control this. Syntax // video video.playbackRate = 1.5; // audio audio.playbackRate = 1.0; Value A double. 1.0 is "normal speed," values lower than 1.0 make the media play slower than normal, higher values make it play faster. (Default: 1.0) Example var obj = document.createElement('video'); console.log(obj.playbackRate); // Expected Output: 1 Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.playbackRate' in that specification. Living Standard HTML5The definition of 'HTMLMediaElement.playbackRate' in that specification. Recommendation ...
ImageCapture.getPhotoCapabilities() - Web APIs
ple, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoCapabilities() to modify the size of an input range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream. ...
...ample, uses the results from getPhotoCapabilities() to modify the size of an input range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream. ...
... size of an input range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream. ...
ImageCapture.getPhotoSettings() - Web APIs
example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoSettings() to modify the size of an input range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream. ...
...ion Sample, uses the results from getPhotoSettings() to modify the size of an input range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream. ...
...e size of an input range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream. ...
MediaDeviceInfo - Web APIs
Browsing, a different identifier is used that is not persisted across sessions). MediaDeviceInfo.groupIdRead only Returns a DOMString that is a group identifier. Two devices have the same group identifier if they belong to the same physical device -- for example a monitor with both a built-in camera and a microphone. MediaDeviceInfo.kindRead only Returns an enumerated value that is either "videoinput", "audioinput" or "audiooutput". MediaDeviceInfo.labelRead only Returns a DOMString that is a label describing this device (for example "External USB Webcam"). For security reasons, the label field is always blank unless an active media stream exists or the user has granted persistent permission for media device access. The set of device labels could otherwise be used as part of a fing...
...ole.log("enumerateDevices() not supported."); return; } // List cameras and microphones. ...
...ice.deviceId); }); }) .catch(function(err) { console.log(err.name + ": " + err.message); }); This might produce: videoinput: id = csO9c0YpAf274OuCPUA53CNE0YHlIr2yXCi+SqfBZZ8= audioinput: id = RKxXByjnabbADGQNNZqLVLdmXlS0YkETYCIbg+XxnvM= audioinput: id = r2/xw1xUPIyZunfV1lGrKOma5wTOvCkWfZ368XCndm0= or if one or more media streams are active, or if persistent permissions have been granted: videoinput: FaceTime HD Camera (Built-in) id=csO9c0YpAf274OuCPUA53CNE0YHlIr2yXCi+SqfBZZ8= audioinput: default (Built-in Microphone) id=RKxXByjnabbADGQNNZqLVLdmXlS0YkETYCIbg+XxnvM= audioinput: Built-in Microphone id=r2/xw1xUPIyZunfV1lGrKOma5wTOvCkWfZ368XCndm0= Specifications Specification Status Comment Media Capture and StreamsThe definition of 'MediaDevicesInfo' in that spec...
MediaSettingsRange - Web APIs
.step Returns the minimum difference between consecutive values of this setting. Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoCapabilities().imageWidth to modify the size of an input range. ...
...s of this setting. Example The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoCapabilities().imageWidth to modify the size of an input range. ...
...d from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoCapabilities().imageWidth to modify the size of an input range. ...
MediaSource.MediaSource() - Web APIs
The MediaSource() constructor of the MediaSource interface constructs and returns a new MediaSource object with no associated source buffers. Syntax var mediaSource = new MediaSource(); Parameters None. ...
...rce() constructor of the MediaSource interface constructs and returns a new MediaSource object with no associated source buffers. Syntax var mediaSource = new MediaSource(); Parameters None. ...
...rce = new MediaSource(); Parameters None. Example The following snippet is taken from a simple example written by Nick Desaulniers (view the full demo live, or download the source for further investigation.) var video = document.querySelector('video'); var assetURL = 'frag_bunny.mp4'; // Need to be specific for Blink regarding codecs // ./mp4info frag_bunny.mp4 | grep Codec var mimeCodec = 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'; if ('MediaSource' in window && MediaSource.isTypeSupported(mimeCodec)) { var mediaSource = new MediaSource; //console.log(mediaSource.readyState); // closed video.src = URL.createObjectURL(mediaSource); mediaSource.addEventListener('sourceopen', sourceOpen); } else { console.error('Unsupported MIME type or codec: ', mimeCodec); } ... ...
MediaSource.activeSourceBuffers - Web APIs
Syntax var myActiveSourceBuffers = mediaSource.activeSourceBuffers; Value A SourceBufferList containing the SourceBuffer objects for each of the active tracks. ...
... Specifications Specification Status Comment Media Source ExtensionsThe definition of 'activeSourceBuffers' in that specification. Recommendation Initial definition. ...
... Specifications Specification Status Comment Media Source ExtensionsThe definition of 'activeSourceBuffers' in that specification. Recommendation Initial definition. ...
MediaSource.addSourceBuffer() - Web APIs
Buffer using the given mimeType would result in an unsupported configuration of SourceBuffers. ...
... download the source for further investigation.) var assetURL = 'frag_bunny.mp4'; // Need to be specific for Blink regarding codecs // ./mp4info frag_bunny.mp4 | grep Codec var mimeCodec = 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'; if ('MediaSource' in window && MediaSource.isTypeSupported(mimeCodec)) { var mediaSource = new MediaSource; //console.log(mediaSource.readyState); // closed video.src = URL.createObjectURL(mediaSource); mediaSource.addEventListener('sourceopen', sourceOpen); } else { console.error('Unsupported MIME type or codec: ', mimeCodec); } function sourceOpen (_) { //console.log(this.readyState); // open var mediaSource = this; var sourceBuffer = mediaSource.addSourceBuffer(mimeCodec); fetchAB(assetURL, function (buf) { sourceBuffer.addEventListener...
... Recommendation Initial definition. ...
MediaSource.endOfStream() - Web APIs
urce.sourceBuffers are being updated (i.e. ...
... download the source for further investigation.) var assetURL = 'frag_bunny.mp4'; // Need to be specific for Blink regarding codecs // ./mp4info frag_bunny.mp4 | grep Codec var mimeCodec = 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'; if ('MediaSource' in window && MediaSource.isTypeSupported(mimeCodec)) { var mediaSource = new MediaSource; //console.log(mediaSource.readyState); // closed video.src = URL.createObjectURL(mediaSource); mediaSource.addEventListener('sourceopen', sourceOpen); } else { console.error('Unsupported MIME type or codec: ', mimeCodec); } function sourceOpen (_) { //console.log(this.readyState); // open var mediaSource = this; var sourceBuffer = mediaSource.addSourceBuffer(mimeCodec); fetchAB(assetURL, function (buf) { sourceBuffer.addEventListener...
... Recommendation Initial definition. ...
MediaSource.isTypeSupported() - Web APIs
tle variations to be absolutely certain of anything until you actually use the contents of the media. ...
... download the source for further investigation.) var assetURL = 'frag_bunny.mp4'; // Need to be specific for Blink regarding codecs // ./mp4info frag_bunny.mp4 | grep Codec var mimeCodec = 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'; if ('MediaSource' in window && MediaSource.isTypeSupported(mimeCodec)) { var mediaSource = new MediaSource; //console.log(mediaSource.readyState); // closed video.src = URL.createObjectURL(mediaSource); mediaSource.addEventListener('sourceopen', sourceOpen); } else { console.error('Unsupported MIME type or codec: ', mimeCodec); } function sourceOpen (_) { //console.log(this.readyState); // open var mediaSource = this; var sourceBuffer = mediaSource.addSourceBuffer(mimeCodec); fetchAB(assetURL, function (buf) { sourceBuffer.addEventListener...
... Recommendation Initial definition. ...
MediaStream.getAudioTracks() - Web APIs
e returned tracks is not defined by the specification and may, in fact, change from one call to getAudioTracks() to the next. Early versions of this API included a special AudioStreamTrack interface which was used as the type for each entry in the list of audio streams; however, this has since been merged into the main MediaStreamTrack interface. ...
...fact, change from one call to getAudioTracks() to the next. Early versions of this API included a special AudioStreamTrack interface which was used as the type for each entry in the list of audio streams; however, this has since been merged into the main MediaStreamTrack interface. ...
...pe for each entry in the list of audio streams; however, this has since been merged into the main MediaStreamTrack interface. Example This example gets a webcam's audio and video in a stream using getUserMedia(), attaches the stream to a <video> element, then sets a timer that, upon expiring, will stop the first audio track found on the stream. navigator.mediaDevices.getUserMedia({audio: true, video: true}) .then(mediaStream => { document.querySelector('video').srcObject = mediaStream; // Stop the audio stream after 5 seconds setTimeout(() => { const tracks = mediaStream.getAudioTracks() tracks[0].stop() }, 5000) }) Specifications Specification Status Comment Media Capture and StreamsThe definition of 'getAudioTracks()' in that specification. ...
MediaStreamTrack - Web APIs
Properties In addition to the properties listed below, MediaStreamTrack has constrainable properties which can be set using applyConstraints() and accessed using getConstraints() and getSettings(). See Capabilities, constraints, and settings to learn how to correctly work with constrainable properties. Not doing so correctly will result in your code being unreliable. ...
... MediaStreamTrack.isolated Read only Returns a Boolean value which is true if the track is isolated; that is, the track cannot be accessed by the document that owns the MediaStreamTrack. This happens when the peerIdentity property is set, or if the track comes from a cross-origin source. MediaStreamTrack.kind Read only Returns a DOMString set to "audio" if the track is an audio track and to "video", if it is a video track. It doesn't change if the track is deassociated from its source. MediaStreamTrack.label Read only Returns a DOMString containing a user agent-assigned label that identifies the track source, as in "internal microphone". The string may be left empty and is empty as long as no source has been connected. When the track is deassociated from its source, the label is not cha...
...aStreamTrack.muted Read only Returns a Boolean value indicating whether the track is unable to provide media data due to a technical issue. Note: You can implement standard "mute" functionality by setting enabled to false, and unmute the media by setting it back to true again. MediaStreamTrack.readonly Read only Returns a Boolean value with a value of true if the track is readonly (such a video file source or a camera that settings can't be modified), false otherwise. MediaStreamTrack.readyState Read only Returns an enumerated value giving the status of the track. This will be one of the following values: "live" which indicates that an input is connected and does its best-effort in providing real-time data. In that case, the output of data can be switched on or off using the enab...
MediaTrackSettings.displaySurface - Web APIs
The MediaTrackSettings dictionary's displaySurface property indicates the type of display surface being captured. Syntax displaySurface = mediaTrackSettings.displaySurface; Value The value of displaySurface is a string that comes from the DisplayCaptureSurfaceType enumerated type, and is one of the following: application The stream's video track contains all of the windows belonging to the application chosen by the user. ...
...type of display surface being captured. Syntax displaySurface = mediaTrackSettings.displaySurface; Value The value of displaySurface is a string that comes from the DisplayCaptureSurfaceType enumerated type, and is one of the following: application The stream's video track contains all of the windows belonging to the application chosen by the user. The windows are aggragated into a single video track, with any empty space filled with a backdrop; that backdrop is selected by the user agent. browser The stream's video track presents the entire contents of a single browser tab which the user selected during the getDisplayMedia() call. monitor The video track in the stream presents the complete contents of one or more of the user's screens. Any empty space (if the displays are of differ...
...The window may be from any application, not necessarily just from within the user agent. Not all user agents support all of these surface types. ...
MediaTrackSettings.facingMode - Web APIs
This lets you determine what value was selected to comply with your specified constraints for this property's value as described in the MediaTrackConstraints.facingMode property you provided when calling either getUserMedia() or MediaStreamTrack.applyConstraints(). If needed, you can determine whether or not this constraint is supported by checking the value of MediaTrackSupportedConstraints.facingMode as returned by a call to MediaDevices.getSupportedConstraints(). ...
...MediaDevices.getSupportedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Because RTP doesn't include this information, tracks associated with a WebRTC RTCPeerConnection will never include this property. Syntax var facingMode = MediaTrackSettings.facingMode; Value A DOMString whose value is one of the strings in VideoFacingModeEnum. VideoFacingModeEnum The following strings are permitted values for the facing mode. These may represent separate cameras, or they may represent directions in which an adjustable camera can be pointed. "user" The video source is facing toward the user; this includes, for example, the front-facing camera on a smartphone. "environment" The video source is facing away from the ...
... mode. These may represent separate cameras, or they may represent directions in which an adjustable camera can be pointed. "user" The video source is facing toward the user; this includes, for example, the front-facing camera on a smartphone. "environment" The video source is facing away from the user, thereby viewing their environment. This is the back camera on a smartphone. "left" The video source is facing toward the user but to their left, such as a camera aimed toward the user but over their left shoulder. "right" The video source is facing toward the user but to their right, such as a camera aimed toward the user but over their right shoulder. Example See Example: Constraint exerciser in Capabilities, constraints, and settings for an example. Specifications Speci...
Media Capture and Streams API (Media Stream) - Web APIs
The Media Capture and Streams API, often called the Media Streams API or simply MediaStream API, is an API related to WebRTC which provides support for streaming audio and video data. It provides the interfaces and methods for working with the streams and their constituent tracks, the constraints associated with data formats, the success and error callbacks when using the data asynchronously, and the events that are fired during the process. Concepts and usage The API is based on the manipulation of a MediaStream object representing a flux of audio- or video-related data. See an example in Get the video. A MediaStream consists of zero or more MediaStreamTrack objects, representing various audio or video tracks. Each MediaStreamTrack may have one or more channels. The channel represents the ...
...allest unit of a media stream, such as an audio signal associated with a given speaker, like left or right in a stereo audio track. MediaStream objects have a single input and a single output. A MediaStream object generated by getUserMedia() is called local, and has as its source input one of the user's cameras or microphones. A non-local MediaStream may be representing to a media element, like <video> or <audio>, a stream originating over the network, and obtained via the WebRTC RTCPeerConnection API, or a stream created using the Web Audio API MediaStreamAudioSourceNode. The output of the MediaStream object is linked to a consumer. It can be a media elements, like <audio> or <video>, the WebRTC RTCPeerConnection API or a Web Audio API MediaStreamAudioSourceNode. Interfaces In these refere...
...These no longer exist, and you should update any existing code to instead use MediaStreamTrack directly. Events addtrack ended muted overconstrained removetrack started unmuted Guides and tutorials The articles below provide additional guidance and how-to information that will help yo...
msPlayToSource - Web APIs
entations and the behavior may change in the future. msPlayToSource is a read-only property which gets the source associated with the media element for use by the PlayToManager. This proprietary property is specific to Internet Explorer and Microsoft Edge. Syntax ptr = object.msPlayToSource; Value PlayTo is a means through which an app can connect local playback/display for audio, video, and img elements to a remote device. For more information, see the Windows.Media.PlayTo APIs. msPlayToSource is used in the sourceRequested handler -- get the PlayToSource object from an audio, video, or img element using the msPlayToSource property and pass it to e.setSource, then set the PlayToSource.next property to the msPlayToSource of another element for continual playing. The property v...
...layTo APIs. msPlayToSource is used in the sourceRequested handler -- get the PlayToSource object from an audio, video, or img element using the msPlayToSource property and pass it to e.setSource, then set the PlayToSource.next property to the msPlayToSource of another element for continual playing. The property value for msPlayToSource is the source associated with the media element. Example <video id="videoplayer" src="http://www.contoso.com/clip.mp4" controls autoplay /> <script type="text/javascript"> // Step 1: Obtain PlayToManager object for app's current view. var ptm = Windows.Media.PlayTo.PlayToManager.getForCurrentView(); // Step 2: Register for the sourcerequested event (user swipes Devices charm). ptm.addEventListener("sourcerequested", function(e) { // Step 3: S...
...// Step 1: Obtain PlayToManager object for app's current view. var ptm = Windows.Media.PlayTo.PlayToManager.getForCurrentView(); // Step 2: Register for the sourcerequested event (user swipes Devices charm). ptm.addEventListener("sourcerequested", function(e) { // Step 3: Specify the media to be streamed (to filter devices). e.sourceRequest.setSource(document.getElementById("videoplayer").msPlayToSource); // The media will then be streamed to the device chosen by the user in the UI. }); ...
Network Information API - Web APIs
om " + type + " to " + connection.effectiveType); type = connection.effectiveType; } connection.addEventListener('change', updateConnectionStatus); Preload large resources The connection object is useful for deciding whether to preload resources that take large amounts of bandwidth or memory. This example would be called soon after page load to check for a connection type where preloading a video may not be desirable. If a cellular connection is found, then the preloadVideo flag is set to false. For simplicity and clarity, this example only tests for one connection type. A real-world use case would likely use a switch statement or some other method to check all of the possible values of NetworkInformation.type. Regardless of the type value you can get an estimate of connection speed throu...
... the preloadVideo flag is set to false. For simplicity and clarity, this example only tests for one connection type. A real-world use case would likely use a switch statement or some other method to check all of the possible values of NetworkInformation.type. Regardless of the type value you can get an estimate of connection speed through the NetworkInformation.effectiveType property. ...
...r method to check all of the possible values of NetworkInformation.type. Regardless of the type value you can get an estimate of connection speed through the NetworkInformation.effectiveType property. let preloadVideo = true; var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection; if (connection) { if (connection.effectiveType === 'slow-2g') { preloadVideo = false; } } Interfaces NetworkInformation Provides information about the connection a device is using to communicate with the network and provides a means for scripts to be notified if the connection type changes. The NetworkInformation interfaces cannot be instantiated. It is instead accessed through the Navigator interface. Specifications Specification Status Comment ...
PhotoCapabilities - Web APIs
ple, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoCapabilities() to modify the size of an input range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream. ...
...ample, uses the results from getPhotoCapabilities() to modify the size of an input range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream. ...
... size of an input range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream. ...
RTCInboundRtpStreamStats.qpSum - Web APIs
Syntax var qpSum = rtcInboundRtpStreamStats.qpSum; Value An unsigned 64-bit integer value which indicates the sum of the quantization parameter (QP) value for every frame sent or received so far on the track described by the RTCInboundRtpStreamStats object. ...
... Syntax var qpSum = rtcInboundRtpStreamStats.qpSum; Value An unsigned 64-bit integer value which indicates the sum of the quantization parameter (QP) value for every frame sent or received so far on the track described by the RTCInboundRtpStreamStats object. ...
...gned 64-bit integer value which indicates the sum of the quantization parameter (QP) value for every frame sent or received so far on the track described by the RTCInboundRtpStreamStats object. Since the value of QP is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. Note: This value is only available for video media. Usage notes Quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value. This value takes the place of the range of values, thereby reducing the number of different values that appear in the overall data set, making the data more compressible. The quantization process and the amount of compression can be controlled using one or mor...
RTCOutboundRtpStreamStats.qpSum - Web APIs
Syntax var qpSum = RTCOutboundRtpStreamStats.qpSum; Value An unsigned 64-bit integer value which indicates the sum of the quantization parameter (QP) value for every frame sent so far on the track described by the RTCOutboundRtpStreamStats object. ...
... Syntax var qpSum = RTCOutboundRtpStreamStats.qpSum; Value An unsigned 64-bit integer value which indicates the sum of the quantization parameter (QP) value for every frame sent so far on the track described by the RTCOutboundRtpStreamStats object. ...
...ue An unsigned 64-bit integer value which indicates the sum of the quantization parameter (QP) value for every frame sent so far on the track described by the RTCOutboundRtpStreamStats object. Since the value of QP is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. Note: This value is only available for video media. Usage notes Quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value. This value takes the place of the range of values, thereby reducing the number of different values that appear in the overall data set, making the data more compressible. The quantization process and the amount of compression can be controlled using one or mor...
RTCPeerConnection.addStream() - Web APIs
The obsolete RTCPeerConnection method addStream() adds a MediaStream as a local source of audio or video. Instead of using this obsolete method, you should instead use addTrack() once for each track you wish to send to the remote peer. If the signalingState is set to closed, an InvalidStateError is raised. If the signalingState is set to stable, the event negotiationneeded is sent on the RTCPeerConnection to indicate that ICE negotiation must be repeated to consider the new stream. Syntax rtcPeerConnection.addStream(mediaStream); Parameters mediaStream A MediaStream object indicating the stream to add to the WebRTC peer connection. Return value None. Example This simple example adds the audio and video stream coming from the user's camera to the connection. navigator.mediaDevic...
...te that ICE negotiation must be repeated to consider the new stream. Syntax rtcPeerConnection.addStream(mediaStream); Parameters mediaStream A MediaStream object indicating the stream to add to the WebRTC peer connection. Return value None. Example This simple example adds the audio and video stream coming from the user's camera to the connection. ...
.... Example This simple example adds the audio and video stream coming from the user's camera to the connection. navigator.mediaDevices.getUserMedia({video:true, audio:true}, function(stream) { var pc = new RTCPeerConnection(); pc.addStream(stream); }); Migrating to addTrack() Compatibility allowing, you should update your code to instead use the addTrack() method: navigator.getUserMedia({video:true, audio:true}, function(stream) { var pc = new RTCPeerConnection(); stream.getTracks().forEach(function(track) { pc.addTrack(track, stream); }); }); The newer addTrack() API avoids confusion over whether later changes to the track-makeup of a stream affects a peer connection (they do not). The exception is in Chrome, where addStream() does make the peer connection sensitive to lat...
RTCPeerConnection.createAnswer() - Web APIs
rationError Generation of the SDP failed for some reason; this is a general failure catch-all exception. Return value A Promise whose fulfillment handler is called with an object conforming to the RTCSessionDescriptionInit dictionary which contains the SDP answer to be delivered to the other peer. ...
...rticle Signaling and video calling. This code comes from the handler for the message sent to carry an offer to another peer across the signaling channel. Keep in mind that this is part of the signaling process, the transport layer for which is an implementation detail that's entirely up to you. In this case, a WebSocket connection is used to send a JSON message with a type field with the value "video-answer" to the other peer, carrying the answer to the device which sent the offer to connect. The contents of the object being passed to the sendToServer() function, along with everything else in the promise fulfillment handler, depend entirely on your design pc.createAnswer().then(function(answer) { return pc.setLocalDescription(answer); }) .then(function() { // Send the answer to the remo...
...his asks RTCPeerConnection to create and return a new answer. In our promise handler, the returned answer is set as the description of the local end of the connection by calling setLocalDescription(). Once that succeeds, the answer is sent to the signaling server using whatever protocol you see fit. Promise.catch() is used to trap and handle errors. See Handling the invitation in Signaling and video calling to see the complete code, in context, from which this snippet is derived; that will help you understand the signaling process and how answers work. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'createAnswer()' in that specification. Candidate Recommendation Initial definition. ...
RTCPeerConnection: negotiationneeded event - Web APIs
Interface Event Event handler property RTCPeerConnection.onnegotiationneeded The negotiationneeded event is first dispatched to the RTCPeerConnection when media is first added to the connection. This starts the process of ICE negotiation by instructing your code to begin exchanging ICE candidates through the signaling server. See Signaling transaction flow in Signaling and video calling for a description of the signaling process that begins with a negotiationneeded event. Examples In this example, we use addEventListener() to create an event handler for negotiationneeded. Its role is to create an SDP offer and send it through the signaling channel to the remote peer. pc.addEventListener("negotiationneeded", ev => { pc.createOffer() .then(offer => return pc.setLoca...
...a negotiationneeded event. Examples In this example, we use addEventListener() to create an event handler for negotiationneeded. Its role is to create an SDP offer and send it through the signaling channel to the remote peer. pc.addEventListener("negotiationneeded", ev => { pc.createOffer() .then(offer => return pc.setLocalDescription(offer)) .then(() => sendSignalingMessage({ type: "video-offer", sdp: pc.localDescription })) .catch(err => { /* handle error */ ); }, false); After creating the offer, the local end is configured by calling RTCPeerConnection.setLocalDescription(); then a signaling message is created and sent to the remote peer through the signaling server, to share that offer with the other peer. The other peer should recognize this message and follow ...
...moteDescription(), and then creating an answer to send back to the offering peer. You can also set an event handler for the negotiationneeded event by assigning the event handler function to the RTCPeerConnection.onnegotiationneeded property: pc.onnegotiationneeded = ev => { pc.createOffer() .then(offer => return pc.setLocalDescription(offer)) .then(() => sendSignalingMessage({ type: "video-offer", sdp: pc.localDescription })) .catch(err => { /* handle error */ ); }; For a more detailed example, see Starting negotiation in Signaling and video calling. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'negotiationneeded' in that specification. Candidate Recommendation ...
RTCPeerConnection.onaddstream - Web APIs
pe MediaStreamEvent, are sent when streams are added to the connection by the remote peer. The first time an event occurs may be nearly immediately after the remote end of the connection is set using RTCPeerConnection.setRemoteDescription(); it doesn't wait for a particular stream to be accepted or rejected using SDP negotiation. ...
...tion by the remote peer. The first time an event occurs may be nearly immediately after the remote end of the connection is set using RTCPeerConnection.setRemoteDescription(); it doesn't wait for a particular stream to be accepted or rejected using SDP negotiation. ...
...eer. The first time an event occurs may be nearly immediately after the remote end of the connection is set using RTCPeerConnection.setRemoteDescription(); it doesn't wait for a particular stream to be accepted or rejected using SDP negotiation. Example This code, based on an older version of our Signaling and video calling sample, responds to addstream events by setting the video source for a <video> element to the stream specified in the event, and then enabling a "hang up" button in the app's user interface. pc.onaddstream = function(event) { document.getElementById("received_video").srcObject = event.stream; document.getElementById("hangup-button").disabled = false; }; You can also use addEventListener() to add a handler for addstream events to an RTCPeerConnection. ...
RTCPeerConnection.removeTrack() - Web APIs
hange until this negotiation occurs. A negotiationneeded event is sent to the RTCPeerConnection to let the local end know this negotiation must occur. Syntax pc.removeTrack(sender); Parameters mediaTrack A RTCRtpSender specifying the sender to remove from the connection. Return value undefined. Exceptions InvalidStateError The connection is not open. ...
...veTrack(sender); Parameters mediaTrack A RTCRtpSender specifying the sender to remove from the connection. Return value undefined. Exceptions InvalidStateError The connection is not open. Example This example adds a video track to a connection and sets up a listener on a close button which removes the track when the user clicks the button. ...
...ve from the connection. Return value undefined. Exceptions InvalidStateError The connection is not open. Example This example adds a video track to a connection and sets up a listener on a close button which removes the track when the user clicks the button. var pc, sender; navigator.getUserMedia({video: true}, function(stream) { pc = new RTCPeerConnection(); var track = stream.getVideoTracks()[0]; sender = pc.addTrack(track, stream); }); document.getElementById("closeButton").addEventListener("click", function(event) { pc.removeTrack(sender); pc.close(); }, false); Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCPeerConnection.removeTrack()' in that specification. Candi...
RTCPeerConnection: track event - Web APIs
ded to the peer connection. See Track event types in RTCTrackEvent for details. Examples This example shows code that creates a new RTCPeerConnection, then adds a new track event handler. ...
...en adds a new track event handler. pc = new RTCPeerConnection({ iceServers: [ { urls: "turn:fake.turnserver.url", username: "someusername", credential: "somepassword" } ] }); pc.addEventListener("track", e => { videoElement.srcObject = e.streams[0]; hangupButton.disabled = false; }, false); The event handler assigns the new track's first stream to an existing <video> element, identified using the variable videoElement. ...
... } ] }); pc.addEventListener("track", e => { videoElement.srcObject = e.streams[0]; hangupButton.disabled = false; }, false); The event handler assigns the new track's first stream to an existing <video> element, identified using the variable videoElement. You can also assign the event handler function to the ontrack property, rather than use addEventListener(). pc.ontrack = e => { videoElement.srcObject = e.streams[0]; hangupButton.disabled = false; return false; } Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'track' in that specification. Candidate Recommendation Initial specification. ...
RTCPeerConnection - Web APIs
its methods from: EventTargetaddIceCandidate()When a web site or app using RTCPeerConnection receives a new ICE candidate from the remote peer over its signaling channel, it delivers the newly-received candidate to the browser's ICE agent by calling RTCPeerConnection.addIceCandidate().addStream() The obsolete RTCPeerConnection method addStream() adds a MediaStream as a local source of audio or video. Instead of using this obsolete method, you should instead use addTrack() once for each track you wish to send to the remote peer.addTrack()The RTCPeerConnection method addTrack() adds a new media track to the set of tracks which will be transmitted to the other peer.close() The RTCPeerConnection.close() method closes the current peer connection.createAnswer() The createAnswer() method on the R...
...ven id that is associated with local or remote end of the connection. If no stream matches, it returns null.getTransceivers()The RTCPeerConnection interface's getTransceivers() method returns a list of the RTCRtpTransceiver objects being used to send and receive data on the connection.removeStream() The RTCPeerConnection.removeStream() method removes a MediaStream as a local source of audio or video. If the negotiation already happened, a new one will be needed for the remote peer to be able to use it. Because this method has been deprecated, you should instead use removeTrack() if your target browser versions have implemented it.removeTrack()The RTCPeerConnection.removeTrack() method tells the local end of the connection to stop sending media from the specified track, without actually remov...
... at that point. Note: In technical terms, a BUNDLE lets all media flow between two peers flow across a single 5-tuple; that is, from a single IP and port on one peer to a single IP and port on the other peer, using the same transport protocol. Constant Description "balanced" The ICE agent initially creates one RTCDtlsTransport for each type of content added: audio, video, and data channels. If the remote endpoint is not BUNDLE-aware, then each of these DTLS transports then handles all the communication for one type of data. "max-compat" The ICE agent initially creates one RTCDtlsTransport per media track and a separate one for data channels. If the remote endpoint is not BUNDLE-aware, everything is negotiated on these separate DTLS transports. ...
RTCRtpCapabilities - Web APIs
rming to the dictionary RTCRtpCodecCapability. Each of these objects describes a single codec and its basic capabilities. Its properties are: The browser will only report distinct capability combinations separately. If two sets of capabilities can be described as one, they will be. That means that, for instance, if there are two entries for the H.264 codec (as identified by the mimeType being "video/H264"), there are other values in the capabilities objects indicating how they're different in some way. The MIME type strings used by RTP differ from those used elsewhere. See RFC 3555, section 4 for the complete IANA registry of these types. There are three special entries that should always be present, representing underlying components of the transport. Those components are: RED (REDun...
...by RTP differ from those used elsewhere. See RFC 3555, section 4 for the complete IANA registry of these types. There are three special entries that should always be present, representing underlying components of the transport. Those components are: RED (REDundant Audio Data) The media type of an RED entry may vary due to there being several versions of it, but it will end with red, such as video/red or video/fwdred. The base RED standard can be found in RFC 2198. There may be multiple entries for RED if different forms are supported; each will have a unique media type in that case. FEC (Forward Error Correction) An FEC component handles error correction data; its media type may also vary due to there being advanced versions of the standard available, but it will always end with fec. On...
.... The base RED standard can be found in RFC 2198. There may be multiple entries for RED if different forms are supported; each will have a unique media type in that case. FEC (Forward Error Correction) An FEC component handles error correction data; its media type may also vary due to there being advanced versions of the standard available, but it will always end with fec. One possible value is video/ulpfec (a generic error connection model). There may also be multiple FEC entries if more than one form is supported. RTX (Retransmission) This component is responsible for retransmission of data; it's media type should be video/rtx. There will only be one entry for RTX, and it will not have an sdpFmtpLine property. Don't be surprised to see these show up ijn the list; be prepared to ignore t...
RTCRtpSender.getCapabilities() static function - Web APIs
ed by the RTCRtpSender. You can, similarly, obtain the capabilities of RTCRtpReceivers by calling the static function RTCRtpReceiver.getCapabilities(). Syntax let rtpCapabilities = RTCRtpSender.getCapabilities(kind); Parameters kind A DOMString indicating the type of media for which you wish to get the sender's capability to receive. All browsers support the primary media kinds: audio and video. Return value An RTCRtpCapabilities object stating what capabilities the browser has for sending the specified media kind over an RTCPeerConnection. If the browser doesn't have any support for the given media kind, the returned value is null. Description As a static function, this is always called using the form: capabilities = RTCRtpSender.getCapabilities("audio"); The returned set of cap...
...y often), the media capabilities can in whole or in part provide a cross-origin method for identifying a user. For that reason, in privacy-sensitive contexts, the browser may choose to obscure the capabilities; this might be done, for example, by leaving out rarely-used codec configurations. ...
...c configurations. Example The function below returns a Boolean indicating whether or not the device supports sending H.264 video on an RTCRtpSender. Since RTCRtpSender.getCapabilities() actually only indicates probable support, H.264 support might still fail even after getting a positive response from this function. function canSendH264() { let capabilities = RTCRtpSender.getCapabilities("video"); capabilities.codecs.forEach((codec) => { if (codec.mimeType === "video/H264") { return true; } }); return false; } Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCRtpSender.getCapabilities()' in that specification. Candidate Recommendation ...
Screen Capture API - Web APIs
en (such as a window) to capture as a media stream. This stream can then be recorded or shared with others over the network. Screen Capture API concepts and usage The Screen Capture API is relatively simple to use. Its sole method is MediaDevices.getDisplayMedia(), whose job is to ask the user to select a screen or portion of a screen to capture in the form of a MediaStream. To start capturing video from the screen, you call getDisplayMedia() on the instance of Media navigator.mediaDevices: captureStream = await navigator.mediaDevices.getDisplayMedia(displayMediaOptions); The Promise returned by getDisplayMedia() resolves to a MediaStream which streams the captured media. See the article Using the Screen Capture API for a more in-depth look at how to use the API to capture screen contents...
...be included in the captured display surface's stream, and if it should always be visible or if it should only be visible while the mouse is in motion. MediaTrackConstraints.displaySurface A ConstrainDOMString indicating what type of display surface is to be captured. The value is one of application, browser, monitor, or window. MediaTrackConstraints.logicalSurface Indicates whether or not the video in the stream represents a logical display surface (that is, one which may not be entirely visible onscreen, or may be completely offscreen). A value of true indicates a logical display surface is to be captured. MediaTrackSettings MediaTrackSettings.cursor A string which indicates whether or not the display surface currently being captured includes the mouse cursor, and if so, whether it's...
...use cursor, and if so, whether it's only visible while the mouse is in motion or if it's always visible. The value is one of always, motion, or never. MediaTrackSettings.displaySurface A string indicating what type of display surface is currently being captured. The value is one of application, browser, monitor, or window. MediaTrackSettings.logicalSurface A Boolean value which is true if the video being captured doesn't directly correspond to a single onscreen display area. MediaTrackSupportedConstraints MediaTrackSupportedConstraints.cursor A Boolean which is true if the user agent and device support the MediaTrackConstraints.cursor constraint. MediaTrackSupportedConstraints.displaySurface A Boolean which is true if the current environment supports the MediaTrackConstraints.displa...
TextTrack.mode - Web APIs
Web › API › TextTrack › mode
The TextTrack interface's mode property is a string specifying and controlling the text track's mode: disabled, hidden, or showing. You can read this value to determine the current mode, and you can change this value to switch modes. Safari additionally requires the default boolean attribute to be set to true when implementing your own video player controls in order for the subtitles cues to be shown. Syntax var mode = textTrack.mode; textTrack.mode = "disabled" | "hidden" | "showing"; Value A DOMString which indicates the track's current mode. The text track mode is one of the values listed below, under Text track mode constants. Text track mode constants The text track mode--sometimes identified using the IDL enum TextTrackMode--must be one of the following values: disabled The t...
...ck mode was initially disabled, you'll have to change the mode to either hidden or showing in order to trigger loading of the cues. When the mode is showing, text tracks are performed. The exact appearance and manner of that performance varies depending on each text track's kind. In general: Tracks whose kind is "subtitles" or "captions" are rendered with the cues overlaid over the top of the video. Tracks whose kind is "descriptions" are presented in a non-visual form (for example, the text might be spoken to describe the action in the video). Tracks whose kind is "chapters" are used by the user agent or the Web site or Web app to construct and present an interface for navigating the named chapters, where each cue in the list represents a chapter in the media. The user can then navigate ...
...gent or the Web site or Web app to construct and present an interface for navigating the named chapters, where each cue in the list represents a chapter in the media. The user can then navigate to the desired chapter, which begins at the cue's start position and ends at the cue's end position. Example In this example, we configure the text track's cues so that every time a cue is finished, the video automatically pauses playback. This is done by setting the pauseOnExit property on each cue to true. However, to ensure that the track's cues are available, we first set mode to showing. window.addEventListener("load", event => { let trackElem = document.querySelector("track"); let track = trackElem.track; track.mode = "showing"; for (let index=0; index < track.cues.length; index++) { ...
VTTRegion - Web APIs
Web › API › VTTRegion
The VTTRegion interface--part of the API for handling WebVTT (text tracks on media presentations)--describes a portion of the video to render a VTTCue onto. Constructor VTTRegion() Returns a newly created VTTRegion object. Properties VTTRegion.id A DOMString that identifies the region. VTTRegion.width A double representing the width of the region, as a percentage of the video. VTTRegion.lines A double representing the height of the region, in number of lines. VTTRegion.regionAnchorX A double representing the region anchor X offset, as a percentage of the region. VTTRegion.regionAnchorY A double representing the region anchor Y offset, as a percentage of the region. VTTRegion.viewportAnchorX A double representing the viewport anchor X offset, as a percentage of the video. ...
... double representing the region anchor X offset, as a percentage of the region. VTTRegion.regionAnchorY A double representing the region anchor Y offset, as a percentage of the region. VTTRegion.viewportAnchorX A double representing the viewport anchor X offset, as a percentage of the video. VTTRegion.viewportAnchorY A double representing the viewport anchor Y offset, as a percentage of the video. VTTRegion.scroll An enum representing how adding new cues will move existing cues. Examples var region = new VTTRegion(); region.width = 50; // Use 50% of the video width region.lines = 4; // Use 4 lines of height. region.viewportAnchorX = 25; // Have the region start at 25% from the left. var cue = new VTTCue(2, 3, 'Cool text to be displayed'); cue.region = region; // This cue will be ...
...TTRegion(); region.width = 50; // Use 50% of the video width region.lines = 4; // Use 4 lines of height. region.viewportAnchorX = 25; // Have the region start at 25% from the left. var cue = new VTTCue(2, 3, 'Cool text to be displayed'); cue.region = region; // This cue will be drawn only within this region. Specifications Specification Status Comment WebVTT: The Web Video Text Tracks Format Candidate Recommendation ...
WebGLRenderingContext.texSubImage2D() - Web APIs
ght, format, type, ArrayBufferView? pixels); void gl.texSubImage2D(target, level, xoffset, yoffset, format, type, ImageData? pixels); void gl.texSubImage2D(target, level, xoffset, yoffset, format, type, HTMLImageElement? pixels); void gl.texSubImage2D(target, level, xoffset, yoffset, format, type, HTMLCanvasElement? pixels); void gl.texSubImage2D(target, level, xoffset, yoffset, format, type, HTMLVideoElement? pixels); void gl.texSubImage2D(target, level, xoffset, yoffset, format, type, ImageBitmap? pixels); // WebGL 2: void gl.texSubImage2D(target, level, xoffset, yoffset, format, type, GLintptr offset); void gl.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, HTMLCanvasElement source); void gl.texSubImage2D(target, level, xoffset, yoffset, width, height, format, ty...
... 2: void gl.texSubImage2D(target, level, xoffset, yoffset, format, type, GLintptr offset); void gl.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, HTMLCanvasElement source); void gl.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, HTMLImageElement source); void gl.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, HTMLVideoElement source); void gl.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, ImageBitmap source); void gl.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, ImageData source); void gl.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, ArrayBufferView srcData, srcOffset); Parameters target A GLenum specifying the bindin...
...n be used as a pixel source for the texture: ArrayBufferView, A Uint8Array must be used if type is gl.UNSIGNED_BYTE. A Uint16Array must be used if type is either gl.UNSIGNED_SHORT_5_6_5, gl.UNSIGNED_SHORT_4_4_4_4, gl.UNSIGNED_SHORT_5_5_5_1, or ext.HALF_FLOAT_OES. A Float32Array must be used if type is gl.FLOAT. ImageData, HTMLImageElement, HTMLCanvasElement, HTMLVideoElement, ImageBitmap. offset (WebGL 2 only) A GLintptr byte offset into the WebGLBuffer's data store. Used to upload data to the currently bound WebGLTexture from the WebGLBuffer bound to the PIXEL_UNPACK_BUFFER target. Return value None. Examples gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, image); Specifications Specification Status C...
Using DTMF with WebRTC - Web APIs
This article offers a brief high-level overview of how DTMF works over WebRTC, then provides a guide for everyday developers about how to send DTMF over an RTCPeerConnection. The DTMF system is often referred to as "touch tone," after an old trade name for the system. WebRTC doesn't send DTMF codes as audio data. Instead, they're sent out-of-band, as RTP payloads. Note, however, that although it's possible to send DTMF using WebRTC, there is currently no way to detect or receive incoming DTMF. ...
...de next. Keep in mind that the process of establishing the connection is somewhat contrived here; you normally don't build both ends of the connection in the same document. Global variables First, we establish global variables. let dialString = "12024561111"; let callerPC = null; let receiverPC = null; let dtmfSender = null; let hasAddTrack = false; let mediaConstraints = { audio: true, video: false }; let offerOptions = { offerToReceiveAudio: 1, offerToReceiveVideo: 0 }; let dialButton = null; let logElement = null; These are, in order: dialString The DTMF string the caller will send when the "Dial" button is clicked. callerPC and receiverPC The RTCPeerConnection objects representing the caller and the receiver, respectively. These will be initialized when the call star...
...hod, we use this Boolean to determine whether or not the user agent supports addTrack(); if it doesn't, we'll fall back to addStream(). This gets figured out in connectAndDial(), as shown in Starting the connection process. mediaConstraints An object conforming to the MediaConstraints dictionary specifying the constraints to use when starting the connection. We want an audio-only connection, so video is false, while audio is true. offerOptions An RTCOfferOptions object providing options to specify when calling RTCPeerConnection.createOffer(). In this case, we state that we want to receive audio but not video. dialButton and logElement These variables will be used to store references to the dial button and the <div> into which logging information will be written. They'll get set up when th...
Web accessibility for seizures and physical reactions - Accessibility
This article introduces concepts behind making web content accessibile for those with vestibular disorders, and how to measure and prevent content leading to seizures and / or other physical reactions. Overview Seizures Seizures caused by light are known as photosensitive epilepsy. Content that flickers, flashes, or blinks can trigger photosensitive epilepsy. Web technologies that use video, animated gifs, animated pngs, animated SVGs, Canvas, and CSS or JavaScript animations are all capable of content that can induce seizures or other incapacitating physical reactions. Certain visual patterns, especially stripes, can also cause physical reactions even though they are not animated. Photosensitive epilepsy is actually a kind of "reflex epilepsy"--seizures occurring in response to a tr...
...ted. Other disorders, such as disorientation, nausea, vomiting, and more can also be so severe that the user is unable to function. The Epilepsy Foundation's article, Photosensitivity and Seizures, provides a list of triggers that may cause seizures in photosensitive people; here's an excerpt from that list: Television screens or computer monitors due to the flicker or rolling images. Certain video games or TV broadcasts containing rapid flashes or alternating patterns of different colors. Intense strobe lights like visual fire alarms. Natural light, such as sunlight, especially when shimmering off water, flickering through trees or through the slats of Venetian blinds. Certain visual patterns, especially stripes of contrasting colors. That same article continues that many factors must...
...Threshold" notes generally that: "Individuals who have photosensitive seizure disorders can have a seizure triggered by content that flashes at certain frequencies for more than a few flashes" and goes on to note, very specifically that: "People are even more sensitive to red flashing than to other colors, so a special test is provided for saturated red flashing". You don't even need an image or video to cause harm. A <div> element set to change color and luminosity at high frequency, easily done via JavaScript, can cause real harm. And, flickering can occur everywhere. For example, "spinners" commonly used to display while pages load, can easily "flicker" while spinning. Additional concerns exist for individuals with motor-skills problems. For example, the page for Trace Research & Developme...
Web Accessibility: Understanding Colors and Luminance - Accessibility
technology has historically resided in the RGB color space. This is because the companies behind the evolution of digital technology set the standards, and these standards still retain a powerful presence today. This is evolving, and new methods for measuring color involve measurements using other color spaces, but color measurements in the RGB color space still predominates, and this includes video production. The RGB color model is extended to include "alpha" -- RGBA -- to allow specification of the opacity of a color. There's movement towards adopting the use of HSL color values rather than RGB values is CSS Color Module 3 (see section 4.2.4), the rationale being that RGB is hardware-oriented, reflecting the use of CRTs, and that RGB is non-intuitive. That said, HSL colors incorporate ...
...hing: In addition to a red environment affecting the cognitive function of those with traumatic brain Injury, color in the red spectrum wavelength requires special attention and tests. Dr. Gregg Vanderheiden, when testing the Photosensitive Epilepsy Analysis Tool, noted seizure rates were much higher than expected. They found that we are much more sensitive to saturated red flashing. (See the video, The Photosensitive Epilepsy Analysis Tool) Measuring Color & Luminance Methods that measures color Exploring the RGB color space further, as it is the color space used by the data type <color>, note that there are actually multiple "versions" of the RGB color space, such as sRGB, scRGB, and RGBA. There are also different ways to refrence RGB: RGB Decimal reference: 153, 0, 0 and an RGB Perce...
...e W3C/WCAG issue #360. R, G, and B have distinct weights in the relative luminance formula. Calculations for relative luminance are not casual ones, luckily, there are tools that will do it for you. Here are a few. Relative luminance calculation. Calculate relative luminance Analyze Luminosity Contrast Ratio Some notes: Luma and luminance are not the same. From IEC 61966-2-2:2003(en), "Video systems approximate the lightness response of vision by computing a luma component Y? as a weighted sum of nonlinear R?G?B? primary components: Each RGB signal is, comparable to the 1/3 power function with an offset defined by L*. Luma is often incorrectly referred to as luminance." Luminosity and Luminance are not the same, but sometimes, in the HSL color spectrum, they are sometimes used inter...
@document - CSS: Cascading Style Sheets
Web › CSS › @document
ne or more matching functions. If any of the functions apply to a given URL, the rule will take effect on that URL. The functions available are: url(), which matches an exact URL. url-prefix(), which matches if the document URL starts with the value provided. domain(), which matches if the document URL is on the domain provided (or a subdomain of it). media-document(), with the parameter of video, image, plugin or all. regexp(), which matches if the document URL is matched by the regular expression provided. The expression must match the entire URL. The values provided to the url(), url-prefix(), domain(), and media-document() functions can be optionally enclosed by single or double quotes. The values provided to the regexp() function must be enclosed in quotes. Escaped values provide...
...itigate potential CSS injection attacks (See bug 1035091). ...
... ...
Media buffering, seeking, and time ranges - Developer guides
Sometimes it's useful to know how much <audio> or <video> has downloaded or is playable without delay -- a good example of this is the buffered progress bar of an audio or video player. This article discusses how to build a buffer/seek bar using TimeRanges, and other features of the media API. Buffered The buffered attribute will tell us which parts of the media has been downloaded. It returns a TimeRanges object, which will tell us which chunks of media have been downloaded. This is usually contiguous but if the user jumps about while media is buffering, it may contain holes. ...
...d a buffer/seek bar using TimeRanges, and other features of the media API. Buffered The buffered attribute will tell us which parts of the media has been downloaded. It returns a TimeRanges object, which will tell us which chunks of media have been downloaded. This is usually contiguous but if the user jumps about while media is buffering, it may contain holes. This will work with <audio> or <video>; for now let's consider a simple audio example: <audio id="my-audio" controls src="music.mp3"> </audio> We can access these attributes like so: var myAudio = document.getElementById('my-audio'); var bufferedTimeRanges = myAudio.buffered; TimeRanges Object TimeRanges are a series of non-overlapping ranges of time, with start and stop times. (learn more about TimeRanges). A TimeRanges Objec...
...Each red filled white rectangle represents a time range. Note: You can see the timerange code running live on JS Bin. Seekable The seekable attribute returns a TimeRanges object and tells us which parts of the media can be played without delay; this is irrespective of whether that part has been ...
<input type="file"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › file
ious software from guessing the user's file structure. Additional attributes In addition to the common attributes shared by all <input> elements, inputs of type file also support the following attributes: Attribute Description accept One or more unique file type specifiers describing file types to allow capture What source to use for capturing image or video data files A FileList listing the chosen files multiple A Boolean which, if present, indicates that the user may choose more than one file accept The accept attribute value is a string that defines the file types the file input should accept. This string is a comma-separated list of unique file type specifiers. Because a given file type may be identified in more th...
...A value of user indicates that the user-facing camera and/or microphone should be used. A value of environment specifies that the outward-facing camera and/or microphone should be used. If this attribute is missing, the user agent is free to decide on its own what to do. If the requested facing mode isn't avai...
...ring that describes a type of file that may be selected by the user in an <input> element of type file. Each unique file type specifier may take one of the following forms: A valid case-insensitive filename extension, starting with a period (".") character. For example: .jpg, .pdf, or .doc. A valid MIME type string, with no extensions. The string audio/* meaning "any audio file". The string video/* meaning "any video file". The string image/* meaning "any image file". The accept attribute takes as its value a string containing one or more of these unique file type specifiers, separated by commas. For example, a file picker that needs content that can be presented as an image, including both standard image formats and PDF files, might look like this: <input type="file" accept="image/*,...
HTML elements reference - HTML: Hypertext Markup Language
Web › HTML › Element
a variable in a mathematical expression or a programming context. <wbr> The HTML <wbr> element represents a word break opportunity--a position within text where the browser may optionally break a line, though its line-breaking rules would not otherwise create a break at that location. Image and multimedia HTML supports various multimedia resources such as images, audio, and video. Element Description <area> The HTML <area> element defines a hot-spot region on an image, and optionally associates it with a hypertext link. This element is used only within a <map> element. <audio> The HTML <audio> element is used to embed sound content in documents. It may contain one or more audio sources, represented using the src attribute or t...
...oose the most suitable one. It can also be the destination for streamed media, using a MediaStream. <img> The HTML <img> element embeds an image into the document. <map> The HTML <map> element is used with <area> elements to define an image map (a clickable link area). <track> The HTML <track> element is used as a child of the media elements, <audio> and <video>. It lets you specify timed text tracks (or time-based data), for example to automatically handle subtitles. <video> The HTML Video element (<video>) 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. Embedded content In addition to regu...
... The HTML <param> element defines parameters for an <object> element. <picture> The HTML <picture> element contains zero or more <source> elements and one <img> element to offer alternative versions of an image for different display/device scenarios. <source> The HTML <source> element specifies multiple media resources for the <picture>, the <audio> element, or the <video> element. Scripting In order to create dynamic content and Web applications, HTML supports the use of scripting languages, most prominently JavaScript. Certain elements support this capability. Element Description <canvas> Use the HTML <canvas> element with either the canvas scripting API or the WebGL API to draw graphics and animations. <noscri...
itemprop - HTML: Hypertext Markup Language
item. Every HTML element can have an itemprop attribute specified, and an itemprop consists of a name-value pair. Each name-value pair is called a property, and a group of one or more properties forms an item. Property values are either a string or a URL and can be associated with a very wide range of elements including <audio>, <embed>, <iframe>, <img>, <link>, <object>, <source> , <track>, and <video>. Examples The example below shows the source for a set of elements marked up with itemprop attributes, followed by a table showing the resulting structured data. HTML <div itemscope itemtype="http://schema.org/Movie"> <h1 itemprop="name">Avatar</h1> <span>Director: <span itemprop="director">James Cameron</span> (born August 16, 1954)</span> <span itemprop="genre">Science fictio...
...ltiple tokens. Values The property value of a name-value pair is as given for the first matching case in the following list: If the element has an itemscope attribute The value is the item created by the element. ...
...he value is the value of the element's value attribute If the element is a time element The value is the element's datetime value Otherwise The value is the element's textContent. If a property's value is a URL, the property must be specified using a URL property element. The URL property elements are the a, area, audio, embed, iframe, img, link, object, source, track, and video elements. Name order Names are unordered relative to each other, but if a particular name has multiple values, they do have a relative order. In the following example, the "a" property has the values "1" and "2", in that order, but whether the "a" property comes before the "b" property or not is not important <div itemscope> <p itemprop="a">1</p> <p itemprop="a">2</p> <p itemprop="b">test<...
Compression in HTTP - HTTP
happen at the HTTP level (the resource is transmitted compressed from end to end), and finally compression can be defined at the connection level, between two nodes of an HTTP connection. File format compression Each data type has some redundancy, that is wasted space, in it. If text can typically have as much as 60% redundancy, this rate can be much higher for some other media like audio and video. Unlike text, these other media types use lot of space to store their data and the need to optimize storage and regain space was apparent very early. Engineers designed the optimized compression algorithm used by file formats designed for this specific purpose. Compression algorithms used for files can be grouped into two broad categories: Loss-less compression, where the compression-uncompres...
...ession algorithms used for files can be grouped into two broad categories: Loss-less compression, where the compression-uncompression cycle doesn't alter the data that is recovered. It matches (byte to byte) with the original. For images, gif or png are using loss-less compression. Lossy compression, where the cycle alters the original data in a (hopefully) imperceptible way for the user. Video formats on the Web are lossy; the jpeg image format is also lossy. Some formats can be used for both loss-less or lossy compression, like webp, and usually lossy algorithm can be configured to compress more or less, which then of course leads to less or more quality. For better performance of a Web site, it is ideal to compress as much as possible, while keeping an acceptable level of quality. ...
...presentation based on its encoding, the server must send a Vary header containing at least Accept-Encoding alongside this header in the response; that way, caches will be able to cache the different representations of the resource. As compression brings significant performance improvements, it is recommended to activate it for all files, but already compressed ones like images, audio files and videos. Apache supports compression and uses mod_deflate; for nginx there is ngx_http_gzip_module; for IIS, the <httpCompression> element. Hop-by-hop compression Hop-by-hop compression, though similar to end-to-end compression, differs by one fundamental element: the compression doesn't happen on the resource in the server, creating a specific representation that is then transmitted, but on the body...
Index - HTTP
Web › HTTP › Headers › Index
IME types, the client is able to understand. Using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the Content-Type response header. Browsers set adequate values for this header depending on the context where the request is done: when fetching a CSS stylesheet a different value is set for the request than when fetching an image, video or a script. 3 Accept-Charset Content Negotiation, HTTP, HTTP Header, Reference, Request header The Accept-Charset request HTTP header advertises which character set the client is able to understand. Using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice within the Content-Type response header. Browsers usually do...
... 39 CSP: manifest-src CSP, Directive, HTTP, Reference, Security The HTTP Content-Security-Policy: manifest-src directive specifies which manifest can be applied to the resource. 40 CSP: media-src CSP, Directive, HTTP, Reference, Security The HTTP Content-Security-Policy (CSP) media-src directive specifies valid sources for loading media using the <audio> and <video> elements. 41 CSP: object-src CSP, Directive, HTTP, Reference, Security The HTTP Content-Security-Policy object-src directive specifies valid sources for the <object>, <embed>, and <applet> elements. 42 CSP: plugin-types CSP, Directive, Flash, HTTP, Java, Plugins, Security The HTTP Content-Security-Policy (CSP) plugin-types directive restricts the set of ...
...cy, Feature-Policy, HTTP, Reference, autoplay The HTTP Feature-Policy header autoplay directive controls whether the current document is allowed to autoplay media requested through the HTMLMediaElement interface. When this policy is enabled and there were no user gestures, the Promise returned by HTMLMediaElement.play() will reject with a DOMException. The autoplay attribute on <audio> and <video> elements will be ignored. 65 Feature-Policy: camera Directive, Feature Policy, Feature-Policy, HTTP, Reference, camera The HTTP Feature-Policy header camera directive controls whether the current document is allowed to use video input devices. When this policy is enabled, the Promise returned by MediaDevices.getUserMedia() will reject with a NotAllowedError. 66 Fe...
An overview of HTTP - HTTP
Web › HTTP › Overview
HTTP is a protocol which allows the fetching of resources, such as HTML documents. It is the foundation of any data exchange on the Web and it is a client-server protocol, which means requests are initiated by the recipient, usually the Web browser. A complete document is reconstructed from the different sub-documents fetched, for instance text, layout description, images, videos, scripts, and more. Clients and servers communicate by exchanging individual messages (as opposed to a stream of data). The messages sent by the client, usually a Web browser, are called requests and the messages sent by the server as an answer are called responses. Designed in the early 1990s, HTTP is an extensible protocol which has evolved over time. It is an application layer protocol that is sent over TCP, or...
... the server as an answer are called responses. Designed in the early 1990s, HTTP is an extensible protocol which has evolved over time. It is an application layer protocol that is sent over TCP, or over a TLS-encrypted TCP connection, though any reliable transport protocol could theoretically be used. Due to its extensibility, it is used to not only fetch hypertext documents, but also images and videos or to post content to servers, like with HTML form results. HTTP can also be used to fetch parts of documents to update Web pages on demand. Components of HTTP-based systems HTTP is a client-server protocol: requests are sent by one entity, the user-agent (or a proxy on behalf of it). Most of the time the user-agent is a Web browser, but it can be anything, for example a robot that crawls the ...
...(though some mechanisms have been added over the years to simulate server-initiated messages). To present a Web page, the browser sends an original request to fetch the HTML document that represents the page. It then parses this file, making additional requests corresponding to execution scripts, layout information (CSS) to display, and sub-resources contained within the page (usually images and videos). The Web browser then mixes these resources to present to the user a complete document, the Web page. Scripts executed by the browser can fetch more resources in later phases and the browser updates the Web page accordingly. A Web page is a hypertext document. This means some parts of displayed text are links which can be activated (usually by a click of the mouse) to fetch a new Web page, all...
Image file type and format guide - Web media technologies
GIF supports simple animation, in which following an initial full-size frame, a series of images reflecting the parts of the image that change with each frame are provided. GIF has been extremely popular for decades, due to its simplicity and compatibility. Its animation support caused a resurgence in its popularity in the social media era, when animated GIFs began to be widely used for short "videos", memes, and other simple animation sequences. Another popular feature of GIF is support for interlacing, where rows of pixels are stored out of order so that partially-received files can be displayed in lower quality. This is particularly useful when network connections are slow. GIF is a good choice for simple images and animations, although converting full color images to GIF can result in ...
... software. Compression Most TIFF files are uncompressed, but lossless PackBits and LZW compression are supported, as is lossy JPEG compression. Licensing No license required (aside from any associated with libraries you might use); all known patents have expired. WebP image WebP supports lossy compression via predictive coding based on the VP8 video codec, and lossless compression that uses substitutions for repeating data. Lossy WebP images average 25-35% smaller than JPEG images of visually similar compression levels. Lossless WebP images are typically 26% smaller than the same images in PNG format. WebP also supports animation: in a lossy WebP file, the image data is represented by a VP8 bitstream, which may contain multiple frames. Loss...
... Photographs Photographs typically fare well with lossy compression (depending on the encoder's configuration). This makes JPEG and WebP good choices for photographs, with JPEG being more compatible but WebP perhaps offering better compression. To maximize quality and minimize download tim...
Tutorials
b page with code examples. HTML Challenges Use these challenges to hone your HTML skills (for example, "Should I use an <h2> element or a <strong> element?"), focusing on meaningful markup. Intermediate level Multimedia and embedding This module explores how to use HTML to include multimedia in your web pages, including the different ways that images can be included, and how to embed video, audio, and even entire other webpages. HTML tables Representing tabular data on a webpage in an understandable, accessible way can be a challenge. This module covers basic table markup, along with more complex features such as implementing captions and summaries. Advanced level HTML forms Forms are a very important part of the Web -- these provide much of the functionality you n...
... ...
... ...
XUL accessibility guidelines - Archive of obsolete content
ing actions is allowed. Ensure that users have control of response time. Media Audio Informative audio files such as podcasts can be made accessible by supplying a word-for-word transcript. Transcripts should identify the speakers and describe other relevant sounds such as laughing or singing. Transcripts can be time consuming to generate, but is the only way to make audio content accessible. Video A video file can be made accessible by adding synchronized captions. Most media delivery formats provide a means for displaying captions. Video should also have descriptive transcripts. Usually captioning and transcribing go hand in hand, once you have one its easy to produce the other. Learn More Captioning WebAIM article: Web Captioning Overview WebAIM resource: Ca...
...exist, or inadequate instruction is provided. Response time User is informed of time limits and has control of response time when appropriate. User is not notified of time limits and/or has no control over response time when appropriate. Media Checkpoint Pass Fail Audio Transcripts are provided for audio tracks. No transcript provided. Video Video is captioned and a transcript is provided. No captions and/or transcripts provided. Animation User has control over animation and is warned about flashing content. No control over animation or warnings about flashing exist. Other Checkpoint Pass Fail Custom widgets Custom widgets provide accessible functionality. Custom widgets are ...
nsIContentPolicy - Archive of obsolete content
on an <a> element using the ping attribute. TYPE_XMLHTTPREQUEST 11 Indicates an XMLHttpRequest. Also used for Document.load() TYPE_OBJECT_SUBREQUEST 12 Indicates a request by a plugin. TYPE_DTD 13 Indicates a DTD loaded by an XML document. TYPE_FONT 14 Indicates a font loaded via @font-face rule. TYPE_MEDIA 15 Indicates a video or audio load. TYPE_WEBSOCKET 16 Indicates a WebSocket load. TYPE_CSP_REPORT 17 Indicates a Content Security Policy report. TYPE_XSLT 18 Indicates a style sheet transformation. TYPE_BEACON 19 Indicates a beacon post. TYPE_FETCH 20 Indicates a load initiated by the GlobalFetch.fetch() method, which is available as a global ...
... content policy implementations, and should not be used outside Gecko core code. TYPE_INTERNAL_AUDIO 30 An internal constant used to represent content loaded from <audio> elements. Important: This type is mapped to TYPE_MEDIA before being passed to content policy implementations, and should not be used outside Gecko core code. TYPE_INTERNAL_VIDEO 31 An internal constant used to represent content loaded from <video> elements. Important: This type is mapped to TYPE_MEDIA before being passed to content policy implementations, and should not be used outside Gecko core code. TYPE_INTERNAL_TRACK 32 An internal constant used to represent content loaded from <track> elements. Important: ...
Archived Mozilla and build documentation - Archive of obsolete content
HTTP Class Overview This document provides an overview of the classes used by the Mozilla HTTP implementation. It's meant as a guide to developers wishing to understand or extend the Mozilla HTTP implementation. Introducing the Audio API extension The Audio Data API extension extends the HTML5 specification of the <audio> and <video> media elements by exposing audio metadata and raw audio data. This enables users to visualize audio data, to process this audio data and to create new audio data. Java in Firefox Extensions If you are in need of calling Java code from within a Firefox extension, you can make use of LiveConnect. LiveConnect gives your extension's JavaScript cod...
... provide a powerful JavaScript debugging environment for Mozilla based browsers namely Firefox, Netscape 7.x/9.x and SeaMonkey. Note that it is not included in the Gecko-based browsers such as K-Meleon, Galeon and Netscape 8.x. Venkman has been provided as part of the Mozilla install distribution since October 2001, as well as an extension package in XPI format. Video presentations Mozilla is actively working to produce video presentations that can help you learn how the Mozilla codebase works and how to take advantage of its technology in your own applications and extensions. This article is a jumping-off point to help you find those presentations. Gecko - the Smart Embedding Choice xbDesignMode.js ...
NPAPI plugin developer guide - Archive of obsolete content
Important: Plugins are now a legacy technology. They are not available on most mobile devices. Mozilla encourages website developers to avoid using plugins wherever possible. ...
... Important: Plugins are now a legacy technology. They are not available on most mobile devices. Mozilla encourages website developers to avoid using plugins wherever possible. ...
Windows Media in Netscape - Archive of obsolete content
l using JavaScript and provides working examples. This article deals uniquely with Netscape 7.1 running on the Windows operating system. Detecting the Right Browser Like Internet Explorer, Netscape 7.1 and later versions can play Windows Media files using the popular Windows Media Player ActiveX control. This control is widely used to provide inline media support for web pages that provide sound, video and other media. Controls such as Windows Media Player also interact closely with the scripts in a web page. Netscape 7.1 is the first Netscape Gecko(TM) browser to support the Windows Media Player as an ActiveX control -- previous Netscape browsers did not support any ActiveX controls, and thus detecting which versions of Netscape support the Windows Media ActiveX control is an important first s...
...ML Behaviors or use MSXML in conjunction with the control. Examples of Usage in Netscape 7.1 and IE All these samples consist of one page of markup (and script) that works in both IE and Netscape 7.1. No code forking has been used. The min-object-usage.html sample shows a minimalist control manipulated by scripting and HTML buttons. An object element creates the controls. The embedded-audio-video.html shows both scripting the control and callbacks. closecap-outtakes.html shows the closed captioning workaround and scripting. Original Document Information Authors: Arun Ranganathan, Bob Clary, Ian Oeschger Last Updated Date: 30 Jun 2003 Copyright Information: Copyright (C) 2001-2003 Netscape. All rights reserved. ...
Index - Game development
ges: # Page Tags and summary 1 Game development Apps, Game Development, Gamedev, Games, HTML5 Games, JavaScript Games, Web Gaming is one of the most popular computer activities. New technologies are constantly arriving to make it possible to develop better and more powerful games that can be run in any standards-compliant web browser. 2 Anatomy of a video game Games, JavaScript, Main Loop, requestAnimationFrame I want to be clear that any of the above, or none of them, could be best for your game. The correct decision entirely depends on the trade-offs that you are willing (and unwilling) to make. The concern is mostly with switching to another option. Fortunately, I do not have any experience with this, but I have heard it is an excruci...
...plementation: Static maps Canvas, Games, JavaScript, Static, atlas, spritesheet, tilemap, tilemaps, tiles This article covers how to implement static square tilemaps using the Canvas API. 38 WebRTC data channels API, Games, NeedsContent, Network, P2P, WebRTC, data channels The WebRTC (Web Real-Time Communications) API is primarily known for its support for audio and video communications; however, it also offers peer-to-peer data channels. This article explains more about this, and shows you how to use libraries to implement data channels in your game. 39 Tools for game development Games, Gecko, Guide, JavaScript On this page you can find links to our game development tools articles, which eventually aims to cover frameworks, compilers, and deb...
Unconventional controls - Game development
uff up, pausing and restarting the game. All that is needed is checking for key presses: window.addEventListener("keydown", function(event) { switch(event.keyCode) { case 8: { // pause the game break; } case 588: { // detonate bomb break; } // ... } }, this); You can see it in action by watching this video. Leap Motion Have you ever thought about controlling a game only with your hands? It's possible with Leap Motion, an immersive controller for games and apps. Leapmotion is becoming more and more popular due to very good integration with VR headsets -- demoing Rainbow Membrane on an Oculus Rift with Leap Motion attached to it was voted one of the best WebVR experiences by JavaScript developers ...
...exact proximity value. All three are calculated in centimetres. Note: See the DeviceProximityEvent reference page for more details. MaKey MaKey If you want to go completely bananas you can use MaKey MaKey, a board that can turn anything into a controller -- it's all about connecting real-world, conductive objects to a computer and using them as touch interfaces. Check out the banana piano video, and be sure to visit the quick start guide for all the needed info. There's even a Cylon.js-supported Makey Button functionality inspired by the MaKey MaKey board, so you can use the popular Cylon robotics framework for your experiments with Arduino or Raspberry Pi. Connecting the boards and using them may look like this: var Cylon = require('cylon'); Cylon.robot({ connections: { arduino...
Media (Audio-visual presentation) - MDN Web Docs Glossary: Definitions of Web-related terms
The term media (more accurately, multimedia) refers to audio, video, or combined audio-visual material such as music, recorded speech, movies, TV shows, or any other form of content that is presented over a period of time. More broadly, media may include still images such as photographs or other still images. Media content can be recorded, played back, presented, and at times interacted with in various ways. ...
... may include still images such as photographs or other still images. ...
WebRTC - MDN Web Docs Glossary: Definitions of Web-related terms
RTCDataChannel Provides a method to set up a peer-to-peer data pathway between browsers. ...
... RTCDataChannel Provides a method to set up a peer-to-peer data pathway between browsers. ...
WebVTT - MDN Web Docs Glossary: Definitions of Web-related terms
WebVTT files provide metadata that is time-aligned with audio or video content like captions or subtitles for video content, text video descriptions, chapters for content navigation, and more. ...
... WebVTT (Web Video Text Tracks) is a W3C specification for a file format marking up text track resources in combination with the HTML <track> element. WebVTT files provide metadata that is time-aligned with audio or video content like captions or subtitles for video content, text video descriptions, chapters for content navigation, and more. Learn more General knowledge WebVTT on Wikipedia Technical reference WebVTT on MDN Specification ...
Accessibility - Learn web development
s. Sites should also not cause harm: web features like motion can cause migraines or epileptic seizures. By default, HTML is accessible, if used correctly. Web accessibility involves ensuring that content remains accessible, regardless of who and how the web is accessed. The Firefox Accessibility Inspector is a very useful tool for checking out accessibility issues on web pages. The following video provides a nice introduction to it: Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites To get the most out of this module, it would be a good idea to either work through at least the first two modules of the HTML, CSS, and JavaScript topics, or perhaps even be...
...ated content can be difficult. WAI-ARIA is a technology that can help with such problems by adding in further semantics that browsers and assistive technologies can recognize and use to let users know what is going on. Here we'll show how to use it at a basic level to improve accessibility. Accessible multimedia Another category of content that can create accessibility problems is multimedia -- video, audio, and image content need to be given proper textual alternatives, so they can be understood by assistive technologies and their users. This article shows how. Mobile accessibility With web access on mobile devices being so popular, and popular platforms such as iOS and Android having fully-fledged accessibility tools, it is important to consider the accessibility of your web content on th...
Images, media, and form elements - Learn web development
ome of the main things that you need to know. Prerequisites: Basic computer literacy, basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.) Objective: To understand the way that some elements behave unusually when styled with CSS. Replaced elements Images and video are described as replaced elements. This means that CSS cannot affect the internal layout of these elements -- only their position on the page amongst other elements. As we will see however, there are various things that CSS can do with an image. Certain replaced elements, such as images and video, are also described as having an aspect ratio. This means that it has a size in both the horizontal...
...an the box and doesn't stretch to fill it. The other is larger than 200 pixels and overflows the box. So what can we do about the overflowing issue? As we learned in our previous lesson, a common technique is to make the max-width of an image 100%. This will enable the image to become smaller in size than the box but not larger. This technique will work with other replaced elements such as <video>s, or <iframe>s. Try adding max-width: 100% to the <img> element in the example above. You will see that the smaller image remains unchanged, but the larger one becomes smaller to fit into the box. You can make other choices about images inside containers. For example, you may want to size an image so it completely covers a box. The object-fit property can help you here. When using object-fit ...
What is a URL? - Learn web development
rver is handling parameters is by asking the Web server owner. #SomewhereInTheDocument is an anchor to another part of the resource itself. An anchor represents a sort of "bookmark" inside the resource, giving the browser the directions to show the content located at that "bookmarked" spot. On an HTML document, for example, the browser will scroll to the point where the anchor is defined; on a video or audio document, the browser will try to go to the time the anchor represents. It is worth noting that the part after the #, also known as the fragment identifier, is never sent to the server with the request. Note: There are some extra parts and some extra rules regarding URLs, but they are not relevant for regular users or Web developers. Don't worry about this, you don't need to know them ...
...wser's address bar to get to the resource behind it. But this is only the tip of the iceberg! The HTML language -- which will be discussed later on -- makes extensive use of URLs: to create links to other documents with the <a> element; to link a document with its related resources through various elements such as <link> or <script>; to display media such as images (with the <img> element), videos (with the <video> element), sounds and music (with the <audio> element), etc.; to display other HTML documents with the <iframe> element. Note: When specifying URLs to load resources as part of a page (such as when using the <script>, <audio>, <img>, <video>, and the like), you should generally only use HTTP and HTTPS URLs, with few exceptions (one notable one being data:; see Data URLs). Us...
Basic native form controls - Learn web development
attribute. In addition, if you want to let the user pick more than one file, you can do so by adding the multiple attribute. Example In this example, a file picker is created that requests graphic image files. The user is allowed to select multiple files in this case. ...
...ser is allowed to select multiple files in this case. <input type="file" name="file" id="file" accept="image/*" multiple> On some mobile devices, the file picker can access photos, videos, and audio captured directly by the device's camera and microphone by adding capture information to the accept attribute like so: <input type="file" accept="image/*;capture=camera"> <input type="file" accept="video/*;capture=camcorder"> <input type="file" accept="audio/*;capture=microphone"> Common attributes Many of the elements used to define form controls have some of their own specific attributes. However, there is a set of attributes common to all form elements. You've met some of these already, but below is a list of those common attributes, for your reference: Attribute name Default va...
Document and website structure - Learn web development
amentals. How hyperlinks work, as covered in Creating hyperlinks. Objective: Learn how to structure your document using semantic tags, and how to work out the structure of a simple website. Basic sections of a document Webpages can and will look pretty different from one another, but they all tend to share similar standard components, unless the page is displaying a fullscreen video or game, is part of some kind of art project, or is just badly structured: header: Usually a big strip across the top with a big heading, logo, and perhaps a tagline. This usually stays the same from one webpage to another. navigation bar: Links to the site's main sections; usually represented by menu buttons, links, or tabs. Like the header, this content usually remains consistent from one...
...ners consider the navigation bar to be part of the header rather than an individual component, but that's not a requirement; in fact, some also argue that having the two separate is better for accessibility, as screen readers can read the two features better if they are separate. main content: A big area in the center that contains most of the unique content of a given webpage, for example, the video you want to watch, or the main story you're reading, or the map you want to view, or the news headlines, etc. This is the one part of the website that definitely will vary from page to page! sidebar: Some peripheral info, links, quotes, ads, etc. Usually, this is contextual to what is contained in the main content (for example on a news article page, the sidebar might contain the author's bio, ...
Structuring the web with HTML - Learn web development
first one. Introduction to HTML This module sets the stage, getting you used to important concepts and syntax, looking at applying HTML to text, how to create hyperlinks, and how to use HTML to structure a webpage. Multimedia and embedding This module explores how to use HTML to include multimedia in your web pages, including the different ways that images can be included, and how to embed video, audio, and even entire other webpages. HTML tables Representing tabular data on a webpage in an understandable, accessible way can be a challenge. This module covers basic table markup, along with more complex features such as implementing captions and summaries. Solving common HTML problems Use HTML to solve common problems provides links to sections of content explaining how to use HTML t...
...e in an understandable, accessible way can be a challenge. This module covers basic table markup, along with more complex features such as implementing captions and summaries. Solving common HTML problems Use HTML to solve common problems provides links to sections of content explaining how to use HTML to solve very common problems when creating a webpage: dealing with titles, adding images or videos, emphasizing content, creating a basic form, etc. ...
Drawing graphics - Learn web development
and the other stroke. The final example should look like so: Note: The finished code is available on GitHub as 4_canvas_text.html. Have a play and see what you can come up with! You can find more information on the options available for canvas text at Drawing text. Drawing images onto canvas It is possible to render external images onto your canvas. These can be simple images, frames from videos, or the content of other canvases. For the moment we'll just look at the case of using some simple images on our canvas. As before, make another fresh copy of our canvas template (1_canvas_template.html) in which to draw the new example. In this case you'll also need to save a copy of our sample image -- firefox.png -- in the same directory. Images are drawn onto canvas using the drawIm...
...frame, we rotate our cube slightly on its X and Y axes, then render the scene as viewed by our camera, then finally call requestAnimationFrame() to schedule drawing our next frame. Let's have another quick look at what the finished product should look like: You can find the finished code on GitHub. Note: In our GitHub repo you can also find another interesting 3D cube example -- Three.js Video Cube (see it live also). This uses getUserMedia() to take a video stream from a computer web cam and project it onto the side of the cube as a texture! Summary At this point, you should have a useful idea of the basics of graphics programming using Canvas and WebGL and what you can do with these APIs, as well as a good idea of where to go for further information. Have fun! ...
Third-party APIs - Learn web development
rors. If the pageNumber is already 0, we simply return out of the function, to avoid wasting processing power (If we are already at the first page, we don't need to load the same results again). Note: You can find our finished nytimes API example code on GitHub (also see it running live here). YouTube example We also built another example for you to study and learn from -- see our YouTube video search example. This uses two related APIs: The YouTube Data API to search for YouTube videos and return results. The YouTube IFrame Player API to display the returned video examples inside IFrame video players so you can watch them. This example is interesting because it shows two related third-party APIs being used together to build an app. The first one is a RESTful API, while the second...
.... ...
CSS performance optimization - Learn web development
animating properties that do not trigger a reflow (and therefore also a repaint) very well. To improve performance, the node being animated can be moved off the main thread and onto the GPU. Properties that will lead to compositing include 3D transforms (transform: translateZ(), rotate3d(), etc.), animating transform and opacity, position: fixed, will-change, and filter. Some elements, including <video>, <canvas> and <iframe>, are also on their own layer. When an element is promoted as a layer, also known as composited, animating transform properties is done in the GPU, resulting in improved performance, especially on mobile. will-change property The CSS will-change property tells browsers which properties of an element are expected to change enabling browsers to set up optimizations before t...
... rest of the document tree. This allows the browser to recalculate layout, style, paint, size, or any combination of them for a limited area of the DOM and not the entire page. Conclusion Previous Overview: Performance Next In this module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance See Also CSS animation performance ...
Perceived performance - Learn web development
em when the page becomes usable, or, loading them when they become necessary. Loading additional assets and resources after initial page load improves perceived performance. Loading essential data in initial requests and progressively loading features and data only as needed helps mitigate low bandwidth and lower spec hardware. Additionally, you should optimize the assets you do load. Images and video should be served in the most optimal format, compressed, and in the correct size. Prevent jumping content and other reflows Images or other assets causing content to be pushed down or jump to a different location, like the loading of third party advertisements, can make the page feel like it is still loading and is bad for perceived performance. Content reflowing is especially bad for user expe...
...e the content downloaded, rendered, and responded more quickly. Now that we know what we should be speeding up, let's take a look at some metrics and learn how we can measure these events. Previous Overview: Performance Next In this module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance ...
The business case for web performance - Learn web development
to a single file, a file type, all files loaded on a page, a specific metric, or a threshold over a period of time.The budget reflects reachable goals; whehter they are time, quantity, or rule based. Definining and promoting a budget helps performance proponent advocates for good user experience against competing interests, such as marketing, sales, or even other developers that may want to add videos, 3rd party scripts, or even frameworks. Performance budgets help developer teams protect optimal performane for users while enabling the business to tap into new markets and deliver custom experiences. key performance indicators Setting key performance indicators (KPI) as objectives can hiltie performance objectives that are also business objectives. KPIs can be both a set of important busines...
...operations, etc.) is directly related to how to web performance. (source needed). Area of conflict - not prioritizing web performance, but expecting good business metrics (see the three above). Previous Overview: Performance In this module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance ...
JavaScript performance - Learn web development
Previous Overview: Performance Next While images and video account for over 70% of the bytes downloaded for the average website, byte per byte, JavaScript has a greater negative impact on performance. This article looks to introduce performance issues caused by scripts and introduces tips and tricks for optimizing JavaScript for web performance. Prerequisites: Basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. Objective: To learn about the effects of JavaScript on performance optimization, and how a JavaScript file size is not the only impact on web performance. Similar to images and video, the best way to improve performance is to omit what is not, in fact, necessary. But not all bytes downloaded ha...
... web pages impacts performance. In the next article we take a look at some HTML features that can impact performance, including some attributes specifically created to improve performance. Previous Overview: Performance Next In this module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance ...
The "why" of web performance - Learn web development
ulted in a 40% decrease in wait time, a 15% increase in SEO traffic and a 15% increase in conversion rate to signup. To build websites and applications people want to use; to attract and retain site visitors, you need to create an accessible site that provides a good user experience. Building websites requires HTML, CSS, and JavaScript, typically including binary file types such as images and video. The decisions you make and the tools you choose as you build your site can greatly affect the performance of the finished work. Good performance is an asset. Bad performance is a liability. Site speed directly affects bounce rates, conversion, revenue, user satisfaction, and search engine ranking. Performant sites have been shown to increase visitor retention and user satisfaction. Slow content...
...nization or business. Good or bad website performance correlates powerfully to user experience, as well as the overall effectiveness of most sites. This is why you should care about web performance. Overview: Performance Next In this module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance ...
Experimental features in Firefox
n HTMLMediaElement, thereby changing where the audio is being output. See bug 934425 for more details. Release channel Version added Enabled by default? Nightly 64 No Developer Edition 64 No Beta 64 No Release 64 No Preference name media.setsinkid.enabled HTMLMediaElement properties: audioTracks and videoTracks Enabling this feature adds the HTMLMediaElement.audioTracks and HTMLMediaElement.videoTracks properties to all HTML media elements. However, because Firefox doesn't currently suport multiple audio and video tracks, the most common use cases for these properties don't work, so they're both disabled by default. See bug 1057233 for more details. Release channel Version added E...
...ault? Nightly 62 No Developer Edition 62 No Beta 62 No Release 62 No Preference name media.mediasource.experimental.enabled AVIF (AV1 Image File format) support With this feature enabled, Firefox supports the AV1 Image File (AVIF) format. This is a still image file format that leverages the capabilities of the AV1 video compression algorithms to reduce image size. See bug 1443863 for more details. Release channel Version added Enabled by default? Nightly 77 No Developer Edition 77 No Beta 77 No Release 77 No Preference name image.avif.enabled AV1 support for Firefox on Android This feature allows Firefox on Androi...
HTML parser threading
hread tokenizer. Likewise for the tree builders. The "last was carriage return" flag is copied over also. A runnable is dispatched to the parser thread to call to mark the parser uninterrupted and to call nsHtml5StreamParser::ParseAvailableData() on the parser thread. mTokenizerMutex is released. Speculative Loads When the tree builder on the parser thread encounters HTML script, stylesheet link, video (with a poster frame), base or img or SVG script, style or image elements, preload operations are appended to a speculative load queue. There speculative load operations are flushed to the main thread (via the staging area) whenever tree ops are flushed and also whenever nsHtml5StreamParser::ParseAvailableData() is about to stop working. That is, when the parser thread is parsing speculatively, s...
...nt.write() tokenizer/tree builder synchronously also sends speculative loads to the tree op executor. The executor acts on the speculative load queue when the runnable dispatched by nsHtml5StreamParser::ParseAvailableData() fires and right before executing tree ops whenever tree ops are executed. When the executor acts on speculative loads, it starts speculative HTTP fetches for images (including video poster frames), style sheets and scripts. Additionally, the speculative load queue is used for transferring information from the parser thread to the main thread when the information needs to arrive before starting any speculative loads and when the information is known not to be speculative. There are two such pieces of information: the manifest URL for an App Cache manifest and the character en...
Index
Mozilla › Tech › XPCOM › Index
etails. 497 nsIDOMHTMLMediaElement Firefox 3.5, Gecko 1.9.1, Interfaces, Interfaces:Scriptable, XPCOM, XPCOM Interface Reference No summary! 498 nsIDOMHTMLSourceElement DOM, HTML, HTML5, Interfaces, Interfaces:Scriptable, Media, XPCOM, XPCOM Interface Reference The nsIDOMHTMLSourceElement interface is the DOM interface to the source child of the audio and video media elements in HTML. 499 nsIDOMHTMLTimeRanges Interfaces, Media, XPCOM Interface Reference The nsIDOMHTMLTimeRanges interface represents a set of time ranges in media; it's primarily used by the nsIDOMHTMLMediaElement interface, and implements the DOM TimeRanges interface. 500 nsIDOMJSWindow Interfaces, XPCOM, XPCOM API Reference, XPCOM Interface Reference ...
...hrome script running in a window, simply use new DOMParser(). When you create a DOMParser from a privileged script, you can pass parameters to the constructor, more on that below. 512 nsIDOMProgressEvent Interfaces, Interfaces:Scriptable, Reference, XMLHttpRequest, XPCOM Interface Reference, nsIDOMProgressEvent, progress The nsIDOMProgressEvent is used in the media elements (<video> and <audio>) to inform interested code of the progress of the media download. This implementation is a placeholder until the specification is complete, and is compatible with the WebKit ProgressEvent. 513 nsIDOMSerializer DOM, Interfaces, Interfaces:Scriptable Implemented by: @mozilla.org/xmlextras/xmlserializer;1. To create an instance, use: 514 nsIDOMSimpleGestu...
AbortController.AbortController() - Web APIs
We first create a controller using the AbortController() constructor, then grab a reference to its associated AbortSignal object using the AbortController.signal property. When the fetch request is initiated, we pass in the AbortSignal as an option inside the request's options object (see {signal}, below). ...
...elow). This associates the signal and controller with the fetch request and allows us to abort it by calling AbortController.abort(), as seen below in the second event listener. var controller = new AbortController(); var signal = controller.signal; var downloadBtn = document.querySelector('.download'); var abortBtn = document.querySelector('.abort'); downloadBtn.addEventListener('click', fetchVideo); abortBtn.addEventListener('click', function() { controller.abort(); console.log('Download aborted'); }); function fetchVideo() { ... fetch(url, {signal}).then(function(response) { ... }).catch(function(e) { reports.textContent = 'Download error: ' + e.message; }) } Note: When abort() is called, the fetch() promise rejects with an AbortError. You can find a full working...
AbortController.abort() - Web APIs
The abort() method of the AbortController interface aborts a DOM request (e.g. a Fetch request) before it has completed. This is able to abort fetch requests, consumption of any response Body, and streams. Syntax controller.abort(); Parameters None. Return value Void. Examples In the following snippet, we aim to download a video using the Fetch API. We first create a controller using the AbortController() constructor, then grab a reference to its associated AbortSignal object using the AbortController.signal property. When the fetch request is initiated, we pass in the AbortSignal as an option inside the request's options object (see {signal}, below). This associates the signal and controller with the fetch request and allows us to abort it by calling AbortController.abort(...
...elow). This associates the signal and controller with the fetch request and allows us to abort it by calling AbortController.abort(), as seen below in the second event listener. var controller = new AbortController(); var signal = controller.signal; var downloadBtn = document.querySelector('.download'); var abortBtn = document.querySelector('.abort'); downloadBtn.addEventListener('click', fetchVideo); abortBtn.addEventListener('click', function() { controller.abort(); console.log('Download aborted'); }); function fetchVideo() { ... fetch(url, {signal}).then(function(response) { ... }).catch(function(e) { reports.textContent = 'Download error: ' + e.message; }) } Note: When abort() is called, the fetch() promise rejects with an AbortError. You can find a full working...
AbortController.signal - Web APIs
The signal read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort a DOM request as desired. Syntax var signal = abortController.signal; Value An AbortSignal object instance. Examples In the following snippet, we aim to download a video using the Fetch API. We first create a controller using the AbortController() constructor, then grab a reference to its associated AbortSignal object using the AbortController.signal property. When the fetch request is initiated, we pass in the AbortSignal as an option inside the request's options object (see {signal}, below). This associates the signal and controller with the fetch request and allows us to abort it by calling AbortController.abort(), as seen below...
...elow). This associates the signal and controller with the fetch request and allows us to abort it by calling AbortController.abort(), as seen below in the second event listener. var controller = new AbortController(); var signal = controller.signal; var downloadBtn = document.querySelector('.download'); var abortBtn = document.querySelector('.abort'); downloadBtn.addEventListener('click', fetchVideo); abortBtn.addEventListener('click', function() { controller.abort(); console.log('Download aborted'); }); function fetchVideo() { ... fetch(url, {signal}).then(function(response) { ... }).catch(function(e) { reports.textContent = 'Download error: ' + e.message; }) } Note: When abort() is called, the fetch() promise rejects with an AbortError. You can find a full working...
AbortController - Web APIs
oller object instance. Properties AbortController.signal Read only Returns a AbortSignal object instance, which can be used to communicate with/abort a DOM request. Methods AbortController.abort() Aborts a DOM request before it has completed. This is able to abort fetch requests, consumption of any response Body, and streams. Examples In the following snippet, we aim to download a video using the Fetch API. We first create a controller using the AbortController() constructor, then grab a reference to its associated AbortSignal object using the AbortController.signal property. When the fetch request is initiated, we pass in the AbortSignal as an option inside the request's options object (see {signal}, below). This associates the signal and controller with the fetch request and...
...elow). This associates the signal and controller with the fetch request and allows us to abort it by calling AbortController.abort(), as seen below in the second event listener. var controller = new AbortController(); var signal = controller.signal; var downloadBtn = document.querySelector('.download'); var abortBtn = document.querySelector('.abort'); downloadBtn.addEventListener('click', fetchVideo); abortBtn.addEventListener('click', function() { controller.abort(); console.log('Download aborted'); }); function fetchVideo() { ... fetch(url, {signal}).then(function(response) { ... }).catch(function(e) { reports.textContent = 'Download error: ' + e.message; }) } Note: When abort() is called, the fetch() promise rejects with a DOMException named AbortError. You can f...
AbortSignal - Web APIs
is event using addEventListener() or by assigning an event listener to the oneventname property of this interface. abort Invoked when the DOM request(s) the signal is communicating with is/are aborted. Also available via the onabort property. Methods The AbortSignal interface inherits methods from its parent interface, EventTarget. Examples In the following snippet, we aim to download a video using the Fetch API. We first create a controller using the AbortController() constructor, then grab a reference to its associated AbortSignal object using the AbortController.signal property. When the fetch request is initiated, we pass in the AbortSignal as an option inside the request's options object (see {signal}, below). This associates the signal and controller with the fetch request and...
...elow). This associates the signal and controller with the fetch request and allows us to abort it by calling AbortController.abort(), as seen below in the second event listener. var controller = new AbortController(); var signal = controller.signal; var downloadBtn = document.querySelector('.download'); var abortBtn = document.querySelector('.abort'); downloadBtn.addEventListener('click', fetchVideo); abortBtn.addEventListener('click', function() { controller.abort(); console.log('Download aborted'); }); function fetchVideo() { ... fetch(url, {signal}).then(function(response) { ... }).catch(function(e) { reports.textContent = 'Download error: ' + e.message; }) } Note: When abort() is called, the fetch() promise rejects with an AbortError. Current version of Firefox...
AudioTrack - Web APIs
The most common use for accessing an AudioTrack object is to toggle its enabled property in order to mute and unmute the track. Properties enabled A Boolean value which controls whether or not the audio track's sound is enabled. Setting this value to false mutes the track's audio. id Read only A DOMString which uniquely identifies the track within the media. This ID can be used to locate a specific track within an audio track list by calling AudioTrackList.getTrackById(). ...
... the track was not created by a SourceBuffer or the SourceBuffer has been removed from the MediaSource.sourceBuffers attribute of its parent media source. Usage notes To get an AudioTrack for a given media element, use the element's audioTracks property, which returns an AudioTrackList object from which you can get the individual tracks contained in the media: var el = document.querySelector("video"); var tracks = el.audioTracks; You can then access the media's individual tracks using either array syntax or functions such as forEach(). This first example gets the first audio track on the media: var firstTrack = tracks[0]; The next example scans through all of the media's audio tracks, enabling any that are in the user's preferred language (taken from a variable userLanguage) and disabl...
CanvasRenderingContext2D.drawImage() - Web APIs
to the canvas. Syntax void ctx.drawImage(image, dx, dy); void ctx.drawImage(image, dx, dy, dWidth, dHeight); void ctx.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight); Parameters image An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas. sx Optional The x-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context. sy Optional The y-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context. sWidth Optional The width of the sub-rectangle of th...
...he drawImage() method uses the source element's intrinsic size in CSS pixels when drawing. For example, if you load an Image and specify the optional size parameters in its constructor, you will have to use the naturalWidth and naturalHeight properties of the created instance to properly calculate things like crop and scale regions, rather than element.width and element.height. The same goes for videoWidth and videoHeight if the element is a <video> element, and so on. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); const image = new Image(60, 45); // Using optional size for image image.onload = drawImageActualSize; // Draw when image has loaded // Load an image of intrinsic size 300x227 in CSS pixels im...
Canvas API - Web APIs
The Canvas API largely focuses on 2D graphics. The WebGL API, which also uses the <canvas> element, draws hardware-accelerated 2D and 3D graphics. Basic example This simple example draws a green rectangle onto a canvas. ...
...is a related interface. Guides and tutorials Canvas tutorial A comprehensive tutorial covering both the basic usage of the Canvas API and its advanced features. HTML5 Canvas Deep Dive A hands-on, book-length introduction to the Canvas API and WebGL. Canvas Handbook A handy reference for the Canvas API. Demo: A basic ray-caster A demo of ray-tracing animation using canvas. Manipulating video using canvas Combining <video> and <canvas> to manipulate video data in real time. Libraries The Canvas API is extremely powerful, but not always simple to use. The libraries listed below can make the creation of canvas-based projects faster and easier. EaselJS is an open-source canvas library that makes creating games, generative art, and other highly graphical experiences easy. Fabric.j...
DisplayMediaStreamConstraints - Web APIs
Processing information is specified using MediaTrackConstraints objects providing options which are applied to the track after the media data is received but before it is made available on the MediaStream. Properties audio A Boolean or MediaTrackConstraints value; if a Boolean, this value simply indicates whether or not to include an audio track in the MediaStream returned by getDisplayMedia(). ...
...f a Boolean, this value simply indicates whether or not to include an audio track in the MediaStream returned by getDisplayMedia(). If a MediaTrackConstraints object is provided here, an audio track is included in the stream, but the audio is processed to match the specified constraints after being retrieved from the hardware but before being added to the MediaStream. The default value is false. video If true (the default), the display contents are included in a MediaStreamTrack within the stream provided by getDisplayMedia(). Optionally, a MediaTrackConstraints object may be given, providing options specifying processing to be performed on the video data before adding it to the stream. A value of false is not permitted, and results in a TypeError being thrown. Specifications Spec...
Document.fullscreenEnabled - Web APIs
is a no-operation and it will be ignored. Syntax var isFullscreenAvailable = document.fullscreenEnabled; Value A Boolean value which is true if the document and the elements within can be placed into full-screen mode by calling Element.requestFullscreen(). If full-screen mode isn't available, this value is false. ...
...n be placed into full-screen mode by calling Element.requestFullscreen(). If full-screen mode isn't available, this value is false. Example In this example, before attempting to request full-screen mode for a <video> element, the value of fullscreenEnabled is checked, in order to avoid making the attempt when not available. function requestFullScreen() { if (document.fullscreenEnabled) { videoElement.requestFullScreen(); } else { console.log('Your browser cannot use fullscreen right now'); } } Specifications Specification Status Comment Fullscreen APIThe definition of 'Document.fullscreenEnabled' in that specification. Living Standard Initial definition ...
Introduction to the File and Directory Entries API - Web APIs
few examples of how you can use the File and Directory Entries API: Apps with persistent uploader When a file or directory is selected for upload, you can copy the file into a local sandbox and upload a chunk at a time. The app can restart uploads after an interruption, such as the browser being closed or crashing, connectivity getting interrupted, or the computer getting shut down. Video game or other apps with lots of media assets The app downloads one or several large tarballs and expands them locally into a directory structure. The app pre-fetches assets in the background, so the user can go to the next task or game level without waiting for a download. Audio or photo editor with offline access or local cache (great for performance and speed) The app can write t...
...ands them locally into a directory structure. The app pre-fetches assets in the background, so the user can go to the next task or game level without waiting for a download. Audio or photo editor with offline access or local cache (great for performance and speed) The app can write to files in place (for example, overwriting just the ID3/EXIF tags and not the entire file). Offline video viewer The app can download large files (>1GB) for later viewing. The app can access partially downloaded files (so that you can watch the first chapter of your DVD, even if the app is still downloading the rest of the content or if the app didn't complete the download because you had to run to catch a train). Offline web mail client The client downloads attachments and stores them...
Fullscreen API - Web APIs
g for the site or app to programmatically do so. Make sure you provide, somewhere in your user interface, appropriate user interface elements that inform the user that this option is available to them. Note: Navigating to another page, changing tabs, or switching to another application using any application switcher (or Alt-Tab) will likewise exit full-screen mode. Example In this example, a video is presented in a web page. Pressing the Return or Enter key lets the user toggle between windowed and full-screen presentation of the video. View Live Examples Watching for the Enter key When the page is loaded, this code is run to set up an event listener to watch for the Enter key. document.addEventListener("keypress", function(e) { if (e.keyCode === 13) { toggleFullScreen(); } }, ...
...me, you'll want to check for prefixed versions of this (mozFullScreenElement, msFullscreenElement, or webkitFullscreenElement, for example). If the value is null, the document is currently in windowed mode, so we need to switch to full-screen mode; otherwise, it's the element that's currently in full-screen mode. Switching to full-screen mode is done by calling Element.requestFullscreen() on the <video> element. If full-screen mode is already active (fullscreenElement is not null), we call exitFullscreen() on the document to shut off full-screen mode. Specifications Specification Status Fullscreen API Living Standard Browser compatibility Document.fullscreen The compatibility table on this page is generated from structured data. If you'd like to contribu...
msAudioCategory - Web APIs
ot use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The msAudioCategory property of the HTML <audio> element, is a read/write proprietary attribute, specific to Internet Explorer and Microsoft Edge. msAudioCategory specifies the purpose of the audio or video media, such as background audio or alerts. Syntax <audio controls="controls" msaudiocategory="BackgroundCapableMedia"> </audio> The msAudioCategory property offers a variety of values that can enhance the behavior of your audio-aware app. Note that you must set the msAudioCategory before setting the src property in code. Value Include a description of the property's value, including dat...
...ping or longer running alert sounds: Alarms Ring tones Ringing notification Sounds that need to attenuate existing audio No BackgroundCapableMedia For audio that needs to continue playing in the background. Examples include the following local media playback scenarios: Local playlist Streaming radio Streaming playlist Music videos Streaming audio/radio, YouTube, Netflix, etc. Yes Communications For streaming communication audio such as the following: VOIP Real time chat or other type of phone calls Should not be used in non-real-time or non-communication scenarios, such as audio and/or video playback, as playback startup latency is affected. *Note that if msAudioCategor...
HTMLMediaElement.canPlayType() - Web APIs
Return value A DOMString indicating how likely it is that the media can be played. The string will be one of the following values: probably Media of the type indicated by the mediaType parameter is probably playable on this device. ...
...ollowing values: probably Media of the type indicated by the mediaType parameter is probably playable on this device. maybe Not enough information is available to determine for sure whether or not the media will play until playback is actually attempted. "" (empty string) Media of the given type definitely can't be played on the current device. Example var obj = document.createElement('video'); console.log(obj.canPlayType('video/mp4')); // "maybe" Specifications Specification Status Comment HTML Living StandardThe definition of 'canplaytype' in that specification. Living Standard HTML5The definition of 'HTMLMediaElement.canplaytype' in that specification. Recommendation Initial definition. ...
HTMLMediaElement.error - Web APIs
t for the most recent error, or null if there has not been an error. When an error event is received by the element, you can determine details about what happened by examining this object. Syntax var myError = HTMLMediaElement.error; Value A MediaError object describing the most recent error to occur on the media element or null if no errors have occurred. ...
...e element, you can determine details about what happened by examining this object. Syntax var myError = HTMLMediaElement.error; Value A MediaError object describing the most recent error to occur on the media element or null if no errors have occurred. Example This example establishes a video element and adds an error handler to it; the error handler simply logs the details to console. var videoElement = document.createElement('video'); videoElement.onerror = function() { console.log("Error " + videoElement.error.code + "; details: " + videoElement.error.message); } videoElement.src = "https://example.com/bogusvideo.mp4"; Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.error' in that specification. Living...
HTMLMediaElement.load() - Web APIs
. load() will reset the element and rescan the available sources, thereby causing the changes to take effect. Syntax mediaElement.load(); Parameters None. Return value undefined. Usage notes Calling load() aborts all ongoing operations involving this media element, then begins the process of selecting and loading an appropriate media resource given the options specified in the <audio> or <video> element and its src attribute or child <source> element(s). This is described in more detail in Supporting multiple formats in Video and audio content. The process of aborting any ongoing activities will cause any outstanding Promises returned by play() being resolved or rejected as appropriate based on their status before the loading of new media can begin. Pending play promises are aborted wi...
... emptied event is sent. If resetting the playback position to the beginning of the media actually changes the playback position (that is, it was not already at the beginning), a timeupdate event is sent. Once media has been selected and loading is ready to begin, the loadstart event is delivered. From this point onward, events are sent just like any media load. Example This example finds a <video> element in the document and resets it by calling load(). var mediaElem = document.querySelector("video"); mediaElem.load(); Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.load()' in that specification. Living Standard Initial definition. HTML5The definition of 'HTMLMediaElement.load()' in that specifi...
HTMLMediaElement: loadedmetadata event - Web APIs
of channels. mozSampleRate Read only int The sample rate per second. mozFrameBufferLength Read only int The number of samples collected in all channels. Examples These examples add an event listener for the HTMLMediaElement's loadedmetadata event, then post a message when that event handler has reacted to the event firing. ...
...Rate Read only int The sample rate per second. mozFrameBufferLength Read only int The number of samples collected in all channels. Examples These examples add an event listener for the HTMLMediaElement's loadedmetadata event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('loadedmetadata', (event) => { console.log('The duration and dimensions ' + ' of the media and tracks are now known. '); }); Using the onloadedmetadata event handler property: const video = document.querySelector('video'); video.onloadedmetadata = (event) => { console.log('The duration and dimensions ' + ' of the media and tracks are now known. '); };...
HTMLMediaElement: pause event - Web APIs
No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onpause Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's pause event, then post a message when that event handler has reacted to the event firing. ...
...nt Target Element Default Action None Event handler property GlobalEventHandlers.onpause Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's pause event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('pause', (event) => { console.log('The Boolean paused property is now true. Either the ' + 'pause() method was called or the autoplay attribute was toggled.'); }); Using the onpause event handler property: const video = document.querySelector('video'); video.onpause = (event) => { console.log('The Boolean paused property is now true. Either the ' + 'pause() m...
HTMLMediaElement: play event - Web APIs
le No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onplay Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's play event, then post a message when that event handler has reacted to the event firing. ...
...vent Target Element Default Action None Event handler property GlobalEventHandlers.onplay Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's play event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('play', (event) => { console.log('The Boolean paused property is now false. Either the ' + 'play() method was called or the autoplay attribute was toggled.'); }); Using the onplay event handler property: const video = document.querySelector('video'); video.onplay = (event) => { console.log('The Boolean paused property is now false. Either the ' + 'play() meth...
HTMLMediaElement.readyState - Web APIs
Possible values are: Constant Value Description HAVE_NOTHING 0 No information is available about the media resource. HAVE_METADATA 1 Enough of the media resource has been retrieved that the metadata attributes are initialized. Seeking will no longer raise an exception. HAVE_CURRENT_DATA 2 Data is available for the current playback position, but not enough to actually play more than one frame. ...
... attributes are initialized. Seeking will no longer raise an exception. HAVE_CURRENT_DATA 2 Data is available for the current playback position, but not enough to actually play more than one frame. HAVE_FUTURE_DATA 3 Data for the current playback position as well as for at least a little bit of time into the future is available (in other words, at least two frames of video, for example). HAVE_ENOUGH_DATA 4 Enough data is available--and the download rate is high enough--that the media can be played through to the end without interruption. Examples This example will listen for audio data to be loaded for the element `example`. It will then check if at least the current playback position has been loaded. If it has, the audio will play. <audio i...
HTMLMediaElement.seekToNextFrame() - Web APIs
n the media. This non-standard method is part of an experimentation process around support for non-real-time access to media for tasks including filtering, editing, and so forth. You should not use this method in production code, because its implementation may change--or be removed outright--without notice. You are, however, invited to experiment with it. This method lets you access frames of video media without the media being performed in real time. This also lets you access media using frames as a seek unit rather than timecodes (albeit only by seeking one frame at a time until you get to the frame you want). Possible uses for this method include filtering and editing of video content. This method returns immediately, returning a Promise, whose fulfillment handler is called when the see...
... Syntax var seekCompletePromise = HTMLMediaElement.seekToNextFrame(); HTMLMediaElement.seekToNextFrame(); Return value A Promise which is fulfilled once the seek operation has completed. Firefox 49 returns undefined instead of a promise, and performs the seek operation synchronously. ...
HTMLMediaElement: timeupdate event - Web APIs
is dependant on the system load, but will be thrown between about 4Hz and 66Hz (assuming the event handlers don't take longer than 250ms to run). User agents are encouraged to vary the frequency of the event based on the system load and the average cost of processing the event each time, so that the UI updates are not any more frequent than the user agent can comfortably handle while decoding the video. Bubbles No Cancelable No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.ontimeupdate Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's timeupdate event, then post a message when that event handler has reacted ...
...fault Action None Event handler property GlobalEventHandlers.ontimeupdate Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's timeupdate event, then post a message when that event handler has reacted to the event firing. Remember, the event frequency is dependant on the system load. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('timeupdate', (event) => { console.log('The currentTime attribute has been updated. Again.'); }); Using the ontimeupdate event handler property: const video = document.querySelector('video'); video.ontimeupdate = (event) => { console.log('The currentTime attribute has been updated. Again.'); }; Specifications Specificati...
msStereo3DPackingMode - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. msStereo3DPackingMode is a read/write property which gets or sets the frame-packing mode for stereo 3-D video content. This proprietary property is specific to Internet Explorer and Microsoft Edge. Syntax HTMLVideoElement.msStereo3DPackingMode(topbottom, sidebyside, none); Value The following values return, or set, the stereo 3-D content packing as "topbottom", "sidebyside", or "none" for regular 2-D video. none (0): Specifies regular 2-D video. topbottom (1): Specifies stereo 3-D content pac...
...t, the stereo 3-D content packing as "topbottom", "sidebyside", or "none" for regular 2-D video. none (0): Specifies regular 2-D video. topbottom (1): Specifies stereo 3-D content packing and that the views are packed side-by-side in a single frame. sidebyside (2): Specifies sidebyside stereo 3-D content packing and that the views are packed top-to-bottom in a single frame. See also HTMLVideoElement Microsoft API extensions ...
msStereo3DRenderMode - Web APIs
es facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. msStereo3DRenderMode is a read/write property which gets or sets whether the system display is set to stereo display (if stereo-capable). ...
...s set to stereo display (if stereo-capable). This proprietary property is specific to Internet Explorer and Microsoft Edge. Syntax HTMLVideoElement.msStereo3DRenderMode(mono, stereo); Value The following values set the stereo display to mono or stereo. The default is mono. ...
ImageCapture() constructor - Web APIs
The ImageCapture() constructor creates a new ImageCapture object. Syntax const imageCapture = new ImageCapture(videoTrack) Parameters videoTrack A MediaStreamTrack from which the still images will be taken. This can be any source, such as an incoming stream of a video conference, a playing movie, or the stream from a webcam. Return value A new ImageCapture object which can be used to capture still frames from the specified video track. Example The following example shows how to use a call to MediaDevices.getUserMedia() to retrieve the MediaStreamTrack needed by the ImageCapture() constructor. ...
...coming stream of a video conference, a playing movie, or the stream from a webcam. Return value A new ImageCapture object which can be used to capture still frames from the specified video track. Example The following example shows how to use a call to MediaDevices.getUserMedia() to retrieve the MediaStreamTrack needed by the ImageCapture() constructor. navigator.mediaDevices.getUserMedia({video: true}) .then(mediaStream => { document.querySelector('video').srcObject = mediaStream const track = mediaStream.getVideoTracks()[0]; imageCapture = new ImageCapture(track); }) .catch(error => console.log(error)); Specifications Specification Status Comment MediaStream Image CaptureThe definition of 'ImageCapture' in that specification. Working Draft...
LocalMediaStream - Web APIs
generated locally (such as by getUserMedia(). However, getUserMedia() now returns a MediaStream instead, and this interface has been removed from the specification. Warning: This interface is no longer available in any mainstream browser. Do not use LocalMediaStream; you need to update any code that does use it as soon as possible or your content or application will stop working. See Stopping a video stream in MediaStreamTrack to learn how. All other functionality is found in MediaStream. The primary reason for this interface to exist was to add a stop() method to its MediaStream parent interface. However, control over playback of media has been moved to the individual MediaStreamTrack objects, so this is no longer necessary. Instead, media is stopped by calling MediaStreamTrack.stop() on e...
...reamTrack.stop() demonstrates how to stop a multi-track stream, which is what LocalMediaStream.stop() used to be used for. Methods LocalMediaStream.stop() Stops the stream. When the source of the stream is a connected device (such as a camera or microphone), capture of media from the device is halted. This method is no longer available with the deprecation of LocalMediaStream. See Stopping a video stream in MediaStreamTrack to learn how to stop an entire stream. Specifications Not part of any specification. This interface was previously part of Media Capture and Streams but was removed in 2013. ...
MediaCapabilities.encodingInfo() - Web APIs
rties supported, smooth, and powerefficient, which describe how compatible the device is with the type of media. Syntax mediaCapabilities.encodingInfo(mediaEncodingConfiguration) Parameters mediaEncodingConfiguration A valid MediaEncodingConfiguration dictionary containing a valid media encoding type of record or transmission and a valid media configuration: either an AudioConfiguration or VideoConfiguration dictionary. Return value A Promise fulfilling with a MediaCapabilitiesInfo interface containing three Boolean attributes: supported smooth powerEfficient Exceptions A TypeError is raised if the MediaConfiguration passed to the encodingInfo() method is invalid, either because the type is not video or audio, the contentType is not a valid codec MIME type, or any other error ...
...he encodingInfo() method is invalid, either because the type is not video or audio, the contentType is not a valid codec MIME type, or any other error in the media configuration passed to the method, including omitting any of the media encoding configuration elements. Example //Create media configuration to be tested const mediaConfig = { type : 'record', // or 'transmission' video : { contentType : "video/webm;codecs=vp8.0", // valid content type width : 1920, // width of the video height : 1080, // height of the video bitrate : 120000, // number of bits used to encode 1s of video framerate : 48 // number of frames making up that 1s. } }; // check support and performance navigator.mediaCapabilities.encodingInfo(mediaCo...
MediaDecodingConfiguration - Web APIs
h, and/or power efficient. Properties A MediaDecodingConfiguration dictionary takes two properties: type -- the type of media being tested. This takes one of two values: file: Represents a configuration that is meant to be used for a plain file playback. media-source: Represents a configuration that is meant to be used for playback of a MediaSource. A media configuration -- a VideoConfiguration or AudioConfiguration dictionary. Examples //Create media configuration to be tested const mediaConfig = { type : 'file', // or 'media-source' video : { contentType : "video/webm;codecs=vp8", // valid content type width : 800, // width of the video height : 600, // height of the video bitrate : 10000, // number of bits used to encode ...
...uration or AudioConfiguration dictionary. Examples //Create media configuration to be tested const mediaConfig = { type : 'file', // or 'media-source' video : { contentType : "video/webm;codecs=vp8", // valid content type width : 800, // width of the video height : 600, // height of the video bitrate : 10000, // number of bits used to encode 1s of video framerate : 30 // number of frames making up that 1s. } }; // check support and performance navigator.mediaCapabilities.decodingInfo(mediaConfig).then(result => { console.log('This configuration is ' + (result.supported ? '' : 'not ') + 'supported.') }); Specifications Specification Status Comment Media CapabilitiesThe definition of 'MediaDecodin...
MediaDevices.enumerateDevices() - Web APIs
ole.log("enumerateDevices() not supported."); return; } // List cameras and microphones. ...
... = " + device.deviceId); }); }) .catch(function(err) { console.log(err.name + ": " + err.message); }); This might produce: videoinput: id = csO9c0YpAf274OuCPUA53CNE0YHlIr2yXCi+SqfBZZ8= audioinput: id = RKxXByjnabbADGQNNZqLVLdmXlS0YkETYCIbg+XxnvM= audioinput: id = r2/xw1xUPIyZunfV1lGrKOma5wTOvCkWfZ368XCndm0= or if one or more MediaStreams are active or persistent permissions are granted: videoinput: FaceTime HD Camera (Built-in) id=csO9c0YpAf274OuCPUA53CNE0YHlIr2yXCi+SqfBZZ8= audioinput: default (Built-in Microphone) id=RKxXByjnabbADGQNNZqLVLdmXlS0YkETYCIbg+XxnvM= audioinput: Built-in Microphone id=r2/xw1xUPIyZunfV1lGrKOma5wTOvCkWfZ368XCndm0= Specifications Specification Status Comment Media Capture and StreamsThe definition of 'mediaDevices: enumerateDevices...
MediaEncodingConfiguration - Web APIs
ient. Properties A MediaEncodingConfiguration dictionary takes two properties: type -- the type of media being tested; takes one of two values: record -- Represents a configuration for recording of media, e.g. using MediaRecorder. transmission -- Represents a configuration meant to be transmitted over electronic means (e.g. using RTCPeerConnection). A media configuration -- a VideoConfiguration AudioConfiguration dictionary. Examples //Create media configuration to be tested const mediaConfig = { type : 'record', // or 'transmission' video : { contentType : "video/webm;codecs=vp8", // valid content type width : 800, // width of the video height : 600, // height of the video bitrate : 10000, // number of bits used to encode 1...
...guration AudioConfiguration dictionary. Examples //Create media configuration to be tested const mediaConfig = { type : 'record', // or 'transmission' video : { contentType : "video/webm;codecs=vp8", // valid content type width : 800, // width of the video height : 600, // height of the video bitrate : 10000, // number of bits used to encode 1s of video framerate : 30 // number of frames making up that 1s. } }; // check support and performance navigator.mediaCapabilities.encodingInfo(mediaConfig).then(result => { console.log('This configuration is ' + (result.supported ? '' : 'not ') + 'supported.') }); Specifications Specification Status Comment Media CapabilitiesThe definition of 'MediaEncodin...
MediaError.code - Web APIs
Web › API › MediaError › code
having previously been available. MEDIA_ERR_DECODE 3 Despite having previously been determined to be usable, an error occurred while trying to decode the media resource, resulting in an error. MEDIA_ERR_SRC_NOT_SUPPORTED 4 The associated resource or media provider object (such as a MediaStream) has been found to be unsuitable. ...
...termined to be usable, an error occurred while trying to decode the media resource, resulting in an error. MEDIA_ERR_SRC_NOT_SUPPORTED 4 The associated resource or media provider object (such as a MediaStream) has been found to be unsuitable. Example This example creates a <video> element, establishes an error handler for it, and then sets the element's src attribute to the video resource to present in the element. The error handler simply outputs a message var obj = document.createElement('video'); obj.onerror = function() {console.log("Error with media: " + obj.error.code);} obj.src="https://example.com/blahblah.mp4"; Specifications Specification Status Comment HTML Living StandardThe definition of 'MediaError.code' in that specification. ...
MediaRecorder.mimeType - Web APIs
re standardized by the Internet Assigned Numbers Authority (IANA). For their official list of defined media type strings, see the article Media Types on the IANA site. See also media types to learn more about media types and how they're used in web content and by web browers. Example ... if (navigator.mediaDevices) { console.log('getUserMedia supported.'); var constraints = { audio: true, video: true }; var chunks = []; navigator.mediaDevices.getUserMedia(constraints) .then(function(stream) { var options = { audioBitsPerSecond: 128000, videoBitsPerSecond: 2500000, mimeType: 'video/mp4' } var mediaRecorder = new MediaRecorder(stream,options); m = mediaRecorder; m.mimeType; // would return 'video/mp4' ... }) .ca...
...oBitsPerSecond: 2500000, mimeType: 'video/mp4' } var mediaRecorder = new MediaRecorder(stream,options); m = mediaRecorder; m.mimeType; // would return 'video/mp4' ... }) .catch(function(error) { console.log(error.message); }); Changing line 14 to the following causes MediaRecorder to try to use AVC Constrained Baseline Profile Level 4 for video and AAC-LC (Low Complexity) for audio, which is good for mobile and other possible resource-constrained situations. mimeType: 'video/mp4; codecs="avc1.424028, mp4a.40.2"' Assuming this configuration is acceptable to the user agent, the value returned later by m.mimeType would then be video/mp4; codecs="avc1.424028, mp4a.40.2". Specifications Specification Status Comment ...
MediaRecorder.onerror - Web APIs
Try again later."); break; case SecurityError: showNotification("Recording the specified source " + "is not allowed due to security " + "restrictions."); break; default: showNotification("A problem occurred while trying " + "to record the ...
... right " + "now. Try again later."); break; case SecurityError: showNotification("Recording the specified source " + "is not allowed due to security " + "restrictions."); break; default: showNotification("A problem occurred while trying " + "to record the video."); break; } }; /* this would be a good place to create a Worker to handle writing the buffers to disk periodically */ recorder.start(100); /* 100ms time slices per buffer */ return recorder; } Specifications Specification Status Comment MediaStream RecordingThe definition of 'MediaRecorder.onerror' in that specification. Working Draft ...
MediaRecorder - Web APIs
The MediaRecorder interface of the MediaStream Recording API provides functionality to easily record media. It is created using the MediaRecorder() constructor. Constructor MediaRecorder() Creates a new MediaRecorder object, given a MediaStream to record. Options are available to do things like set the container's MIME type (such as "video/webm" or "video/mp4") and the bit rates of the audio and video tracks or a single overall bit rate. Properties MediaRecorder.mimeType Read only Returns the MIME type that was selected as the recording container for the MediaRecorder object when it was created. MediaRecorder.state Read only Returns the current state of the MediaRecorder object (inactive, recording, or paused.) MediaRecorder.stream Read only Returns the stream that was passed...
...r object (inactive, recording, or paused.) MediaRecorder.stream Read only Returns the stream that was passed into the constructor when the MediaRecorder was created. MediaRecorder.ignoreMutedMedia Indicates whether the MediaRecorder instance will record input when the input MediaStreamTrack is muted. If this attribute is false, MediaRecorder will record silence for audio and black frames for video. The default is false. MediaRecorder.videoBitsPerSecond Read only Returns the video encoding bit rate in use. This may differ from the bit rate specified in the constructor (if it was provided). MediaRecorder.audioBitsPerSecond Read only Returns the audio encoding bit rate in use. This may differ from the bit rate specified in the constructor (if it was provided). Methods MediaRecorder...
MediaSource.readyState - Web APIs
Syntax var myReadyState = mediaSource.readyState; Value A DOMString. ...
... Recommendation Initial definition. ...
MediaStream - Web APIs
Each track is specified as an instance of MediaStreamTrack.You can obtain a MediaStream object either by using the constructor or by calling MediaDevices.getUserMedia(). Some user agents subclass this interface to provide more precise information or functionality, like in CanvasCaptureMediaStream. Constructor MediaStream() Creates and returns a new MediaStream object. You can create an empty stream, a stream which is based upon an existing stream, or a stream that contains a specified list of tracks (specified as an array of MediaStreamTrack objects). ...
...f no track with that ID does exist, it returns null. If several tracks have the same ID, it returns the first one. MediaStream.getTracks() Returns a list of all MediaStreamTrack objects stored in the MediaStream object, regardless of the value of the kind attribute. The order is not defined, and may not only vary from one browser to another, but also from one call to another. MediaStream.getVideoTracks() Returns a list of the MediaStreamTrack objects stored in the MediaStream object that have their kind attribute set to "video". The order is not defined, and may not only vary from one browser to another, but also from one call to another. MediaStream.removeTrack() Removes the MediaStreamTrack given as argument. If the track is not part of the MediaStream object, nothing happens. E...
MediaStreamAudioSourceNode() - Web APIs
) to obtain access to the user's camera, then creates a new MediaStreamAudioSourceNode from its MediaStream. ...
...w MediaStreamAudioSourceNode from its MediaStream. ...
MediaStreamConstraints - Web APIs
nation--but not necessarily all--of the following properties will exist on the object. Track constraints audio Either a Boolean (which indicates whether or not an audio track is requested) or a MediaTrackConstraints object providing the constraints which must be met by the audio track included in the returned MediaStream. If constraints are specified, an audio track is inherently requested. video Either a Boolean (which indicates whether or not a video track is requested) or a MediaTrackConstraints object providing the constraints which must be met by the video track included in the returned MediaStream. If constraints are specified, a video track is inherently requested. Security peerIdentity A DOMString identifying the peer who has sole access to the stream. If this property is s...
... be met by the video track included in the returned MediaStream. If constraints are specified, a video track is inherently requested. Security peerIdentity A DOMString identifying the peer who has sole access to the stream. If this property is specified, only the indicated peer can receive and use the stream. Streams isolated in this way can only be displayed in a media element (<audio> or <video>) where the content is protected just as if CORS cross-origin rules were in effect. When a peer identity is set, MediaStreamTracks from that peer have their isolated flag set to true. ...
MediaStreamTrack.applyConstraints() - Web APIs
treamTrack interface applies a set of constraints to the track; these constraints let the Web site or app establish ideal values and acceptable ranges of values for the constrainable properties of the track, such as frame rate, dimensions, echo cancelation, and so forth. Constraints can be used to ensure that the media meets certain guidelines you prefer. For example, you may prefer high-density video but require that the frame rate be a little low to help keep the data rate low enough not overtax the network. Constraints can also specify ideal and/or acceptable sizes or ranges of sizes. See Applying constraints in Capabilities, constraints, and settings for more information on how to apply your preferred constraints. Syntax const appliedPromise = track.applyConstraints([constraints]) Param...
...n image size of 1920 by 1280 is the preferred or an aspect ratio of 1.333 if that is not available. Note that these constraints also illustrate what the spec refers to as a backoff strategy. const constraints = { width: {min: 640, ideal: 1280}, height: {min: 480, ideal: 720}, advanced: [ {width: 1920, height: 1280}, {aspectRatio: 1.333} ] }; navigator.mediaDevices.getUserMedia({ video: true }) .then(mediaStream => { const track = mediaStream.getVideoTracks()[0]; track.applyConstraints(constraints) .then(() => { // Do something with the track such as using the Image Capture API. }) .catch(e => { // The constraints could not be satisfied by the available devices. }); }); Specifications Specification Status Comment Media Capture and ...
MediaStreamTrack.enabled - Web APIs
erface is a Boolean value which is true if the track is allowed to render the source stream or false if it is not. This can be used to intentionally mute a track. When enabled, a track's data is output from the source to the destination; otherwise, empty frames are output. In the case of audio, a disabled track generates frames of silence (that is, frames in which every sample's value is 0). For video tracks, every frame is filled entirely with black pixels. The value of enabled, in essence, represents what a typical user would consider the muting state for a track, whereas the muted property indicates a state in which the track is temporarily unable to output data, such as a scenario in which frames have been lost in transit. Note: If the track has been disconnected, the value of this prop...
...k has been disconnected, the value of this property can be changed, but has no effect. Syntax const enabledFlag = track.enabled track.enabled = [true | false] Value When true, enabled indicates that the track is permitted to render its actual media to the output. When enabled is set to false, the track only generates empty frames. Empty audio frames have every sample's value set to 0. Empty video frames have every pixel set to black. Note: When implementing a mute/unmute feature, you should use the enabled property. Usage notes If the MediaStreamTrack represents the video input from a camera, disabling the track by setting enabled to false also updates device activity indicators to show that the camera is not currently recording or streaming. For example, the green "in use" light nex...
MediaStreamTrack.stop() - Web APIs
the same source (for example, if two tabs are using the device's microphone), the source itself isn't necessarily immediately stopped. It is instead disassociated from the track and the track object is stopped. Once no media tracks are using the source, the source may actually be completely stopped. Immediately after calling stop(), the readyState property is set to ended. ...
...hone), the source itself isn't necessarily immediately stopped. It is instead disassociated from the track and the track object is stopped. Once no media tracks are using the source, the source may actually be completely stopped. Immediately after calling stop(), the readyState property is set to ended. Examples Stopping a video stream In this example, we see a function which stops a streamed video by calling stop() on every track on a given <video>. function stopStreamedVideo(videoElem) { const stream = videoElem.srcObject; const tracks = stream.getTracks(); tracks.forEach(function(track) { track.stop(); }); videoElem.srcObject = null; } This works by obtaining the video element's stream from its srcObject property. Then the stream's track list is obtained by calling its ...
MediaTrackConstraints.displaySurface - Web APIs
captured. This value does not affect the list of display sources in the browser's user interface. See How constraints are defined in Capabilities, constraints, and settings for an explanation of how to define constraints. Usage notes You can check the setting selected by the user agent after the display media has been created by getDisplayMedia() by calling getSettings() on the display media's video MediaStreamTrack, then checking the value of the returned MediaTrackSettings object's displaySurface object. For example, if your app needs to know that the surface being shared is a monitor or application--meaning that there's possibly a non-content backdrop--it can use code similar to this: let mayHaveBackdropFlag = false; let displaySurface = displayStream.getVideoTracks()[0].getSettings().
...Flag = true; } Following this code, mayHaveBackdrop is true if the display surface contained in the stream is of type monitor or application; either of these may have non-content backdrop areas. Later code can use this flag to determine whether or not to perform special processing, such as to remove or replace the backdrop, or to "cut" the individual display areas out of the received frames of video. Examples Here are some example constraints objects for getDisplayMedia() that make use of the displaySurface property. In addition, see Example: Constraint exerciser in Capabilities, constraints, and settings for a complete example showing how constraints are used. TBD Specifications Specification Status Comment Screen CaptureThe definition of 'MediaTrackConstrai...
MediaTrackConstraints.facingMode - Web APIs
nfamiliar with. Because RTP doesn't include this information, tracks associated with a WebRTC RTCPeerConnection will never include this property. Syntax var constraintsObject = { facingMode: constraint }; constraintsObject.facingMode = constraint; Value An object based on ConstrainDOMString specifying one or more acceptable, ideal, and/or exact (mandatory) facing modes are acceptable for a video track. An exact value in this case indicates that the specified facing mode is specifically required; for example: var constraints = { facingMode: { exact: "user" } }; This indicates that only a user-facing camera is acceptable; if there is no user-facing camera, or the user declines permission to use that camera, the media request will fail. The following strings are permitted values for t...
...de: { exact: "user" } }; This indicates that only a user-facing camera is acceptable; if there is no user-facing camera, or the user declines permission to use that camera, the media request will fail. The following strings are permitted values for the facing mode. These may represent separate cameras, or they may represent directions in which an adjustable camera can be pointed. "user" The video source is facing toward the user; this includes, for example, the front-facing camera on a smartphone. "environment" The video source is facing away from the user, thereby viewing their environment. This is the back camera on a smartphone. "left" The video source is facing toward the user but to their left, such as a camera aimed toward the user but over their left shoulder. "right" The vid...
MediaTrackSupportedConstraints.frameRate - Web APIs
ate property is a read-only Boolean value which is present (and set to true) in the object returned by MediaDevices.getSupportedConstraints() if and only if the user agent supports the frameRate constraint. If the constraint isn't supported, it's not included in the list, so this value will never be false. The frameRate constraint can be used to establish acceptable upper and lower bounds on the video frame rate for a new video track, or to specify an exact frame rate that must be provided for the request to succeed. Checking the value of this property lets you determine if the user agent allows constraining the video track configuration by frame rate. See the example to see how this can be used. Syntax frameRateConstraintSupported = supportedConstraintsDictionary.frameRate; Value This pro...
...ent allows constraining the video track configuration by frame rate. See the example to see how this can be used. Syntax frameRateConstraintSupported = supportedConstraintsDictionary.frameRate; Value This property is present in the dictionary if the user agent supports the frameRate constraint. If the property isn't present, the user agent doesn't allow specifying limits on the frame rate for video tracks. If this property is present, its value is always true. Example This simple example looks to see if your browser supports constraining the frame rate when requesting video tracks. JavaScript let result = document.getElementById("result"); if (navigator.mediaDevices.getSupportedConstraints().frameRate) { result.innerHTML = "Supported!"; } else { result.innerHTML = "Not suppo...
msIsBoxed - Web APIs
Web › API › MsIsBoxed
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. msIsBoxed is a property which gets or sets when the video player control is in boxed (letterbox or pillarbox) mode. This proprietary property is specific to Internet Explorer and Microsoft Edge. Returns true if the video is in letterbox or pillarbox mode. Letterbox format displays black bars on the top and bottom of a video to fill in between the wide screen format of a video, and the aspect ratio of the screen. Typically the video's left and right edges go to the full width of the screen. Pillarbo...
...ernet Explorer and Microsoft Edge. Returns true if the video is in letterbox or pillarbox mode. Letterbox format displays black bars on the top and bottom of a video to fill in between the wide screen format of a video, and the aspect ratio of the screen. Typically the video's left and right edges go to the full width of the screen. Pillarbox format displays black bars on the left and right of a video to fill in the difference between a video and a wider screen. With pillarbox format, the top and bottom edges of the video go to the full height of the screen. Syntax isBoxed = object.msIsBoxed Value Boolean value set to true activates boxed mode for the video player. Boolean value set to false means the video player is zoomed to fill the screen. ...
RTCPeerConnection.setRemoteDescription() - Web APIs
nalingState is "closed", indicating that the connection is not currently open, so negotiation cannot take place. InvalidSessionDescriptionError The RTCSessionDescription specified by the sessionDescription parameter is invalid. Example Here we see a function which handles an offer received from the remote peer. ...
...in the article Signaling and video calling; take a look at that for more details and a more in-depth explanation of what's going on. ...
RTCRtpEncodingParameters.scaleResolutionDownBy - Web APIs
The RTCRtpEncodingParameters dictionary's scaleResolutionDownBy property can be used to specify a factor by which to reduce the size of a video track during encoding. This property is only available for tracks whose kind is video. Syntax rtpEncodingParameters.scaleResolutionDownBy = scalingFactor; rtpEncodingParameters = { scaleResolutionDownBy: scalingFactor }; Value A double-precison floating-point number specifying the amount by which to reduce the size of the video during encoding. The default value, 1.0, means that the video will be encoded at its original size. ...
...deo. Syntax rtpEncodingParameters.scaleResolutionDownBy = scalingFactor; rtpEncodingParameters = { scaleResolutionDownBy: scalingFactor }; Value A double-precison floating-point number specifying the amount by which to reduce the size of the video during encoding. The default value, 1.0, means that the video will be encoded at its original size. A value of 2.0 would reduce the size of the video by a factor of 2 both horizontally and vertically, resulting in a video 25% the original size. A value less than 1.0 would cause the video to get larger rather than smaller, which is not the intent of this property. Therefore, specifying a value less than 1.0 is not permitted and will cause a RangeError exception to be thrown by RTCPeerConnection.addTransceiver() or RTCRtpSender.setParameters().
RTCRtpEncodingParameters - Web APIs
audio encodings. The user agent will try to match this as well as it can, but there is no guarantee. rid A DOMString which, if set, specifies an RTP stream ID (RID) to be sent using the RID header extension. This parameter cannot be modified using setParameters(). Its value can only be set when the transceiver is first created. scaleResolutionDownBy Only used for senders whose track's kind is video, this is a double-precision floating-point value specifying a factor by which to scale down the video during encoding. The default value, 1.0, means that the sent video's size will be the same as the original. A value of 2.0 scales the video frames down by a factor of 2 in each dimension, resulting in a video 1/4 the size of the original. The value must not be less than 1.0 (you can't use this to...
... double-precision floating-point value specifying a factor by which to scale down the video during encoding. The default value, 1.0, means that the sent video's size will be the same as the original. A value of 2.0 scales the video frames down by a factor of 2 in each dimension, resulting in a video 1/4 the size of the original. The value must not be less than 1.0 (you can't use this to scale the video up). Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCRtpEncodingParameters' in that specification. Candidate Recommendation Initial definition. ...
RTCRtpSendParameters.encodings - Web APIs
audio encodings. The user agent will try to match this as well as it can, but there is no guarantee. rid A DOMString which, if set, specifies an RTP stream ID (RID) to be sent using the RID header extension. This parameter cannot be modified using setParameters(). Its value can only be set when the transceiver is first created. scaleResolutionDownBy Only used for senders whose track's kind is video, this is a double-precision floating-point value specifying a factor by which to scale down the video during encoding. The default value, 1.0, means that the sent video's size will be the same as the original. A value of 2.0 scales the video frames down by a factor of 2 in each dimension, resulting in a video 1/4 the size of the original. The value must not be less than 1.0 (you can't use this to...
... double-precision floating-point value specifying a factor by which to scale down the video during encoding. The default value, 1.0, means that the sent video's size will be the same as the original. A value of 2.0 scales the video frames down by a factor of 2 in each dimension, resulting in a video 1/4 the size of the original. The value must not be less than 1.0 (you can't use this to scale the video up). Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCRtpSendParameters.encodings' in that specification. Candidate Recommendation Initial definition. ...
RTCRtpStreamStats.pliCount - Web APIs
The pliCount property of the RTCRtpStreamStats dictionary states the number of times the stream's receiving end sent a Picture Loss Indication (PLI) packet to the sender. A PLI packet indicates that some amount of encoded video data has been lost for one or more frames. Syntax var pliCount = RTCRtpStreamStats.pliCount; Value An integer value indicating the number of times a PLI packet was sent by the stream's receiver to the sender. A PLI message is used by video decoders (running on the receiving end of the stream) to notify the encoder (the sender) that an undefined amount of coded video data, which may span frame boundaries, has been lost. This may trigger the sender to send a full frame in order to allow the receiver to re-synchronize, since lost data may be an irrecoverable situatio...
... be an irrecoverable situation for decoding media. However, the primary purpose of this message is to allow the sender to consider techniques to mitigate network performance issues. This is often achieved by methods such as increasing the compression, lowering resolution, or finding other ways to reduce the bit rate of the stream. Note: This value is only available on the receiver, and only for video media. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCInboundRtpStreamStats: pliCount' in that specification. Candidate Recommendation Initial definition. Identifiers for WebRTC's Statistics APIThe definition of 'RTCOutboundRtpStreamStats: pliCount' in that specification. Candidate Recommendatio...
RTCSessionDescription.sdp - Web APIs
CSessionDescription.sdp is a read-only DOMString containing the SDP which describes the session. ...
...ontaining the SDP which describes the session. Syntax var value = sessionDescription.sdp; sessionDescription.sdp = value; Value The value is a DOMString containing an SDP message like this one: v=0 o=alice 2890844526 2890844526 IN IP4 host.anywhere.com s= c=IN IP4 host.anywhere.com t=0 0 m=audio 49170 RTP/AVP 0 a=rtpmap:0 PCMU/8000 m=video 51372 RTP/AVP 31 a=rtpmap:31 H261/90000 m=video 53000 RTP/AVP 32 a=rtpmap:32 MPV/90000 Example // The remote description has been set previously on pc, an RTCPeerConnection alert(pc.remoteDescription.sdp); Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCSessionDescription.sdp' in that specification. Candidate Recommendation Initial sp...
RTCStatsReport - Web APIs
as round-trip time) is unavailable, since those values can't be computed without knowing about the other peers' states. peer-connection A RTCPeerConnectionStats object provides statistics related to the overall peer connection's RTCPeerConnection. receiver Provides statistics about a specific RTCRtpReceiver. The statistics object is an RTCAudioReceiverStats object if kind is audio; if kind is video, the object is an RTCVideoReceiverStats object. remote-candidate The report is an RTCIceCandidateStats object containing statistics about the remote candidate's RTCIceTransport. This may include information such as the type of network, the protocol, the URL, the type of relay being used, and so forth. remote-inbound-rtp The report is an RTCRemoteInboundRtpStreamStats object providing statisti...
...ote peer is receiving data. remote-outbound-rtp The report is an RTCRemoteOutboundRtpStreamStats object that contains statistics about your inbound RTP (inbound-rtp) stream, but from the perspective of the remote peer. sender An object containing statistics about the RTCRtpSender for a stream on the RTCPeerConnection. If kind is "audio", this object is of type RTCAudioSenderStats; if kind is "video", this is an RTCVideoSenderStats object. stream An object of type RTCMediaStreamStats, providing statistics and information about a MediaStream which is part of the RTCPeerConnection. track The object is one of the types based on RTCMediaHandlerStats: for audio tracks, the type is RTCSenderAudioTrackAttachmentStats and for video tracks, the type is RTCSenderVideoTrackAttachmentStats. The data...
RTCStatsType - Web APIs
as round-trip time) is unavailable, since those values can't be computed without knowing about the other peers' states. peer-connection A RTCPeerConnectionStats object provides statistics related to the overall peer connection's RTCPeerConnection. receiver Provides statistics about a specific RTCRtpReceiver. The statistics object is an RTCAudioReceiverStats object if kind is audio; if kind is video, the object is an RTCVideoReceiverStats object. remote-candidate The report is an RTCIceCandidateStats object containing statistics about the remote candidate's RTCIceTransport. This may include information such as the type of network, the protocol, the URL, the type of relay being used, and so forth. remote-inbound-rtp The report is an RTCRemoteInboundRtpStreamStats object providing statisti...
...ote peer is receiving data. remote-outbound-rtp The report is an RTCRemoteOutboundRtpStreamStats object that contains statistics about your inbound RTP (inbound-rtp) stream, but from the perspective of the remote peer. sender An object containing statistics about the RTCRtpSender for a stream on the RTCPeerConnection. If kind is "audio", this object is of type RTCAudioSenderStats; if kind is "video", this is an RTCVideoSenderStats object. stream An object of type RTCMediaStreamStats, providing statistics and information about a MediaStream which is part of the RTCPeerConnection. track The object is one of the types based on RTCMediaHandlerStats: for audio tracks, the type is RTCSenderAudioTrackAttachmentStats and for video tracks, the type is RTCSenderVideoTrackAttachmentStats. The data...
Streams API - Web APIs
The Streams API allows JavaScript to programmatically access streams of data received over the network and process them as desired by the developer. Concepts and usage Streaming involves breaking a resource that you want to receive over a network down into small chunks, then processing it bit by bit. ...
... network down into small chunks, then processing it bit by bit. This is something browsers do anyway when receiving assets to be shown on webpages -- videos buffer and more is gradually available to play, and sometimes you'll see images display gradually as more is loaded. But this has never been available to JavaScript before. Previously, if we wanted to process a resource of some kind (be it a video, or a text file, etc.), we'd have to download the entire file, wait for it to be deserialized into a suitable format, then process the whole lot after it is fully received. With Streams being available to JavaScript, this all changes -- you can now start processing raw data with JavaScript bit by bit as soon as it is available on the client-side, without needing to generate a buffer, string, or ...
TextTrackList.onaddtrack - Web APIs
sents. The event is passed into the event handler in the form of a TrackEvent object, whose track property identifies the newly-added track. Note: You can also add a handler for the addtrack event using addEventListener(). Syntax TextTrackList.onaddtrack = eventHandler; Value Set onaddtrack to a function that accepts as input a TrackEvent object which indicates in its track property which video track has been added to the media. Usage notes The addtrack event is called whenever a new track is added to the media element whose video tracks are represented by the TextTrackList object. This happens when tracks are added to the element when the media is first attached to the element; one addtrack event will occur for each video track in the media resource. Example This snippet establishe...
...ew track is added to the media element whose video tracks are represented by the TextTrackList object. This happens when tracks are added to the element when the media is first attached to the element; one addtrack event will occur for each video track in the media resource. Example This snippet establishes a handler for the addtrack event that calls a function, addToTrackList(), passing in the VideoTrack object representing the newly-added track. In this scenario, that function's role is to add the new track to a list of video tracks available to choose from. document.querySelector("video").textTracks.onaddtrack = function(event) { addToTrackList(event.track); }; Specifications Specification Status Comment HTML Living StandardThe definition of 'TextTrackList...
TextTrackList.onchange - Web APIs
Note: You can also add a handler for the change event using addEventListener(). Syntax TextTrackList.onchange = eventHandler; Example This snippet establishes a handler for the change event that looks at each of the tracks in the list, calling a function to update the state of a user interface control that indicates the current state of the track. ...
.... Note: You can also add a handler for the change event using addEventListener(). Syntax TextTrackList.onchange = eventHandler; Example This snippet establishes a handler for the change event that looks at each of the tracks in the list, calling a function to update the state of a user interface control that indicates the current state of the track. var trackList = document.querySelector("video, audio").textTracks; trackList.onchange = function(event) { .... /* do something */ }; Specifications Specification Status Comment HTML Living StandardThe definition of 'TextTrackList: onchange' in that specification. Living Standard ...
TextTrackList: removeTrack event - Web APIs
The removetrack event is fired when a track is removed from a TextTrackList. ...
... Living Standard ...
TrackDefault.type - Web APIs
Web › API › TrackDefault › type
Example TBD ...
... Example TBD ...
TrackEvent.track - Web APIs
Web › API › TrackEvent › track
This identifies the track to which the event applies. Specifications Specification Status Comment HTML Living StandardThe definition of 'TrackEvent.track' in that specification. ...
...This identifies the track to which the event applies. Specifications Specification Status Comment HTML Living StandardThe definition of 'TrackEvent.track' in that specification. ...
WebGL2RenderingContext.texImage3D() - Web APIs
srcData); void gl.texImage3D(target, level, ...
... offset A GLintptr byte offset into the WebGLBuffer's data store. Used to upload data to the currently bound WebGLTexture from the WebGLBuffer bound to the PIXEL_UNPACK_BUFFER target. Return value None. Examples gl.texImage3D(gl.TEXTURE_3D, 0, // level gl.RGBA, // inte...
WebGL2RenderingContext.texSubImage3D() - Web APIs
Possible values: gl.TEXTURE_3D: A three-dimensional texture. gl.TEXTURE_2D_ARRAY: A two-dimensional array texture. level A GLint specifying the level of deta...
...pixel source for the texture: ArrayBufferView, A Uint8Array must be used if type is gl.UNSIGNED_BYTE. A Uint16Array must be used if type is either gl.UNSIGNED_SHORT_5_6_5, gl.UNSIGNED_SHORT_4_4_4_4, gl.UNSIGNED_SHORT_5_5_5_1, or ext.HALF_FLOAT_OES. A Float32Array must be used if type is gl.FLOAT. ImageBitmap, ImageData, HTMLImageElement, HTMLCanvasElement, HTMLVideoElement. offset A GLintptr byte offset into the WebGLBuffer's data store. Used to upload data to the currently bound WebGLTexture from the WebGLBuffer bound to the PIXEL_UNPACK_BUFFER target. Return value None. Examples gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, 1, gl.RGBA, gl.UNSIGNED_BYTE, image); Specifications Specification Status ...
Lifetime of a WebRTC session - Web APIs
WebRTC lets you build peer-to-peer communication of arbitrary data, audio, or video--or any combination thereof--into a browser application. In this article, we'll look at the lifetime of a WebRTC session, from establishing the connection all the way through closing the connection when it's no longer needed. This article doesn't get into details of the actual APIs involved in establishing and handling a WebRTC connection; it simply reviews the process in general with some information about why each step is required. See Signaling and video calling for an actual example with a step-by-step explanation of what the code does. This page is currently under construction, and some of the content will move to other pages as the WebRTC guide material is built out. Pardon our dust! Establishing...
...s an RTCPeerConnection object representing their end of the WebRTC session. Each peer establishes a handler for icecandidate events, which handles sending those candidates to the other peer over the signaling channel. Each peer establishes a handler for track event, which is received when the remote peer adds a track to the stream. This code should connect the tracks to its consumer, such as a <video> element. The caller creates and shares with the receiving peer a unique identifier or token of some kind so that the call between them can be identified by the code on the signaling server. The exact contents and form of this identifier is up to you. Each peer connects to an agreed-upon signaling server, such as a WebSocket server they both know how to exchange messages with. Each peer tells ...
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
ed reality (AR)--headset presents 3D imagery to us by drawing two views of the scene, slightly offset from one another just like the views obtained by our two eyes. These views are then separately fed to each eye, in order to allow them to collect the data our brain needs in order to construct a 3D image in our minds. To do this, WebXR asks your renderer to draw the scene twice for each frame of video--once for each eye. The two views are rendered into the same framebuffer, one on the left and one on the right. The XR device then uses screens and lenses to present the left half of the produced image to our left eye and the right half to our right eye. For example, consider a device which uses a 2560x1440 pixel frame buffer. Dividing this into two parts--half for each eye--results in each eye'...
...be made to take into account things such as user inputs from devices not controlled by WebXR, such as the keyboard and mouse. The adjusted domxref("XRReferenceSpace")}} returned by this function is then passed into the XRFrame method getViewerPose() to get the XRViewerPose representing the viewer's position and viewing angle. Next, we go ahead and queue up the request to render the next frame of video, so we don't have to worry about doing it later, by simply calling requestAnimationFrame() again. Now it's time to render the scene. If we did successfully obtain a pose, we get the XRWebGLLayer we need to use for rendering from the session's renderState object's baseLayer property. We bind this to WebGL's gl.FRAMEBUFFER target using the WebGLRenderingContext method gl.bindFrameBuffer(). Then w...
WebXR Device API - Web APIs
te system to further include support for a finite world with set boundaries. Unlike XRReferenceSpace, the origin must be located on the floor (that is, y = 0 at the floor). The x and z components of the origin are typically presumed to be located at or near the center of the room or surface. XRView Represents a single view into the XR scene for a particular frame. Each XRView corresponds to the video display surface used to present the scene to the user. For example, a given XR device might have two views: one for the left eye and one for the right. Each view has an offset used to shift the position of the view relative to the camera, in order to allow for creating stereographic effects. XRViewport Describes a viewport. A viewport is a rectangular portion of a graphic surface. In WebXR, a v...
...eality presentation before activating it. Including other media Positional audio in a 3D environment In 3D environments, which may either be 3D scenes rendered to the screen or a mixed reality experience experienced using a headset, it's important for audio to be performed so that it sounds like it's coming from the direction of its source. This guide covers how to accomplish this. Playing video in a 3D environment In this guide, we examine how to play video into a 3D scene. This technique can be used in both standard WebGL applications presented on a flat computer screen, or in a WebXR-generated virtual or augmented reality environment. Specifications Specification Status Comment WebXR Device API Working Draft Initial definition. ...
Example and tutorial: Simple synth keyboard - Web APIs
The first is the musical keyboard itself. ...
... allows you to switch among the standard waveforms as well as one custom waveform, and you can control the master gain using a volume slider beneath the keyboard. This example makes use of the following Web API interfaces: AudioContext, OscillatorNode, PeriodicWave, and GainNode. Because OscillatorNode is based on AudioScheduledSourceNode, this is to some extent an example for that as well. The video keyboard HTML There are three primary components to the display for our virtual keyboard. The first is the musical keyboard itself. We draw this in a pair of nested <div> elements so that we can make the keyboard horizontally scrollable if all the keys don't fit on the screen, without having them wrap around. The keyboard First, we create space to build the keyboard into. We will be programma...
Web APIs
Web › API
ent HTMLQuoteElement HTMLScriptElement HTMLSelectElement HTMLShadowElement HTMLSlotElement HTMLSourceElement HTMLSpanElement HTMLStyleElement HTMLTableCaptionElement HTMLTableCellElement HTMLTableColElement HTMLTableElement HTMLTableRowElement HTMLTableSectionElement HTMLTemplateElement HTMLTextAreaElement HTMLTimeElement HTMLTitleElement HTMLTrackElement HTMLUListElement HTMLUnknownElement HTMLVideoElement HashChangeEvent Headers History HkdfParams HmacImportParams HmacKeyGenParams I IDBCursor IDBCursorSync IDBCursorWithValue IDBDatabase IDBDatabaseException IDBDatabaseSync IDBEnvironment IDBEnvironmentSync IDBFactory IDBFactorySync IDBIndex IDBIndexSync IDBKeyRange IDBLocaleAwareKeyRange IDBMutableFile IDBObjectStore IDBObjectStoreSync IDBOpenDBRequest IDBRequ...
...Event ULongRange URL URLSearchParams URLUtilsReadOnly USB USBAlternateInterface USBConfiguration USBDevice USBEndpoint USBInTransferResult USBInterface USBIsochronousInTransferPacket USBIsochronousInTransferResult USBIsochronousOutTransferPacket USBIsochronousOutTransferResult USBOutTransferResult USVString UserDataHandler UserProximityEvent V VTTCue VTTRegion ValidityState VideoConfiguration VideoPlaybackQuality VideoTrack VideoTrackList VisualViewport W WEBGL_color_buffer_float WEBGL_compressed_texture_astc WEBGL_compressed_texture_atc WEBGL_compressed_texture_etc WEBGL_compressed_texture_etc1 WEBGL_compressed_texture_pvrtc WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_depth_texture WEBGL_draw...
ARIA - Accessibility
ored ARIA with actual assistive technology. Much as how browser emulators and simulators are not an effective solution for testing full support, proxy assistive technology solutions aren't sufficient to fully guarantee functionality. Tutorials Introduction to ARIA A quick introduction to making dynamic content accessible with ARIA. See also the classic ARIA intro by Gez Lemon, from 2008. Videos of screen readers using ARIA See both real and simplified examples from around the web, including "before" and "after" ARIA videos. Using ARIA A practical guide for developers. It suggests what ARIA attributes to use on HTML elements. Suggestions are based on implementation realities. Simple ARIA enhancements Enhancing page navigation with ARIA landmarks A nice intro to using ARIA landm...
... are also supported by NVDA with Firefox, and VoiceOver with Safari. References ARIA Roles Reference pages covering all the WAI-ARIA roles discussed on MDN. Standardization Efforts WAI-ARIA Specification The W3C specification itself. WAI-ARIA Authoring Practices The official best practices documents how best to ARIA-ify common widgets and interactions. An excellent resource. Videos Following talks are a great way to understand ARIA: ARIA, Accessibility APIs and coding like you give a damn! - Leonie Watson Filing Bugs File ARIA bugs on browsers, screen readers, and JavaScript libraries. Related topics Accessibility, AJAX, JavaScript ...
Cognitive accessibility - Accessibility
ents that get progressively worse. Other permanent cognitive impairments include aphasia, speech and language, autism, ADD/ADHD, dyslexia, and dyscalculia. An example of a temporary cognitive impairment could be people affected by substances such as alcohol or drugs. Another form it can take is depression, such as when mourning the loss of a loved one, or being momentarily saddened by a tweet or video they just saw online. A third example could be sleep deprivation. It may seem like an overwhelming challenge to address the wide range of cognitive differences, especially when solutions for two different people may be conflicting. One way to handle this is to focus on cognitive skills. Cognitive skills include: attention memory processing speed time management letters and language numbe...
...g. One way to handle this is to focus on cognitive skills. ...
Demos of open web technologies
canvas (code demos) 3D RayCaster processing.js p5js 3D on 2D Canvas miniPaint: Image editor (source code) Zen Photon Garden (source code) Multi touch in canvas demo (source code) SVG Bubblemenu (visual effects and interaction) HTML transformations using foreignObject (visual effects and transforms) Phonetics Guide (interactive) 3D objects demo (interactive) Blobular (interactive) Video embedded in SVG (or use the local download) Summer HTML image map creator (source code) Video Video 3D Animation "mozilla constantly evolving" Video 3D animation "Floating Dance" Streaming Anime, Movie Trailer and Interview Billy's Browser Firefox Flick Virtual Barber Shop Transformers Movie Trailer A Scanner Darkly Movie Trailer (with built in controls) Events firing and volume cont...
...he local download) Summer HTML image map creator (source code) Video Video 3D Animation "mozilla constantly evolving" Video 3D animation "Floating Dance" Streaming Anime, Movie Trailer and Interview Billy's Browser Firefox Flick Virtual Barber Shop Transformers Movie Trailer A Scanner Darkly Movie Trailer (with built in controls) Events firing and volume control Dragable and sizable videos 3D Graphics WebGL Web Audio Fireworks IoQuake3 (source code) Escher puzzle (source code) Kai 'Opua (source code) Virtual Reality The Polar Sea (source code) Sechelt fly-through (source code) CSS CSS Zen Garden CSS floating logo "mozilla" Paperfold CSS Blockout Rubik's cube Pure CSS Slides Planetarium (source code) Loader with blend modes Text reveal with clip-path Am...
Cross-browser audio basics - Developer guides
with the audio tag to further determine the way audio is initialized. autoplay Specifying autoplay will cause the audio to start playing as soon as possible and without any user interaction -- in short, the audio will autoplay. <audio autoplay> ... </audio> Note: This value is often ignored on mobile platforms, and its use is not recommended unless really necessary. Auto-playing audio (and video) is usually really annoying. Plus browsers have policies that will block autoplay entirely in many situations. See the Autoplay guide for media and Web Audio APIs for details. loop The loop attribute will ensure that upon getting to the end of the audio clip, the audio clip will loop back to the beginning and start playing again. <audio loop> ... </audio> muted If you want the audio to st...
...xample, mediaelement.js includes flash fallbacks, which are used something like this: <audio controls> <source src="audiofile.mp3" type="audio/mpeg"> <source src="audiofile.ogg" type="audio/ogg"> <!-- fallback for non supporting browsers goes here --> <a href="audiofile.mp3">download audio</a> <object width="320" height="30" type="application/x-shockwave-flash" data="mediaelement-flash-video.swf"> <param name="movie" value="mediaelement-flash-video.swf" /> <param name="flashvars" value="controls=true&isvideo=false&file=audiofile.mp3" /> </object> </audio> Note: You should be aware that Flash and Silverlight code require that the user has the appropriate plugin installed, and that the browser cannot guarantee the security aspects of code running on those plugin platforms. ...
Media events - Developer guides
Event name Description abort Sent when playback is aborted; for example, if the media is playing and is restarted from the beginning, this event is sent. canplay Sent when enough data is available that the media can be played, at least for a couple of frames. This corresponds to the HAVE_FUTURE_DATA readyState. ...
...d. volumechange Sent when the audio volume changes (both when the volume is set and when the muted attribute is changed). waiting Sent when the requested operation (such as playback) is delayed pending the completion of another operation (such as a seek). You can easily watch for these events, using code such as the following: var v = document.getElementsByTagName("video")[0]; v.addEventListener("seeked", function() { v.play(); }, true); v.currentTime = 10.0; This example fetches the first video element in the document and attaches an event listener to it, watching for the seeked event, which is sent whenever a seek operation completes. The listener simply calls the element's play() method, which starts playback. Then, in line 3, the example sets the element'...
User input and controls - Developer guides
the screen object. Locking the screen orientation is made possible by invoking the screen.lockOrientation method, while the screen.unlockOrientation method removes all the previous screen locks that have been set. Note: More information about the Screen Orientation API can be found in Managing screen orientation. ...
...screen orientation. Fullscreen You might need to present an element of your application (such as a <video>, for example) in fullscreen mode. You can achieve this by calling Element.requestFullscreen() on that element. ...
HTML attribute: capture - HTML: Hypertext Markup Language
The capture attribute specifies that, optionally, a new file should be captured, and which device should be used to capture that new media of a type defined by the accept attribute. Values include user and environment. The capture attribute is supported on the file input type. The capture attribute takes as it's value a string that specifies which camera to use for capture of image or video data, if the accept attribute indicates that the input should be of one of those types. Value Description user The user-facing camera and/or microphone should be used. environment The outward-facing camera and/or microphone should be used Note: capture was previously a Boolean attribute which, if present, requested that the device's media capture device(s) ...
...ed instead of requesting a file input. Examples When set on a file input type, operating systems with microphones and cameras will display a user interface allowing the selection from an existing file or the creating of a new one. <p> <label for="soundFile">What does your voice sound like?:</label> <input type="file" id="soundFile" capture="user" accept="audio/*"> </p> <p> <label for="videoFile">Upload a video:</label> <input type="file" id="videoFile" capture="environment" accept="video/*"> </p> <p> <label for="imageFile">Upload a photo of yourself:</label> <input type="file" id="imageFile" capture="user" accept="image/*"> </p> Note these work better on mobile devices; if your device is a desktop computer, you'll likely get a typical file picker. Specifications ...
<embed>: The Embed External Content element - HTML: Hypertext Markup Language
Web › HTML › Element › embed
plug-in to instantiate. width The displayed width of the resource, in CSS pixels. This must be an absolute value; percentages are not allowed. Usage notes You can use the object-position property to adjust the positioning of the embedded object within the element's frame, and the object-fit property to control how the object's size is adjusted to fit within the frame. Examples <embed type="video/quicktime" src="movie.mov" width="640" height="480" title="Title of my video"> Accessibility concerns Use the title attribute on an embed element to label its content so that people navigating with assistive technology such as a screen reader can understand what it contains. The title's value should concisely describe the embedded content. Without a title, they may not be able to determine wha...
... to label its content so that people navigating with assistive technology such as a screen reader can understand what it contains. The title's value should concisely describe the embedded content. Without a title, they may not be able to determine what its embedded content is. This context shift can be confusing and time-consuming, especially if the embed element contains interactive content like video or audio. Specifications Specification Status Comment HTML Living StandardThe definition of '<embed>' in that specification. Living Standard HTML5The definition of '<embed>' in that specification. Recommendation ...
Content Security Policy (CSP) - HTTP
Web › HTTP › CSP
src directive to prevent inline scripts from running, as well as blocking the use of eval(). A policy needs to include a default-src or style-src directive to restrict inline styles from being applied from a <style> element or a style attribute. There are specific directives for a wide variety of types of items, so that each type can have its own policy, including fonts, frames, images, audio and video media, scripts, and workers. Examples: Common use cases This section provides examples of some common security policy scenarios. Example 1 A web site administrator wants all content to come from the site's own origin (this excludes subdomains.) Content-Security-Policy: default-src 'self' Example 2 A web site administrator wants to allow content from a trusted domain and all its subdomains ...
... Content-Security-Policy: default-src 'self'; img-src *; media-src media1.com media2.com; script-src userscripts.example.com Here, by default, content is only permitted from the document's origin, with the following exceptions: Images may load from anywhere (note the "*" wildcard). Media is only al...
CSP: media-src - HTTP
CSP version 1 Directive type Fetch directive default-src fallback Yes. If this directive is absent, the user agent will look for the default-src directive. Syntax One or more sources can be allowed for the media-src policy: Content-Security-Policy: media-src <source>; Content-Security-Policy: media-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. ...
... or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. See unsafe inline script for an example. In CSP 2.0 this applied only to inline scripts. CSP 3.0 allows it in the case of script-src for external scripts. Examples Violation cases Given this CSP header: Content-Security-Policy: media-src https://example.com/ The following <audio>, <video> and <track> elements are blocked and won't load: <audio src="https://not-example.com/audio"></audio> <video src="https://not-example.com/video"> <track kind="subtitles" src="https://not-example.com/subtitles"> </video> Specifications Specification Status Comment Content Security Policy Level 3The definition of 'media-src' in that specification. Working Draft ...
Feature-Policy - HTTP
t of light in the environment around the device through the AmbientLightSensor interface. autoplay Controls whether the current document is allowed to autoplay media requested through the HTMLMediaElement interface. When this policy is disabled and there were no user gestures, the Promise returned by HTMLMediaElement.play() will reject with a DOMException. The autoplay attribute on <audio> and <video> elements will be ignored. battery Controls whether the use of the Battery Status API is allowed. When this policy is disabled, the Promise returned by Navigator.getBattery() will reject with a NotAllowedError DOMException. camera Controls whether the current document is allowed to use video input devices. When this policy is disabled, the Promise returned by getUserMedia() will reject with a...
...cancel it outright. oversized-images Controls whether the current document is allowed to download and display large images. payment Controls whether the current document is allowed to use the Payment Request API. When this policy is enabled, the PaymentRequest() constructor will throw a SecurityError DOMException. picture-in-picture Controls whether the current document is allowed to play a video in a Picture-in-Picture mode via the corresponding API. publickey-credentials-get Controls whether the current document is allowed to use the Web Authentication API to retreive already stored public-key credentials, i.e. via navigator.credentials.get({publicKey: ..., ...}). sync-xhr Controls whether the current document is allowed to make synchronous XMLHttpRequest requests. usb Controls wh...
Animation performance and frame rate - Web Performance
Animation on the web can be done via SVG, JavaScript, including <canvas> and WebGL, CSS animation, <video>, animated gifs and even animated PNGs and other image types. The performance cost of animating a CSS property can vary from one property to another, and animating expensive CSS properties can result in jank as the browser struggles to hit a smooth frame rate. For animated media, such as video and animated gifs, the main performance concern is file size - downloading the file size fast enough to not negatively impact performance is the greatest issue. Code based animations, be it CSS, SVG, <canvas>, webGL or other JavaScript animations, can cause performance issues even if the bandwidth footprint is small. These animations can consume CPU and/or cause jank. While performance is sensiti...
... want to play along, the demo website is here. It looks like this: It has two controls: a button to start/stop the animation, and a radio group to choose to animate using margin, or to animate using transform. There are a number of elements, and we've added a linear-gradient background and a box-shadow to each element, because they are both relatively expensive effects to paint. There's also a video version of this walkthrough: Animating using margin Leaving the "Use margin" option set, start the animation, open the Performance tool, and make a recording. You'll only need to record a few seconds. Open up the first recording. Exactly what you'll see depends a lot on your machine and system load, but it will be something like this: This is showing three distinct views: (a) an overview ...
Mixed content - Web security
activities by watching which images are served to the user; often images are only served on a specific page within a website. If the attacker observes HTTP requests to certain images, they could determine which webpage the user is visiting. Passive content list This section lists all types of HTTP requests which are considered passive content: <img> (src attribute) <audio> (src attribute) <video> (src attribute) <object> subresources (when an <object> performs HTTP requests) Mixed active content Mixed active content is content that has access to all or parts of the Document Object Model of the HTTPS page. This type of mixed content can alter the behavior of the HTTPS page and potentially steal sensitive data from the user. Hence, in addition to the risks described for mixed display c...
... setting a preference). To make it easier for web developers to find mixed content errors, all blocked mixed content requests are logged to the Security pane of the Web Console, as seen below: To fix this type of error, all requests to HTTP content should be removed and replaced with content served over HTTPS. Some common examples of mixed content include JavaScript files, stylesheets, images, videos, and other media. Note: Since Firefox 55, the loading of mixed content is allowed on http://127.0.0.1/ (see bug 903966). Chrome allows mixed content on http://127.0.0.1/ and http://localhost/. Safari does not allow any mixed content. ...
Using shadow DOM - Web Components
des using element.style.foo, or adding style to the entire shadow DOM tree inside a <style> element. The difference is that none of the code inside a shadow DOM can affect anything outside it, allowing for handy encapsulation. Note that the shadow DOM is not a new thing by any means -- browsers have used it for a long time to encapsulate the inner structure of an element. Think for example of a <video> element, with the default browser controls exposed. All you see in the DOM is the <video> element, but it contains a series of buttons and other controls inside its shadow DOM. The shadow DOM spec has made it so that you are allowed to actually manipulate the shadow DOM of your own custom elements. Basic usage You can attach a shadow root to any element using the Element.attachShadow() method.
...w DOM using JavaScript written in the main page context, for example using the Element.shadowRoot property: let myShadowDom = myCustomElem.shadowRoot; If you attach a shadow root to a custom element with mode: closed set, you won't be able to access the shadow DOM from the outside -- myCustomElem.shadowRoot returns null. This is the case with built in elements that contain shadow DOMs, such as <video>. Note: As this blog post shows, it is actually fairly easy to work around closed shadow DOMs, and the hassle to completely hide them is often more than it's worth. If you are attaching a shadow DOM to a custom element as part of its constructor (by far the most useful application of the shadow DOM), you would use something like this: let shadow = this.attachShadow({mode: 'open'}); When you...
2015 MDN Fellowship Program - Archive of obsolete content
k layers preferred. Mentor information Harald Kirschner, Web Craftsman. GitHub: digitarald Twitter: @digitarald Curriculum Development Brief Project Description MDN serves as a trusted resource for literally millions of developers on a regular basis. In 2015, MDN will expand the impact of this content by developing Kits of key learning materials, including such elements as code samples, videos and other elements being finalized. Activities and Deliverables Act as lead curator for technical curriculum addressing a key web technology, developing code samples, videos, interactive exercises and other components to be determined. You may propose your own subject area (examples: virtual reality on the web, network security, CSS, etc.) or we will work with you to match you to the best subj...
StringView - Archive of obsolete content
In the past, this had to be simulated by treating the raw data as a string and using the charCodeAt() method to read the bytes from the data buffer. However, this is slow and error-prone...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
is a license for documents and was created by the FSF, the same people behind the GPL and LGPL. Wikipedia uses this license. The Debian project, however, considers its terms too harsh, and that it does not allow for the free distribution of documents. Creative Commons is a flexible copyright licensing scheme that applies not just to documents but other creative works, including music, pictures, video, etc. It has the following characteristics: Gives creators flexibility when selecting and applying terms; Terms of use stated in easy-to-understand language; Licensing conditions conform with current copyright laws; Also has an RDF schema for attaching metadata. It is particularly convenient in the way that it allows creators to decide whether to permit commercial uses or not, whether to ...
Index of archived content - Archive of obsolete content
Tuning Pageload URIScheme URIs and URLs Uriloader Using addresses of stack variables with NSPR threads on win16 Using cross commit Using gdb on wimpy computers Venkman Using Breakpoints in Venkman Venkman Internals Venkman Introduction Video presentations When To Use ifdefs Writing textual data XML in Mozilla XPInstall Creating XPI Installer Modules Install Wizards (aka: Stub Installers) Mac stub installer Unix stub installer Windows stub installer ...
List of Former Mozilla-Based Applications - Archive of obsolete content
2010, RW/W reports Jolicloud is on Chrome/Chrome OS Joost TV over Internet Switched from XULRunner-based client to a web application Liferea News aggregator Switched to WebKit in version 1.6 ManyOne Browser Browser Originally Mozilla-based but now I believe the have a web-based tool (need reference for that) Miro (formerly Democracy Player) Video Switched from XULRunner to WebKit in version 3.0.2 Moblin Browser Browser When Moblin became Meego it switched from a custom Gecko-based browser to Chrome Nautilus File manager Hasn't used Mozilla code since version 2.0 Raptr client Gaming client Was a XULRunner app initially but now uses Adobe AIR Rift Technologies Software installation...
MMgc - Archive of obsolete content
is full, it is "reaped" to destroy some objects. If an object is in the ZCT, it is known that there are no heap references to it. So, there can only be stack references to it. MMgc scans the stack to see if there are any stack references to ZCT objects. Any objects in the ZCT that are NOT found on the stack are deleted. Incremental Collection The Flash Player is frequently used for animations and video that must maintain a certain framerate to play properly. Applications are also getting larger and larger and consuming more memory with scripting giving way to full fledged application component models (ala Flex). Unfortunately the flash player suffers a periodic pause (at least every 60 seconds) due to garbage collection requirements that may cause unbounded pauses (the GC pause is proportional ...
ActiveX Control for Hosting Netscape Plug-ins in IE - Archive of obsolete content
e, you must register it either through an install script or manually: regsvr32 pluginhostctrl.dll You must have administrator privileges to install a new control on operating systems such as Windows NT, 2000 & XP. Usage Insert some HTML like this into your content: <OBJECT classid="CLSID:DBB2DE32-61F1-4F7F-BEB8-A37F5BC24EE2" width="500" height="300"> <PARAM name="type" value="video/quicktime"/> <PARAM name="src" value="http://www.foobar.com/some_movie.mov"/> <!-- Custom arguments --> <PARAM name="loop" value="true"/> </OBJECT> The CLASSID attribute tells IE to create an instance of the plug-in hosting control, the WIDTH and HEIGHT specify the dimensions in pixels. You may optionally specify a CODEBASE attribute if you have packaged the control into a ...
Introducing the Audio API extension - Archive of obsolete content
This enables users to visualize audio data, to process this audio data and to create new audio data. Obsolete since Gecko 28 (Firefox 28 / Thunderbird 28 / SeaMonkey 2.25 / Firefox OS 1.3)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Deprecated since Gecko 22 (Firefox 22 / Thunderbird 22 / SeaMonkey 2.19)This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. ...
Multimedia - Archive of obsolete content
Audio Interface for manipulating audio Video Interface for manipulating video Music Methods for interacting with music content ...
Mozilla.dev.apps.firefox-2006-09-29 - Archive of obsolete content
on about why sometimes dmg files are not mounted correctly after they are downloaded. Binding tab bar to new theme Discussion about how to bind a new theme to a tab bar without losing its original binding. The Distributor University students working on Cache Distribution project - looking for help for how to tap the http requests. There have been no responses so far. Can't view Keith Olbermann Videos A user inability to launch videos, worked fine for others, ended up being a Flash version problem. Firefox 2 on Windows Vista Discussion about the "state of affairs" of Firefox 2 on Windows Vista RC1 - update for RC1 listed in Update History as 'Install Pending' right-click "Copy email address" - bug 353102 A proposed Bug Fix to the 'Copy email address' bug how to use the RSS feeds discovery ...
2006-09-29 - Archive of obsolete content
on about why sometimes dmg files are not mounted correctly after they are downloaded. Binding tab bar to new theme Discussion about how to bind a new theme to a tab bar without losing its original binding. The Distributor University students working on Cache Distribution project - looking for help for how to tap the http requests. There have been no responses so far. Can't view Keith Olbermann Videos A user inability to launch videos, worked fine for others, ended up being a Flash version problem. Firefox 2 on Windows Vista Discussion about the "state of affairs" of Firefox 2 on Windows Vista RC1 - update for RC1 listed in Update History as 'Install Pending' right-click "Copy email address" - bug 353102 A proposed Bug Fix to the 'Copy email address' bug how to use the RSS feeds discovery ...
Supporting private browsing in plugins - Archive of obsolete content
m by which plugins can determine whether or not private browsing mode is in effect. Plugins should be updated to monitor the state of private browsing mode and only save private information when private browsing is disabled. Potentially private information may include (but is not necessarily limited to) history information for downloaded data. For example, if private browsing mode is in effect, video player plugins should not record the URLs of watched videos in their histories. Detecting private browsing mode Plug-ins can detect whether or not private browsing mode is in effect by using the NPN_GetValue() function to check the current value of the NPNVprivateModeBool variable. ...
Plugins - Archive of obsolete content
rk to make those use cases possible. For more information about plugin roadmap, see non-archived plugin information. Plugins are shared libraries that users can install to display content that the browser can't display natively. For example, the Adobe Reader plugin lets the user open PDF files directly inside the browser, and the QuickTime and RealPlayer plugins are used to play special format videos in a web page. Plugins are written using NPAPI, the cross-browser API for plugins. The main source of documentation for NPAPI is the Gecko Plugin API Reference. To make your plugin scriptable from web pages, use npruntime. Plugins can be written completely from scratch using C APIs (usually in C or C++) or they may be built on a plugin framework such as Firebreath, JUCE, or QtBrowserPlugin. Th...
What is RSS - Archive of obsolete content
7 -0400</pubDate> <enclosure url="http://katetv.example.com/show/3" length="1387442" type="application/ogg"/> </item> <item> <title>It is me again</title> <guid>http://katetv.example.com/show/2</guid> <pubDate>Tue, 9 Aug 2005 13:12:12 -0400</pubDate> <enclosure url="http://katetv.example.com/show/2" length="1894877" type="video/mpeg"/> </item> <item> <title>Hello</title> <guid>http://katetv.example.com/show/1</guid> <pubDate>Tue, 2 Aug 2005 18:22:14 -0400</pubDate> <enclosure url="http://katetv.example.com/show/1" length="17442215" type="application/ogg"/> </item> </channel> </rss> The observant reader may have noticed that the news web site a...
Theme changes in Firefox 3.5 - Archive of obsolete content
rowser.xul Bug 463189 added a new attribute on the XUL window element of browser.xul named browsingmode. The value of this attribute is normal when the Private Browsing mode is inactive, and private when it's active. This attribute can be used to style different parts of the browser window inside the Private Browsing mode. See this blog post for an example. Supporting 3.5 Features Video/Audio player: controlBar has to be styled (chrome://global/skin/media/videocontrols.css) Shadow effect for disabled text using text-shadow. Greying menus of inactive windows: active windows get attribute 'active="true"'. To do this only for 3.5 use a CSS selector that is only supported in 3.5, like so: window:not([active="true"]) menubar>menu:nth-child(1n) { color:threedshadow } Private browsi...
Scratchpad - Archive of obsolete content
pad provides an environment for experimenting with JavaScript code. You can write, run, and examine the results of code that interacts with the web page. Unlike the Web Console, which is designed for interpreting a single line of code at a time, Scratchpad lets you edit larger chunks of JavaScript code, then execute it in various ways depending on how you want to use the output. The featured video tutorial shows a case of using Scratchpad with a page run by a local web server. It is also possible to use Scratchpad over pages opened from a local file system, if permission policies allow that. But even with possible limitations present, the HTML code can be either manually entered or copied from the source and pasted into the "about:blank" page (a new empty tab) with the use Page Inspector's...
Using Firebug and jQuery (Screencast) - Archive of obsolete content
Note: This screencast is originally from: http://ejohn.org/blog/hacking-digg-w...ug-and-jquery/ This is an adaptation of a presentation that I gave while at Mashup Camp Boston. We're going to take an introductory look at the Firebug Firefox Extension and the jQuery JavaScript Library - combining the two to build a reusable bookmarklet that can manipulate Digg Posts and Comments. Click the video link to begin (14:39 Minutes long, 59MB): http://developer.mozilla.org/presentations/screencasts/jresig-digg-firebug-jquery.mp4 Download: Right-click this link and select Save As... in order to download a copy of your own. (59MB) Bookmarklets: In the presentation, I refer to a bookmarklet that you can use to introduce jQuery into a web page. Drag these bookmarklets found on this page into ...
MSX Emulator (jsMSX) - Archive of obsolete content
In its present form, it should be able to run any program or game developed for MSX 1.0. Since JavaScript currently is mostly an interpreted language in web browsers, it is at least an order of magnitude slower than other languages such as C and Java. Therefore, jsMSX requires a very fast computer to emulate MSX at the normal 50-60 interrupts per second inside a web browser. ...
The Business Benefits of Web Standards - Archive of obsolete content
n just web authoring. Reduce Costs of Maintenance and Site Operations What is maintenance anyway? One of the most important features of a successful site is constantly evolving relevant content which in turn can act as fuel for social media dialogue with the user community. From this it follows that there needs to be a framework and a process for content contributors to post articles, to upload videos, sound or any other media. A web site is only a vehicle for carrying, navigating and displaying that content. Content Management Systems attempt with some success to supply that level of functionality. They act as a very good example of real separation not only of style and content but the process by which those items - which are very different - are implemented. The process is therefore one of...
Introduction to game development for the Web - Game development
, synthesis, and manipulation of audio from JavaScript code lets you create awesome sound effects as well as play and manipulate music in real time. WebGL Lets you create high-performance, hardware-accelerated 3D (and 2D) graphics from Web content. This is a Web-supported implementation of OpenGL ES 2.0. WebRTC The WebRTC (Real-Time Communications) API gives you the power to control audio and video data, including teleconferencing and transmitting other application data back and forth between two users. Want your players to be able to talk to each other while blowing up monsters? This is the API for you. WebSockets The WebSocket API lets you connect your app or site to a server to transmit data back and forth in real-time. Perfect for multiplayer gaming action, chat services, and so forth...
Game monetization - Game development
the earnings. Google AdSense is said to be the most effective one, but it's not designed for games and it's a pretty bad practice to use it for that purpose. Instead of risking of having your account closed and all the money blocked try to use the usual, gamedev targeted portals like LeadBolt. They offer easy to implement systems to show the adverts in your games and split the earnings with you. Video ads are getting more and more popular, especially in the form of a pre-roll -- they are shown at the beginning of your game while it's still loading. And on the topic of where to put the advertisements in your game it really depends on you. It should be as subtle as possible so as to not annoy the players too much, but visible enough to make them click it or at least take notice. Adding adverts b...
Game promotion - Game development
ith specific genres of games or platforms, so you don't send them something that is not relevant to them in the first place. If you're honest with your approach and your game is good, then you've got more of a chance of success. If you want to learn more about the etiquette of contacting the press you should definitely check out How To Contact Press - a great guide from Pixel Prospector, and the Video Game Journaliser site curated by them for the list of sites to contact. Tutorials It's good to share your knowledge with other devs -- after all you probably learned a thing or two from online articles, so you take the time to pay that knowledge forward. Talking or writing about something you achieved or problems you overcame is something people would be interested it. And you can use your own ...
Building up a basic demo with A-Frame - Game development
d how to use it to build up a simple demo. High level overview The current version of A-Frame is 0.3.2, which means it's highly experimental, but it already works and you can test it right away in the browser. It runs on desktop, mobile (iOS and Android), and Oculus Rift, Gear VR and HTC Vive. A-Frame is built on top of WebGL, and provides pre built components to use in applications -- models, video players, skyboxes, geometries, controls, animations, cursors, etc. It is based on the entity component system, which is known in the game development world, but it targets web developers with a familiar markup structure, manipulable with JavaScript. The end result is 3D web experiences, which are VR-enabled by default. Environment setup Let's start by setting up an environment to create somethi...
WebRTC data channels - Game development
This article explains more about this, and shows you how to use libraries to implement data channels in your game. What is a data channel? A WebRTC data channel lets you send text or binary data over an active connection to a peer. In the context of a game, this lets players send data to each other, whether text chat or game status information. Data channels come in two flavors. Reliable channels guarantee that messages you send arrive at the other peer and in the same order in which they're sent. ...
Techniques for game development - Game development
piled off the main thread and be cached for future game running, resulting in a significant performance improvement for your users. This article explains how. Optimizing startup performance How to make sure your game starts up quickly, smoothly, and without appearing to lock up the user's browser or device. Using WebRTC peer-to-peer data channels In addition to providing support for audio and video communication, WebRTC lets you set up peer-to-peer data channels to exchange text or binary data actively between your players. This article explains what this can do for you, and shows how to use libraries that make this easy. Efficient animation for web games This article covers techniques and advice for creating efficient animation for web games, with a slant towards supporting lower end dev...
Visual-js game engine - Game development
tall express npm install mkdirp npm install socket.io npm install nodemailer@0.7.0 Very easy installation and project files generator . Now you can use On-Page-Editor (nice for visual setup , checking positions and dimensions - not for logic ) . manual start from cmd : server_folder/node editor.js After starting On-Page-Editor open browser icon to open internet browser in editor mode . See video explanation : If you use editor.js to visual create game object method , you must start ***node build_from_editor_to_visual_js_file.js*** on the end of work. This tool will create visual.js in folder starter/ with all your game object was created in editor style . or you can use Visual-JS Source editor. Visual-JS Source editor (2d part only) is new and better way .In future visual...
Visual JS GE - Game development
e game objects. This is good because it is memory safe. ...
API - MDN Web Docs Glossary: Definitions of Web-related terms
as third party software or hardware. In Web development, an API is generally a set of code features (e.g. methods, properties, events, and URLs) that a developer can use in their apps for interacting with components of a user's web browser, or other software/hardware on the user's computer, or third party websites and services. For example: The getUserMedia API can be used to grab audio and video from a user's webcam, which can then be used in any way the developer likes, for example, recording video and audio, broadcasting it to another user in a conference call, or capturing image stills from the video. The Geolocation API can be used to retrieve location information from whatever service the user has available on their device (e.g. GPS), which can then be used in conjunction with the ...
CMS - MDN Web Docs Glossary: Definitions of Web-related terms
Learn More General Knowledge Content management system on Wikipedia ...
Cipher - MDN Web Docs Glossary: Definitions of Web-related terms
except for the one-time pad. Modern ciphers are designed to withstand attacks discovered by a cryptanalyst. There is no guarantee that all attack methods have been discovered, but each algorithm is judged against known classes of attacks. Ciphers operate two ways, either as block ciphers on successive blocks, or buffers, of data, or as stream ciphers on a continuous data flow (often of sound or video). They also are classified according to how their keys are handled: symmetric key algorithms use the same key to encode and decode a message. The key also must be sent securely if the message is to stay confidential. asymmetric key algorithms use a different key for encryption and decryption. ...
Codec - MDN Web Docs Glossary: Definitions of Web-related terms
A codec (a blend word derived from "coder-decoder") is a program, algorithm, or device that encodes or decodes a data stream. A given codec knows how to handle a specific encoding or compression technology. Learn more General knowledge Codec on Wikipedia Technical reference Web video codec guide Web audio codec guide Guide to media types and formats on the web ...
Continuous Media - MDN Web Docs Glossary: Definitions of Web-related terms
Continuous media can be real-time (interactive), where there is a "tight" timing relationship between source and sink, or streaming (playback), where the relationship is less strict. CSS can be used in a variety of contexts, including print media and some CSS, in particular, that used for layout behaves differently depending on the context it is in. ...
Effective connection type - MDN Web Docs Glossary: Definitions of Web-related terms
ECT Minimum RTT Maximum downlink Explanation slow-2g 2000ms 50 Kbps The network is suited for small transfers only such as text-only pages. 2g 1400ms 70 Kbps The network is suited for transfers of small images. 3g 270ms 700 Kbps The network is suited for transfers of large assets such as high resolution images, audio, and SD video. 4g 0ms ? The network is suited for HD video, real-time video, etc. effectiveType is a property of the Network Information API, exposed to JavaScript via the navigator.connection object. To see your effective connection type, open the console of the developer tools of a supporting browser and enter the following: navigator.connection.effectiveType; See Also: Network ...
ICE - MDN Web Docs Glossary: Definitions of Web-related terms
This protocol lets two peers find and establish a connection with one another even though they may both be using Network Address Translator (NAT) to share a global IP address with other devices on their respective local networks. ...
ITU - MDN Web Docs Glossary: Definitions of Web-related terms
ish standards and rules for telecommunication, including telegraph, radio, telephony and the internet. From defining rules for ensuring transmissions get to where they need to go to and creating the "SOS" alert signal used in Morse code, the ITU has long played a key role in how we use technology to exchange information and ideas. In the Internet Age, the ITU's role of establishing standards for video and audio data formats used for streaming, teleconferencing, and other purposes. For example, the ITU and the Moving Picture Experts Group (MPEG) worked together to develop and publish, as well as to maintain, the various MPEG specifications, such as MPEG-2 (ITU H.262), AVC (ITU H.264), and HEVC (ITU H.265). Learn more General knowledge ITU web site Learn about it ITU history portal ...
mime - MDN Web Docs Glossary: Definitions of Web-related terms
MIME "Multipurpose internet mail extensions" is a standard to describe documents in other forms beside ASCII text, e.g. audio, video and images. Initially used for E-Mail attachments, it has become the de facto standard to define types of documents anywhere. See also MIME-Type Learn more General knowledge MIME on Wikipedia ...
Media - MDN Web Docs Glossary: Definitions of Web-related terms
The term media is an overloaded one when talking about the web; it takes on different meanings depending on the context. Media (Audio-visual presentation) The term media (more accurately, multimedia) refers to audio, video, or combined audio-visual material such as music, recorded speech, movies, TV shows, or any other form of content that is presented over a period of time. Media (CSS) In the context of CSS (Cascading Style Sheets), the term media refers to the destination to which the document is to be drawn by the rendering engine. Learn more Media on Wikipedia ...
RTP (Real-time Transport Protocol) and SRTP (Secure RTP) - MDN Web Docs Glossary: Definitions of Web-related terms
The secure version of RTP, SRTP, is used by WebRTC, and uses encryption and authentication to minimize the risk of denial-of-service attacks and security breaches. RTP is rarely used alone; instead, it is used in conjunction with other protocols like RTSP and SDP. ...
RTSP: Real-time streaming protocol - MDN Web Docs Glossary: Definitions of Web-related terms
Real-time streaming protocol (RTSP) is a network protocol that controls how the streaming of a media should occur between a server and a client. Basically, RTSP is the protocol that describes what happens when you click "Pause"/"Play" when streaming a video. If your computer were a remote control and the streaming server a television, RTSP would describe how the instruction of the remote control affects the TV. Learn more General knowledge RTSP on Wikipedia RFC 7826 (one of the documents that specifies precisely how the protocol works) ...
SDP - MDN Web Docs Glossary: Definitions of Web-related terms
SDP (Session Description Protocol) is the standard describing a peer-to-peer connection. SDP contains the codec, source address, and timing information of audio and video. Here is a typical SDP message: v=0 o=alice 2890844526 2890844526 IN IP4 host.anywhere.com s= c=IN IP4 host.anywhere.com t=0 0 m=audio 49170 RTP/AVP 0 a=rtpmap:0 PCMU/8000 m=video 51372 RTP/AVP 31 a=rtpmap:31 H261/90000 m=video 53000 RTP/AVP 32 a=rtpmap:32 MPV/90000 SDP is never used alone, but by protocols like RTP and RTSP. SDP is also as component of WebRTC, which uses SDP as a way of describing a session. Learn more General knowledge WebRTC protocols Session Description Protocol on Wikipedia ...
SIMD - MDN Web Docs Glossary: Definitions of Web-related terms
SIMD (pronounced "sim-dee") is short for Single Instruction/Multiple Data which is one classification of computer architectures. SIMD allows one same operation to be performed on multiple data points resulting in data level parallelism and thus performance gains -- for example, for 3D graphics and video processing, physics simulations or cryptography, and other domains. See also SISD for a sequential architecture with no parallelism in either the instructions or the data sets. ...
URL - MDN Web Docs Glossary: Definitions of Web-related terms
In the context of HTTP, URLs are called "Web address" or "link". Your browser displays URLs in its address bar, for example: https://developer.mozilla.org Some browsers display only the part of a URL after the "//", that is, the Domain name. URLs can also be used for file transfer (FTP) , emails (SMTP), and other applications. ...
WebM - MDN Web Docs Glossary: Definitions of Web-related terms
WebM is royalty-free and is an open web video format natively supported in Mozilla Firefox. Learn more General knowledge WebM on Wikipedia ...
CSS and JavaScript accessibility best practices - Learn web development
t of it is using built-in browser functionality where possible. Good example uses of unobtrusive JavaScript include: Providing client-side form validation, which alerts users to problems with their form entries quickly, without having to wait for the server to check the data. If it isn't available, the form will still work, but validation might be slower. Providing custom controls for HTML5 <video>s that are accessible to keyboard-only users, along with a direct link to the video that can be used to access it if JavaScript is not available (the default <video> browser controls aren't keyboard accessible in most browsers). As an example, we've written a quick and dirty client-side form validation example -- see form-validation.html (also see the demo live). Here you'll see a simple form; ...
Cascade and inheritance - Learn web development
concepts work together These three concepts together control which CSS applies to what element; in the below sections we'll see how they work together. It can sometimes seem a little bit complicated, but you will start to remember them as you get more experienced with CSS, and you can always look up the details if you forget! Even experienced developers don't remember all the details. The below video shows how you can use the Firefox DevTools to inspect a page's cascade, specificity, and more: Understanding inheritance We'll start with inheritance. In the example below we have a <ul>, with two levels of unordered lists nested inside it. We have given the outer <ul> a border, padding, and a font color. The color has applied to the direct children, but also the indirect children -- the imm...
Debugging CSS - Learn web development
if you hold your mouse over it checkboxes will appear. Uncheck a rule's checkbox, for example border-radius, and the CSS will stop applying. You can use this to do an A/B comparison, deciding if something looks better with a rule applied or not, and also to help debug it -- for example if a layout is going wrong and you are trying to work out which property is causing the problem. The following video provides some useful tips on debugging CSS using the Firefox DevTools: Editing values In addition to turning properties on and off, you can edit their values. Perhaps you want to see if another color looks better, or wish to tweak the size of something? DevTools can save you a lot of time editing a stylesheet and reloading the page. With box1 selected, click on the swatch (the small colored ...
Organizing your CSS - Learn web development
of the approaches that you will encounter owe something to the concept of Object Oriented CSS (OOCSS), an approach made popular by the work of Nicole Sullivan. The basic idea of OOCSS is to separate your CSS into reusable objects, which can be used anywhere you need on your site. The standard example of OOCSS is the pattern described as The Media Object. This is a pattern with a fixed size image, video or other element on one side, and flexible content on the other. It's a pattern we see all over websites for comments, listings, and so on. If you are not taking an OOCSS approach you might create custom CSS for the different places this pattern is used, for example creating a class called comment with a bunch of rules for the component parts, then a class called list-item with almost the same r...
Pseudo-classes and pseudo-elements - Learn web development
pe among its siblings. :optional Matches form elements that are not required. :out-of-range Matches an element with a range when its value is out of range. :past Matches the elements before the current element. :placeholder-shown Matches an input element that is showing placeholder text. :playing Matches an element representing an audio, video, or similar resource that is capable of being "played" or "paused", when that element is "playing". :paused Matches an element representing an audio, video, or similar resource that is capable of being "played" or "paused", when that element is "paused". :read-only Matches an element if it is not user-alterable. :read-write Matches an element if it is user-alte...
Grids - Learn web development
have columns, rows, and then gaps between each row and column -- commonly referred to as gutters. Creating your grid in CSS Having decided on the grid that your design needs, you can use CSS Grid Layout to create that grid in CSS and place items onto it. We will look at the basic features of Grid Layout first and then explore how to create a simple grid system for your project. The following video provides a nice visual explanation of using CSS Grid: Defining a grid As a starting point, download and open the starting point file in your text editor and browser (you can also see it live here). You will see an example with a container, which has some child items. By default these display in normal flow so the boxes display one below the other. We will be working with this file for the fir...
Supporting older browsers - Learn web development
niques that might come along in the future. ...
How CSS works - Learn web development
s. But this is roughly what happens. The browser loads the HTML (e.g. receives it from the network). It converts the HTML into a DOM (Document Object Model). The DOM represents the document in the computer's memory. The DOM is explained in a bit more detail in the next section. The browser then fetches most of the resources that are linked to by the HTML document, such as embedded images and videos ... and linked CSS! JavaScript is handled a bit later on in the process, and we won't talk about it here to keep things simpler. The browser parses the fetched CSS, and sorts the different rules by their selector types into different "buckets", e.g. element, class, ID, and so on. Based on the selectors it finds, it works out which rules should be applied to which nodes in the DOM, and attaches ...
What is CSS? - Learn web development
owser applies to HTML to make sure it will be basically readable even if no explicit styling is specified by the author of the page. However, the web would be a boring place if all websites looked like that. Using CSS you can control exactly how HTML elements look in the browser, presenting your markup using whatever design you like. For more on browser/default styles, check out the following video: What is CSS for? As we have mentioned before, CSS is a language for specifying how documents are presented to users -- how they are styled, laid out, etc. A document is usually a text file structured using a markup language -- HTML is the most common markup language, but you may also come across other markup languages such as SVG or XML. Presenting a document to a user means converting it ...
Web fonts - Learn web development
follow other license conditions such as crediting the font creator in the code (or on your site). You shouldn't steal fonts and use them without giving proper credit. Note: Web fonts as a technology have been supported in Internet Explorer since version 4! You can use the Firefox Font Editor to investigate and manipulate the fonts in use on your page, whether they are web fonts or not. This video provides a nice walkthrough: Active learning: A web font example With this in mind, let's build up a basic web font example from first principles. It is difficult to demonstrate this using an embedded live example, so instead, we would like you to follow the steps detailed in the below sections, to get an idea of the process. You should use the web-font-start.html and web-font-start.css file...
Learn to style HTML using CSS - Learn web development
rstanding of even the basics of CSS. ...
How does the Internet work? - Learn web development
ucture in the 1980s with the support of many public universities and private companies. The various technologies that support the Internet have evolved over time, but the way it works hasn't changed that much: Internet is a way to connect computers all together and ensure that, whatever happens, they find a way to stay connected. Active Learning How the internet Works in 5 minutes: A 5 minute video to understand the very basics of Internet by Aaron Titus. How does the Internet work? Detailed well visualized 8 minute video. Deeper dive A simple network When two computers need to communicate, you have to link them, either physically (usually with an Ethernet cable) or wirelessly (for example with WiFi or Bluetooth systems). All modern computers can sustain any of those connections. Not...
What is the difference between webpage, website, web server, and search engine? - Learn web development
d with each other. Web page A web page is a simple document displayable by a browser. Such documents are written in the HTML language (which we look into in more detail in other articles). A web page can embed a variety of different types of resources such as: style information -- controlling a page's look-and-feel scripts -- which add interactivity to the page media -- images, sounds, and videos. Note: Browsers can also display other documents such as PDF files or images, but the term web page specifically refers to HTML documents. Otherwise, we only use the term document. All web pages available on the web are reachable through a unique address. To access a page, just type its address in your browser address bar: Web site A website is a collection of linked web pages (plus the...
What are hyperlinks? - Learn web development
P, a transfer protocol to find documents when given their URLs HTML, a document format allowing for embedded hyperlinks As you can see in the three pillars, everything on the Web revolves around documents and how to access them. The Web's original purpose was to provide an easy way to reach, read, and navigate through text documents. Since then, the Web has evolved to provide access to images, videos, and binary data, but these improvements have hardly changed the three pillars. Before the Web, it was quite hard to access documents and move from one to another. Being human-readable, URLs already made things easier, but it's hard to type a long URL whenever you want to access a document. This is where hyperlinks revolutionized everything. Links can correlate any text string with a URL, such ...
What is a web server? - Learn web development
eb server, which searches for the requested file in its own storage space. Upon finding the file, the server reads it, processes it as-needed, and sends it to the browser. Let's look at those steps in more detail. Hosting files First, a web server has to store the website's files, namely all HTML documents and their related assets, including images, CSS stylesheets, JavaScript files, fonts, and video. Technically, you could host all those files on your own computer, but it's far more convenient to store files all on a dedicated web server because: A dedicated web server is typically more available. (up and running) Excusing downtime and systems troubles, a dedicated web server is always connected to the Internet. A dedicated web server can have the same IP address all the time. This is ...
HTML basics - Learn web development
ome problems later on. <title></title> -- the <title> element. This sets the title of your page, which is the title that appears in the browser tab the page is loaded in. It is also used to describe the page when you bookmark/favourite it. <body></body> -- the <body> element. This contains all the content that you want to show to web users when they visit your page, whether that's text, images, videos, games, playable audio tracks or whatever else. Images Let's turn our attention to the <img> element again: <img src="images/firefox-icon.png" alt="My test image"> As we said before, it embeds an image into our page in the position it appears. It does this via the src (source) attribute, which contains the path to our image file. We have also included an alt (alternative) attribute. In thi...
How the Web works - Learn web development
ent files: A website is made up of many different files, which are like the different parts of the goods you buy from the shop. These files come in two main types: Code files: Websites are built primarily from HTML, CSS, and JavaScript, though you'll meet other technologies a bit later. Assets: This is a collective name for all the other stuff that makes up a website, such as images, music, video, Word documents, and PDFs. So what happens, exactly? When you type a web address into your browser (for our analogy that's like walking to the shop): The browser goes to the DNS server, and finds the real address of the server that the website lives on (you find the address of the shop). The browser sends an HTTP request message to the server, asking it to send a copy of the website to...
JavaScript basics - Learn web development
itself is relatively compact, yet very flexible. Developers have written a variety of tools on top of the core JavaScript language, unlocking a vast amount of functionality with minimum effort. These include: Browser Application Programming Interfaces (APIs) built into web browsers, providing functionality such as dynamically creating HTML and setting CSS styles; collecting and manipulating a video stream from a user's webcam, or generating 3D graphics and audio samples. Third-party APIs that allow developers to incorporate functionality in sites from other content providers, such as Twitter or Facebook. Third-party frameworks and libraries that you can apply to HTML to accelerate the work of building sites and applications. It's outside the scope of this article--as a light introductio...
HTML Cheatsheet - Learn web development
rt the HTML5 Audio element. Embedded Audio with alternative sources <audio controls="controls"><source src="https://udn.realityripple.com/samples/b7/193cb038d0.mp3" type="audio/mpeg"><source src="https://udn.realityripple.com/samples/f7/14a4179ee6.ogg" type="audio/ogg"> Your browser does not support Audio. </audio> Your browser does not support Audio. Embedded Video <video controls src="https://udn.realityripple.com/samples/1f/6cc66528b8.mp4">The <code>video</code> element is unsupported.</video> The video element is unsupported. Block elements "Block elements," on the other hand, take up the entire width of a webpage. They also take up a full line of a webpage; they do not fit together side-by-side. Instead, they stack like paragraphs...
Use HTML to solve common problems - Learn web development
Learn › HTML › Howto
To solve presentation issues, use CSS, or use scripting to make your page interactive. How to use CSS within a webpage How to use JavaScript within a webpage Embedded content How to embed a webpage within another webpage How to add Flash content within a webpage Uncommon or advanced problems Beyond th...
Getting started with HTML - Learn web development
ason not to set this, and it can help avoid some problems later. <title></title>: The <title> element. This sets the title of the page, which is the title that appears in the browser tab the page is loaded in. The page title is also used to describe the page when it is bookmarked. <body></body>: The <body> element. This contains all the content that displays on the page, including text, images, videos, games, playable audio tracks, or whatever else. Active learning: Adding some features to an HTML document If you want to experiment with writing some HTML on your local computer, you can: Copy the HTML page example listed above. Create a new file in your text editor. Paste the code into the new text file. Save the file as index.html. Note: You can also find this basic HTML template ...
What’s in the head? Metadata in HTML - Learn web development
ance its security, the policy applies to the favicon. If you encounter problems with the favicon not loading, verify that the Content-Security-Policy header's img-src directive is not preventing access to it. Applying CSS and JavaScript to HTML Just about all websites you'll use in the modern day will employ CSS to make them look cool, and JavaScript to power interactive functionality, such as video players, maps, games, and more. These are most commonly applied to a web page using the <link> element and the <script> element, respectively. The <link> element should always go inside the head of your document. This takes two attributes, rel="stylesheet", which indicates that it is the document's stylesheet, and href, which contains the path to the stylesheet file: <link rel="styleshee...
Introduction to HTML - Learn web development
At its heart, HTML is a fairly simple language made up of elements, which can be applied to pieces of text to give them different meaning in a document (Is it a paragraph? Is it a bulleted list? Is it part of a table?), structure a document into logical sections (Does it have a header? Three columns of content? A navigation menu?), and embed content such as images and videos into a page. This module will introduce the first two of these and introduce fundamental concepts and syntax you need to know to understand HTML. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this module, you don't need any previous HTML knowledge, but you should have...
Responsive images - Learn web development
e. It would probably be better to show a smaller, portrait image on mobile, which zooms in on the person. The <picture> element allows us to implement just this kind of solution. Returning to our original not-responsive.html example, we have an image that badly needs art direction: <img src="elva-800w.jpg" alt="Chris standing up holding his daughter Elva"> Let's fix this, with <picture>! Like <video> and <audio>, the <picture> element is a wrapper containing several <source> elements that provide different sources for the browser to choose from, followed by the all-important <img> element. The code in responsive.html looks like so: <picture> <source media="(max-width: 799px)" srcset="elva-480w-close-portrait.jpg"> <source media="(min-width: 800px)" srcset="elva-800w.jpg"> <img src="el...
Introducing asynchronous JavaScript - Learn web development
blocking operation, is terrible for use in real world applications. Asynchronous JavaScript For reasons illustrated earlier (e.g. related to blocking), many Web API features now use asynchronous code to run, especially those that access or fetch some kind of resource from an external device, such as fetching a file from the network, accessing a database and returning data from it, accessing a video stream from a web cam, or broadcasting the display to a VR headset. Why is this difficult to get to work using synchronous code? Let's look at a quick example. When you fetch an image from a server, you can't return the result immediately. That means that the following (pseudocode) wouldn't work: let response = fetch('myImage.png'); let blob = response.blob(); // display your image blob in the ...
Fetching data from the server - Learn web development
showProduct showProduct(objectURL, product); }); This works in much the same way as the previous one, except that instead of using json(), we use blob(). In this case we want to return our response as an image file, and the data format we use for that is Blob (the term is an abbreviation of "Binary Large Object" and can basically be used to represent large file-like objects, such as images or video files). Once we've successfully received our blob, we create an object URL out of it using createObjectURL(). This returns a temporary internal URL that points to an object referenced inside the browser. These are not very readable, but you can see what one looks like by opening up the Can Store app, Ctrl-/Right-clicking on an image, and selecting the "View image" option (which might vary slight...
Client-side web APIs - Learn web development
browser APIs and 3rd party APIs and shows some typical uses of the latter. Drawing graphics The browser contains some very powerful graphics programming tools, from the Scalable Vector Graphics (SVG) language, to APIs for drawing on HTML <canvas> elements, (see The Canvas API and WebGL). This article provides an introduction to the Canvas API, and further resources to allow you to learn more. Video and audio APIs HTML5 comes with elements for embedding rich media in documents -- <video> and <audio> -- which in turn come with their own APIs for controlling playback, seeking, etc. This article shows you how to do common tasks such as creating custom playback controls. Client-side storage Modern web browsers feature a number of different technologies that allow you to store data related to ...
A first splash into JavaScript - Learn web development
ield and focus it again, ready for the next guess to be entered. Events At this point we have a nicely implemented checkGuess() function, but it won't do anything because we haven't called it yet. Ideally we want to call it when the "Submit guess" button is pressed, and to do this we need to use an event. Events are things that happen in the browser -- a button being clicked, a page loading, a video playing, etc. -- in response to which we can run blocks of code. The constructs that listen out for the event happening are called event listeners, and the blocks of code that run in response to the event firing are called event handlers. Add the following line below your checkGuess() function: guessSubmit.addEventListener('click', checkGuess); Here we are adding an event listener to the guess...
JavaScript object basics - Learn web development
ke: myString.split(','); You were using a method available on an instance of the String class. Every time you create a string in your code, that string is automatically created as an instance of String, and therefore has several common methods and properties available on it. When you accessed the document object model using lines like this: const myDiv = document.createElement('div'); const myVideo = document.querySelector('video'); You were using methods available on an instance of the Document class. For each webpage loaded, an instance of Document is created, called document, which represents the entire page's structure, content, and other features such as its URL. Again, this means that it has several common methods and properties available on it. The same is true of pretty much any o...
JavaScript — Dynamic client-side scripting - Learn web development
JavaScript is a programming language that allows you to implement complex things on web pages. Every time a web page does more than just sit there and display static information for you to look at--displaying timely content updates, interactive maps, animated 2D/3D graphics, scrolling video jukeboxes, or more--you can bet that JavaScript is probably involved. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites JavaScript is arguably more difficult to learn than related technologies such as HTML and CSS. Before attempting to learn JavaScript, you are strongly advised to get familiar with at least these two technologies first, and perhaps others as well. Start b...
Measuring performance - Learn web development
re on a web app or site. Next up, you'll look at perceived performance and some techniques to make unavoidable performance hits appear less severe to the user, or disguise them completely. Previous Overview: Performance Next In this module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance ...
What is web performance? - Learn web development
HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance ...
Web performance - Learn web development
n make performance part of the web development workflow. Multimedia: images The lowest hanging fruit of web performance is often media optimization. Serving different media files based on each user agent's capability, size, and pixel density is possible. In this article we discuss the impact images have on performance, and the methods to reduce the number of bytes sent per image. Multimedia: video The lowest hanging fruit of web performance is often media optimization. In this article we discuss the impact video content has on performance, and cover tips like removing audio tracks from background videos can improve performance. JavaScript performance best practices JavaScript, when used properly, can allow for interactive and immersive web experiences -- or it can significantly harm dow...
Learning area release notes - Learn web development
ns aimed at rapidly testing whether you understood what is going on. ...
Introduction to the server side - Learn web development
inue to visit the site over a few hours/days. Eventually, you will start to be redirected to pages explaining how to subscribe, and you will be unable to access articles. This information is an example of session information stored in cookies. Notifications and communication Servers can send general or user-specific notifications through the website itself or via email, SMS, instant messaging, video conversations, or other communications services. A few examples include: Facebook and Twitter send emails and SMS messages to notify you of new communications. Amazon regularly sends product e-mails that suggest products similar to those already bought or viewed that you might be interested in. A web server might send warning messages to site administrators alerting them to low memory on th...
Introduction to client-side frameworks - Learn web development
hey could share their solutions with others. This shared ecosystem of libraries helped shape the growth of the web. Now, JavaScript is an essential part of the web, used on 95% of all websites, and the web is an essential part of modern life. Users write papers, manage their budgets, stream music, watch movies, and communicate with others over great distances instantaneously, with text, audio or video chat. The web allows us to do things that used to be possible only in native applications installed on our computers. These modern, complex, interactive websites are often referred to as web applications. The advent of modern JavaScript frameworks has made it much easier to build highly dynamic, interactive applications. A framework is a library that offers opinions about how software gets built...
Implementing feature detection - Learn web development
example shown is a way of detecting HTML5 Canvas support. function supports_canvas() { return !!document.createElement('canvas').getContext; } if(supports_canvas()) { ... } Method on element return value Create an element in memory using Document.createElement() and then check if a method exists on it. If it does, check what value it returns. See Dive Into HTML5 Video Formats detection test. Property on element retains value Create an element in memory using Document.createElement(), set a property to a certain value, then check to see if the value is retained. See Dive into HTML5 <input> types detection test. Note: The double NOT in the above example (!!) is a way to force a return value to become a "proper" boolean value, rather than a...
Mozilla’s UAAG evaluation report
2.11 Alert unsupported language. (P3) NR ? Guideline 3. Allow configuration not to render some content that may reduce accessibility. Checkpoint Title Status Notes/plans 3.1 Toggle background images. (P1) C Preferences, Appearance, Colors - "Use my chosen colors, ignoring the colors and background image specified" 3.2 Toggle audio, video, animated images. (P1) P Animated images can be made still with the Escape key Animated images can be made still as a preference under Preferences, Privacy & Security, Images - "Animated Images should Loop" Mozilla has no preference or command to toggle audio or video 3.3 Toggle animated/blinking text. (P1) P The following line can be added to a user's prefs.js file t...
Theme concepts
ject is then passed to theme.update() to change the header theme, as in this code snippet from the same example: function setTheme(theme) { if (currentTheme === theme) { // No point in changing the theme if it has already been set. return; } currentTheme = theme; browser.theme.update(themes[theme]); } Learn more about dynamic themes and see an additional example in the following video: If you have not built a browser extension before, check out Your first extension for a step-by-step guide. Cross-browser compatibility There is currently limited compatibility between themes in the major browsers. Opera takes an entirely different approach, and Microsoft Edge themes are not yet open to developers. There is good compatibility between Firefox static themes and Chrome theme...
Developer guide
hs automatically. Developer forums A topic-specific list of discussion forums and mailing lists where you can talk about Mozilla development issues. Mozilla Platform Development Cheat Sheet (archive.org) Brian Bondy's list of frequently referenced information for platform developers. Brian Bondy took down codefirefox.com, but the archived cheatsheet might still be useful. Firefox development video tutorials Brian Bondy's video tutorials on Firefox development. ...
mozbrowsercontextmenu
ement clicked on, which contains the menu's id. contextmenuItemSelected An anonymous function that fires when a menu item is selected. The MenuSystem object An object defining a standard context menu that will be displayed. Its properties are as follows: documentURI A DOMString representing the URL of the document the menu is associated with. uri A DOMString. In the case of an image or video context menu, this is the src of the image or video clicked on to get the context menu. In the case of an link context menu, it is the link's href. text A DOMString representing the text of the link clicked on, in the case of a link context menu. hasVideo A Boolean. In the case of a video context menu, this returns true if the video has metadata and is bigger than 0 x 0, or false if not. act...
Creating localizable web content
kely hard to translate because they are unclear, use play on words or colloquialisms. Depending on context, find alternate strings or document an explanation of the string for localizers Check that we don't link in new pages to sub-pages with anchors. E.g.: a new page is announced with only 100 words but it is actually content added to an existing page in English. Happens for things like Faq, or video pages for example. For video, use the code to display the video in an overlayed video player on the page instead of linking to a video section in English. Per-locale customizations Check if there are alternative links for localized pages (e.g., links to MDN, Addons.mozilla.org, or other external resources, are there translated equivalents we can use). If there are alternatives, use them by ad...
MathML Accessibility in Mozilla
ted by Orca is correctly exposed. AccessFu: MathML support in Android and Firefox OS is currently being implemented in our AccessFu module and a patch is available on bug 1163374. The table gives the output in mode "utterance" and description spoken last. Note that this is still very experimental. MathML Windows Mac Linux AccessFu Diagonal of a regular pentagon Video Video Video / x+2 __________ x plus 2 __________ x+2 x plus 2 x + y ab __________ a over b __________ fraction start, a over b, end of fraction fraction start. a over b. fraction end. a numerator b denominator fraction ab\frac a b ab __________ ...
Mozilla projects on GitHub
addon-sdk The Mozilla Add-on SDK. asknot The What Can I Do For Mozilla web site, which helps you figure out how you can contribute to Mozilla. bugsahoy A Web page to help new Mozilla contributors identify bugs to fix. bugzilla-dashboard A convenient dashboard to help you get an overview of your bugs. codefirefox The CodeFirefox site, with videos and tutorials about how to contribute to the Firefox project and Mozilla code in general. debugger.html The debugger.html, a modern universal JS debugger for Firefox DevTools, Node, and every other JS environment. dxr An intelligent tool for browsing source code. emscripten The Emscripten LLVM-to-JavaScript compiler. fxdt-adapters The Firefox Devel...
Index
-M Lists the PKCS #11 modules available to signtool, including smart cards. The -M option is available in Netscape Signing Tool 1.0 and later versions only. For informatio...
nss tech note1
Decoder ...
NSS tools : signtool
-M Lists the PKCS #11 modules available to signtool, including smart cards. The -M option is available in Netscape Signing Tool 1.0 and later versions only. For informatio...
Zest
shape Zest's future. Zest topics Usecases Reporting security vulnerabilities to developers Reporting security vulnerabilities to companies Defining active and passive scanner rules Deep integration with security tools Runtimes The runtime environments that support Zest Tools The tools that include support Zest Implementation The state of Zest development Videos Simon demoed Zest at AppSec USA in November 2013, and the full video of my talk is available on YouTube. The Zest part of the talk starts at 23:47. More details https://github.com/mozilla/zest - the code on github http://groups.google.com/group/mozilla-zest - the group used for discussing Zest ...
The Rust programming language
multi-core processors. It prevents segmentation faults and guarantees thread safety, all with an easy-to-learn syntax. In addition, Rust offers zero-cost abstractions, move semantics, guaranteed memory safety, threads with no data races, trait-based generics, pattern matching, type inference, and efficient C bindings, with a minimum runtime size. To learn more about Rust, you can: Watch the videos below for a closer look at the power and benefits Rust provides. Read the book The Rust Programming Language online. Download the Rust compiler, check out examples, and learn everything you could possibly wish to know at the Rust official web site. Rust and the future of systems programming Unlocking the power of parallelism with Rust Rust for web developers Safe systems programming...
AT APIs Support
web-browser, advanced e-mail and newsgroup client, IRC chat client, and HTML editing made simple Sunbird - cross-platform calendar application KompoZer - a complete Web Authoring System for Linux Desktop, Microsoft Windows and Macintosh users to rival programs like FrontPage and Dreamweaver. Open Komodo - platform for building developer environments Miro - a free, open source internet tv and video player Any XulRunner application (Songbird media player, etc.) Extensions to other XUL apps (e.g. Firefox extensions) Gecko Version For Firefox and all other Gecko-based products: this documentation applies to up-to-date product builds based on Gecko 1.9.2 -- currently not available on official releases. However most of described features are supported starting from Gecko 1.9.0 (Firefox 3.0)...
nsIDOMHTMLMediaElement
dom/interfaces/html/nsIDOMHTMLMediaElement.idlScriptable The basis for the nsIDOMHTMLAudioElement and nsIDOMHTMLVideoElement interfaces, which in turn implement the <audio> and <video> HTML5 elements. 1.0 67 Introduced Gecko 1.9.1 Inherits from: nsIDOMHTMLElement Last changed in Gecko 1.1 The nsIDOMHTMLMediaElement interface implements the DOM HTMLMediaElement interface. See that page for details. ...
nsIDOMJSWindow
One of the interfaces implemented by the window DOM object. This is only a magic interface to provide the JS implementation of a dom window and it should never be used by embedders, the ordinary DOM documentation should cover the rest. The interface is defined in dom/interfaces/base/nsIDOMJSWindow.idl. page composed by Sebastian Gurin <sgurin@(nospam)montevideo.com.uy ...
nsIDOMProgressEvent
IDOMProgressEvent.idlScriptable This interface represents the events sent with progress information while uploading data using the XMLHttpRequest object. 1.0 66 Introduced Gecko 1.9.1 Deprecated Gecko 22 Inherits from: nsIDOMEvent Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) The nsIDOMProgressEvent is used in the media elements (<video> and <audio>) to inform interested code of the progress of the media download. This implementation is a placeholder until the specification is complete, and is compatible with the WebKit ProgressEvent. Method overview void initProgressEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in boolean lengthComputableArg, in unsigned long long loadedArg, in unsign...
nsIDocShell
this subtree of the docshell tree. Defaults to true. Setting this will make it take effect starting with the next document loaded in the docshell. allowImages boolean Attribute stating whether or not images should be loaded. allowJavascript boolean Whether to allow Javascript execution. allowMedia boolean Attribute stating whether or not media (audio/video) should be loaded. allowMetaRedirects boolean Attribute stating if refresh based redirects can be allowed. allowPlugins boolean Whether to allow plugin execution. allowSubframes boolean Attribute stating if it should allow subframes (framesets/iframes) or not. allowWindowControl boolean Specifies whether or not content is allowed to con...
nsIFilePicker
orm specific application filter for file extensions. Application files for the user's platform will pass through the filter. filterAllowURLs 0x80 Allow URLs. filterAudio 0x100 Corresponds to the *.aac, *.aif, *.flac, *.iff, *.m4a, *.m4b, *.mid, *.midi, *.mp3, *.mpa, *.mpc, *.oga, *.ogg, *.ra, *.ram, *.snd, *.wav and *.wma filters for file extensions. filterVideo 0x200 Corresponds to the *.avi, *.divx, *.flv, *.m4v, *.mkv, *.mov, *.mp4, *.mpeg, *.mpg, *.ogm, *.ogv, *.ogx, *.rm, *.rmvb, *.smil, *.webm, *.wmv and *.xvid filters for file extensions. Methods appendFilter() Appends a custom file extension filter to the dialog. The filter appended first will be used to display the nsIFilePicker dialog, the user may then select another from the l...
nsIParserUtils
G. SanitizerDropNonCSSPresentation (1 << 3) Flag for sanitizer: Drops non-CSS presentational HTML elements and attributes, such as <font>, <center>, and the bgcolor attribute. SanitizerDropForms (1 << 4) Flag for sanitizer: Drops forms and form controls (excluding <fieldset> and <legend>. SanitizerDropMedia (1 << 5) Flag for sanitizer: Drops <img>, <video>, <audio>, and <source>, and flattens out SVG. SanitizerLogRemovals (1 << 6) Flag for sanitizer: Log messages to the console for everything that gets sanitized. Methods convertToPlainText() Converts HTML to plain text. AString convertToPlainText( in AString src, in unsigned long flags, in unsigned long wrapCol ); Parameters src The HTML source to parse (C++ c...
nsISecurityCheckedComponent
nterface to only allow access to code trusted with that capability. The two special return values of '"allAccess" or "noAccess" unconditionally allow or deny access to the operation. All code has the "allAccess" capability, and no code has the "noAccess" capability. This interface is used in Mozilla by XPConnect and a handful of things that need special handing (XUL controllers, the UI for the <video> tag, etc.). Method overview string canCallMethod(in nsIIDPtr iid, in wstring methodName); string canCreateWrapper(in nsIIDPtr iid); string canGetProperty(in nsIIDPtr iid, in wstring propertyName); string canSetProperty(in nsIIDPtr iid, in wstring propertyName); Methods canCallMethod() Returns a capability string indicating what permissions are required to call the specified method on...
Initialization and Destruction - Plugins
to delete any private instance-specific information stored in the plug-in's instance->pdata. NPError NPP_Destroy(NPP instance, NPSavedData **save); The instance parameter represents the plug-in instance to delete. The plug-in can use the optional save parameter to save data for reuse by a new instance with the same URL. The data is passed to NPP_New through its saved parameter. For example, a video player could save the last frame number to be displayed. When the user returns to the page, the previous frame number is passed to the new instance of the plug-in, so it can initially display the same frame. Note that you cannot count on data being saved this way; the data may be lost if the browser restarts or purges memory. Ownership of the buf field of the NPSavedData structure passes from th...
Debug eval sources - Firefox Developer Tools
This source is then listed in the source list pane, and can be opened and debugged like any other source. ...
Use a source map - Firefox Developer Tools
al source, enabling the browser to reconstruct the original source and present the reconstructed original in the debugger. To enable the debugger to work with a source map, you must: generate the source map include a comment in the transformed file, that points to the source map. The comment's syntax is like this: //# sourceMappingURL=http://example.com/path/to/your/sourcemap.map In the video above we load https://mdn.github.io/devtools-examples/sourcemaps-in-console/index.html. This page loads a source called "main.js" that was originally written in CoffeeScript and compiled to JavaScript. The compiled source contains a comment like this, that points to a source map: //# sourceMappingURL=main.js.map In the Debugger's source list pane, the original CoffeeScript source now appears as...
Index - Firefox Developer Tools
two of the Performance guides: the guide to the Call Tree and the guide to the Flame Chart. 87 Flame Chart The Call Tree and the Flame Chart are both used to analyze your site's JavaScript, and they both use the same data: a sample of the JavaScript engine's stack, taken periodically during the recording. 88 Frame rate Frame rate is the rate at which a video device can produce images (or frames). It's most familiar from film and gaming, but is now widely used as a performance measure for websites and web apps. 89 How to To open the Performance tools: 90 Scenarios NeedsContent Performance scenarios 91 Animating CSS properties CSS animation, Developer Tools, Web Performance With CSS animat...
Frame rate - Firefox Developer Tools
ving you a time budget of 16.7ms for all the updates needed in response to some event. The frame rate graph in the Performance tool shows you the frame rate over the course of a recording. It gives you a quick indication of where your site might be having problems, enabling you to use the other tools for a more in-depth analysis. Frame rate and responsiveness Frame rate is the rate at which a video device can produce images (or frames). It's most familiar from film and gaming, but is now widely used as a performance measure for websites and web apps. In web performance, a frame encapsulates the work the browser needs to do in order to update and repaint the screen. Frame rate is most obviously applicable to animations: if the frame rate is too low, an animation will have a jerky appearance...
Animating CSS properties - Firefox Developer Tools
want to play along, the demo website is here. It looks like this: It has two controls: a button to start/stop the animation, and a radio group to choose to animate using margin, or to animate using transform. There are a number of elements, and we've added a linear-gradient background and a box-shadow to each element, because they are both relatively expensive effects to paint. There's also a video version of this walkthrough: Animating using margin Leaving the "Use margin" option set, start the animation, open the Performance tool, and make a recording. You'll only need to record a few seconds. Open up the first recording. Exactly what you'll see depends a lot on your machine and system load, but it will be something like this: This is showing three distinct views: (a) an overview ...
Intensive JavaScript - Firefox Developer Tools
ample site whose long-running JavaScript causes responsiveness problems, and apply two different approaches to fixing them. The first is to split long-running functions into pieces and use requestAnimationFrame to schedule each piece, and the second is to run the whole function in a separate thread using a web worker. If you want to play along you can find the demo website here. There's also a video version of this walkthrough: The demo website looks like this: It has three controls: a radio button group to control how to run the JavaScript: as a single blocking operation in the main thread, as a series of smaller operations in the main thread using requestAnimationFrame(), or in another thread using a worker. a button to run the JavaScript, labeled "Do pointless computations!". a b...
Console messages - Firefox Developer Tools
ave entered a string on which to filter the output. Click the "x" icon to clear the filter and show the entire list again. You can negate a text search by prefixing it with the - character. For example, -img shows only items that do not contain the string img. Filtering with Regular Expressions You can also use a valid regular expression to filter the console output. For example, the following video shows the results when filtering on two simple regular expressions: /(cool|rad)/ and /(cool)/. You can negate a regular expression search by prefixing it with the - character. For example, -/(cool|rad)/ shows only items that do not match the expression /(cool|rad)/. Clearing the log Finally, you can use the trashcan icon on the left to clear the contents of the console. When you clear the co...
AudioContext.createMediaElementSource() - Web APIs
For more details about media element audio source nodes, check out the MediaElementAudioSourceNode reference page. Syntax var audioCtx = new AudioContext(); var source = audioCtx.createMediaElementSource(myMediaElement); Parameters myMediaElement An HTMLMediaElement object that you want to feed into an audio processing graph to manipulate. Returns A MediaElementAudioSourceNode. ...
AudioContext.createMediaStreamTrackSource() - Web APIs
stream returned by getUserMedia(). Then a BiquadFilterNode is created using createBiquadFilter(), and it's configured as desired to perform a lowshelf filter on the audio coming from the source. The output from the microphone is then routed into the new biquad filter, and the filter's output is in turn routed to the audio context's destination. ...
AudioContext - Web APIs
f the output latency of the current audio context. Methods Also inherits methods from its parent interface, BaseAudioContext. AudioContext.close() Closes the audio context, releasing any system audio resources that it uses. AudioContext.createMediaElementSource() Creates a MediaElementAudioSourceNode associated with an HTMLMediaElement. This can be used to play and manipulate audio from <video> or <audio> elements. AudioContext.createMediaStreamSource() Creates a MediaStreamAudioSourceNode associated with a MediaStream representing an audio stream which may come from the local computer microphone or other sources. AudioContext.createMediaStreamDestination() Creates a MediaStreamAudioDestinationNode associated with a MediaStream representing an audio stream which may be stored in a ...
AudioContextLatencyCategory - Web APIs
latencyHint option in the AudioContext() constructor's options dictionary. Values Value Description "balanced" The user agent should balance audio output latency and power consumption when selecting a latency value. "interactive" The audio is involved in interactive elements, such as responding to user actions or needing to coincide with visual cues such as a video or game action. The user agent should select the lowest possible latency that doesn't cause glitches in the audio. This is likely to require increased power consumption. This is the default value. "playback" The user agent should select a latency that will maximize playback time by minimizing power consumption at the expense of latency. Useful for non-interactive playback, such as pla...
AudioContextOptions - Web APIs
enumerated string, which selects a standard value for a given type of audio usage: Value Description "balanced" The user agent should balance audio output latency and power consumption when selecting a latency value. "interactive" The audio is involved in interactive elements, such as responding to user actions or needing to coincide with visual cues such as a video or game action. The user agent should select the lowest possible latency that doesn't cause glitches in the audio. This is likely to require increased power consumption. This is the default value. "playback" The user agent should select a latency that will maximize playback time by minimizing power consumption at the expense of latency. Useful for non-interactive playback, such as pla...
AudioNode - Web APIs
Web › API › AudioNode
The AudioNode interface is a generic interface for representing an audio processing module. Examples include: an audio source (e.g. an HTML <audio> or <video> element, an OscillatorNode, etc.), the audio destination, intermediate processing module (e.g. a filter like BiquadFilterNode or ConvolverNode), or volume control (like GainNode) <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><te...
AudioTrack.kind - Web APIs
Web › API › AudioTrack › kind
represents. The string is one of those found in Audio track kind strings below. Audio track kind strings The kinds available for audio tracks are: "alternative" A potential alternative to the main track, such as a different audio take or a version of the soundtrack with only the music and no dialogue. "descriptions" An audio track providing audible descriptions of the action depicted in a video track. "main" The primary audio track. "main-desc" The primary audio track with audio descriptions mixed into it. "translation" A translated version of the primary audio track. "commentary" An audio track containing a commentary. This might be used to contain the director's commentary track on a movie, for example. "" (empty string) The track doesn't have an explicit kind, or the kind p...
AudioTrack.language - Web APIs
The read-only AudioTrack property language returns a string identifying the language used in the audio track. For tracks that include multiple languages (such as a movie in English in which a few lines are spoken in other languages), this should be the video's primary language. Syntax var audioTrackLanguage = AudioTrack.language; Value A DOMString specifying the BCP 47 (RFC 5646) format language tag of the primary language used in the audio track, or an empty string ("") if the language is not specified or known, or if the track doesn't contain speech. For example, if the primary language used in the track is United States English, this value would be "en-US". For Brazilian Portuguese, the value would be "pt-BR". Example This example locates all of a media element's primary language and...
AudioTrackList: addtrack event - Web APIs
The addtrack event is fired when a track is added to an AudioTrackList. Bubbles No Cancelable No Interface TrackEvent Event handler property onaddtrack Examples Using addEventListener(): const videoElement = document.querySelector('video'); videoElement.audioTracks.addEventListener('addtrack', (event) => { console.log(`Audio track: ${event.track.label} added`); }); Using the onaddtrack event handler property: const videoElement = document.querySelector('video'); videoElement.audioTracks.onaddtrack = (event) => { console.log(`Audio track: ${event.track.label} added`); }; Specifications Specification Status HTML Living StandardThe definition of 'addtrack' in that specification. Living Standard ...
AudioTrackList.getTrackById() - Web APIs
as well as one for the music, sound effects, and so forth. This function allows the game to disable a specific character's audio in order to adjust the movie's performance based on occurrences within the game; if the character's dialog isn't relevant, it gets left out. Obviously that would require some clever graphic design to make work, but... it's a hypothetical game. function disableCharacter(videoElem, characterName) { videoElem.audioTracks.getTrackById(characterName).enabled = false; } This short function gets the AudioTrackList containing the video's audio tracks using HTMLMediaElement.audioTracks, then calls getTrackById() on it, specifying the character's name. The resulting track's audio is then disabled by setting its enabled flag to false. Specifications Specification...
AudioTrackList.length - Web APIs
rack in the media element. A value of 0 indicates that there are no audio tracks in the media. Syntax var trackCount = AudioTrackList.length; Value A number indicating how many audio tracks are included in the AudioTrackList. Each track can be accessed by treating the AudioTrackList as an array of objects of type AudioTrack. Example This snippet gets the number of audio tracks in the first <video> element found in the DOM by querySelector(). var videoElem = document.querySelector("video"); var numAudioTracks = 0; if (videoElem.audioTracks) { numAudioTracks = videoElem.audioTracks.length; } Note that this sample checks to be sure HTMLMediaElement.audioTracks is defined, to avoid failing on browsers without support for AudioTrack. Specifications Specification Status C...
AudioTrackList.onaddtrack - Web APIs
lement; one addtrack event will occur for each audio track in the media resource. Example This snippet establishes a handler for the addtrack event that calls a function, addToTrackList(), passing in the AudioTrack object representing the newly-added track. In this scenario, that function's role is to add the new track to a list of audio tracks available to choose from. document.querySelector("video").audioTracks.onaddtrack = function(event) { addToTrackList(event.track); }; Specifications Specification Status Comment HTML Living StandardThe definition of 'AudioTrackList.onaddtrack' in that specification. Living Standard HTML5The definition of 'AudioTrackList.onaddtrack' in that specification. Recommendation ...
AudioTrackList.onchange - Web APIs
eventHandler; Value Set onchange to a function that should be called whenever tracks are enabled or disabled on the media element. Example This snippet establishes a handler for the change event that looks at each of the tracks in the list, calling a function to update the state of a user interface control that indicates the current state of the track. ...
AudioTrackList.onremovetrack - Web APIs
ioTrackList.onremovetrack = eventHandler; Value Set onremovetrack to a function that accepts as input a TrackEvent object which indicates in its track property which audio track has been removed from the media element. Example This simple example just fetches the current number of audio tracks in the media element whenever a track is removed from the media element. document.querySelector("my-video").audioTracks.onremovetrack = function(event) { myTrackCount = document.querySelector("my-video").audioTracks.length; }; The current number of audio tracks remaining in the media element is obtained from AudioTrackList property length. Specifications Specification Status Comment HTML Living StandardThe definition of 'AudioTrackList.onremovetrack' in that specific...
AudioTrackList: removetrack event - Web APIs
The removetrack event is fired when a track is removed from an AudioTrackList. Bubbles No Cancelable No Interface TrackEvent Event handler property onremovetrack Examples Using addEventListener(): const videoElement = document.querySelector('video'); videoElement.audioTracks.addEventListener('removetrack', (event) => { console.log(`Audio track: ${event.track.label} removed`); }); Using the onremovetrack event handler property: const videoElement = document.querySelector('video'); videoElement.audioTracks.onremovetrack = (event) => { console.log(`Audio track: ${event.track.label} removed`); }; Specifications Specification Status HTML Living StandardThe definition of 'removetrack' in that specification. L...
AudioTrackList - Web APIs
ioTrackList lets you set event handlers on the addtrack and removetrack events, so that you can detect when tracks are added to or removed from the media element's stream. See onaddtrack and onremovetrack for details and examples. Examples Getting a media element's audio track list To get a media element's AudioTrackList, use its audioTracks property. var audioTracks = document.querySelector("video").audioTracks; Monitoring track count changes In this example, we have an app that displays information about the number of channels available. To keep it up to date, handlers for the addtrack and removetrack events are set up. audioTracks.onaddtrack = updateTrackCount; audioTracks.onremovetrack = updateTrackCount; function updateTrackCount(event) { trackCount = audioTracks.length; drawTr...
CanvasCaptureMediaStreamTrack.requestFrame() - Web APIs
or exceptions such as SecurityError (although the specific error that might be thrown is not mentioned in the spec, this is a likely candidate). Example // Find the canvas element to capture var canvasElt = document.getElementsByTagName("canvas")[0]; // Get the stream var stream = canvasElt.captureStream(25); // 25 FPS // Send the current state of the canvas as a frame to the stream stream.getVideoTracks()[0].requestFrame(); Specifications Specification Status Comment Media Capture from DOM ElementsThe definition of 'CanvasCaptureMediaStream.requestFrame()' in that specification. Working Draft Initial definition ...
CanvasCaptureMediaStreamTrack - Web APIs
Part of the Media Capture and Streams API. Properties This interface inherits the properties of its parent, MediaStreamTrack. CanvasCaptureMediaStreamTrack.canvas Read only Returns the HTMLCanvasElement object whose surface is captured in real-time. Methods This interface inherits the methods of its parent, MediaStreamTrack. CanvasCaptureMediaStreamTrack.requestFrame() Manually forces a frame to be captured and sent to the stream. ...
CanvasImageSource - Web APIs
e provides a mechanism for other interfaces to be used as image sources for some methods of the CanvasDrawImage and CanvasFillStrokeStyles interfaces. It's just an internal helper type to simplify the specification. It's not an interface and there are no objects implementing it. The interfaces that it allows to be used as image sources are the following: HTMLImageElement SVGImageElement HTMLVideoElement HTMLCanvasElement ImageBitmap OffscreenCanvas Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasImageSource' in that specification. Living Standard Initial definition. ...
CanvasPattern - Web APIs
It can be used as a fillStyle or strokeStyle. Properties As an opaque object, this has no exposed property. Methods There are no inherited method. CanvasPattern.setTransform() Applies an SVGMatrix or DOMMatrix representing a linear transform to the pattern. ...
CanvasRenderingContext2D.createPattern() - Web APIs
s must be assigned to the CanvasRenderingContext2D.fillStyle or CanvasRenderingContext2D.strokeStyle properties, after which it is applied to any subsequent drawing. Syntax CanvasPattern ctx.createPattern(image, repetition); Parameters image A CanvasImageSource to be used as the pattern's image. It can be any of the following: HTMLImageElement (<img>) SVGImageElement (<image>) HTMLVideoElement (<video>, by using the capture of the video) HTMLCanvasElement (<canvas>) ImageBitmap OffscreenCanvas repetition A DOMString indicating how to repeat the pattern's image. Possible values are: "repeat" (both directions) "repeat-x" (horizontal only) "repeat-y" (vertical only) "no-repeat" (neither direction) If repetition is specified as an empty string ("") or null (...
A basic ray-caster - Web APIs
ngly well. With the blockiness factor cranked up to render slivers 8 pixels wide, I can run a 320 x 240 window at 24 fps on my Apple mini. Firefox 1.5 Beta 1 is even faster; I can run 320 x 240 at 24 fps with 4 pixel slivers. Not exactly a new member of the ID software family, but pretty decent considering it's a fully interpreted environment, and I didn't have to worry about memory allocation or video modes or coding inner routines in assembler or anything. The code does attempt to be very efficient, using array look-ups of pre-computed values, but I'm no optimization guru, so things could probably be written faster. Also, it leaves a lot to be desired in terms of trying to be any sort of game engine--there are no wall textures, no sprites, no doors, not even any teleporters to get to another...
Applying styles and colors - Web APIs
adient #019F62 = rgba(1,159,98,1). ScreenshotLive sample Patterns In one of the examples on the previous page, we used a series of loops to create a pattern of images. There is, however, a much simpler method: the createPattern() method. createPattern(image, type) Creates and returns a new canvas pattern object. image is a CanvasImageSource (that is, an HTMLImageElement, another canvas, a <video> element, or the like. type is a string indicating how to use the image. The type specifies how to use the image in order to create the pattern, and must be one of the following string values: repeat Tiles the image in both vertical and horizontal directions. repeat-x Tiles the image horizontally but not vertically. repeat-y Tiles the image vertically but not horizontally. no-repeat D...
Basic animations - Web APIs
e animation. The requestAnimationFrame method provides a smoother and more efficient way for animating by calling the animation frame when the system is ready to paint the frame. The number of callbacks is usually 60 times per second and may be reduced to a lower rate when running in background tabs. For more information about the animation loop, especially for games, see the article Anatomy of a video game in our Game development zone. An animated solar system This example animates a small model of our solar system. var sun = new Image(); var moon = new Image(); var earth = new Image(); function init() { sun.src = 'https://mdn.mozillademos.org/files/1456/Canvas_sun.png'; moon.src = 'https://mdn.mozillademos.org/files/1443/Canvas_moon.png'; earth.src = 'https://mdn.mozillademos.org/fi...
Basic usage of canvas - Web APIs
anvas> element can be styled just like any normal image (margin, border, background...). These rules, however, don't affect the actual drawing on the canvas. We'll see how this is done in a dedicated chapter of this tutorial. When no styling rules are applied to the canvas it will initially be fully transparent. Fallback content The <canvas> element differs from an <img> tag in that, like for <video>, <audio>, or <picture> elements, it is easy to define some fallback content, to be displayed in older browsers not supporting it, like versions of Internet Explorer earlier than version 9 or textual browsers. You should always provide fallback content to be displayed by those browsers. Providing fallback content is very straightforward: just insert the alternate content inside the <canvas> elem...
Hit regions and accessibility - Web APIs
();">circle</a>. Partially overlaying the circle is a green <a href="http://en.wikipedia.org/wiki/Square" onfocus="drawSquare();" onblur="drawPicture();">square</a> and a purple <a href="http://en.wikipedia.org/wiki/Triangle" onfocus="drawTriangle();" onblur="drawPicture();">triangle</a>, both of which are semi-opaque, so the full circle can be seen underneath.</p> </canvas> See the video how NVDA reads this example by Steve Faulkner. ARIA rules Accessible Rich Internet Applications (ARIA) defines ways to make Web content and Web applications more accessible to people with disabilities. You can use ARIA attributes to describe the behavior and purpose of the canvas element. See ARIA and ARIA techniques for more information. <canvas id="button" tabindex="0" role="button" aria-pre...
Pixel manipulation with canvas - Web APIs
he pixel data for the area of the canvas whose corners are represented by the points (left,top), (left+width, top), (left, top+height), and (left+width, top+height). The coordinates are specified in canvas coordinate space units. Note: Any pixels outside the canvas are returned as transparent black in the resulting ImageData object. This method is also demonstrated in the article Manipulating video using canvas. A color picker In this example we are using the getImageData() method to display the color under the mouse cursor. For this, we need the current position of the mouse with layerX and layerY, then we look up the pixel data on that position in the pixel array that getImageData() provides us. Finally, we use the array data to set a background color and a text in the <div> to display ...
ContentIndex.add() - Web APIs
Web › API › ContentIndex › add
user-visible lists of content. description: A String description of the item. Used in user-visible lists of content. url: A String containing the url of the corresponding HTML document. Needs to be under the scope of the current service worker. category: Optional A String defining the category of content. Can be: '' An empty String, this is the default. homepage article video audio icons: Optional An Array of image resources, defined as an Object with the following data: src: A url String of the source image. sizes: Optional A String representation of the image size. type: Optional The MIME type of the image. Return value Returns a Promise that resolves with undefined Exceptions TypeError If the service worker's registra...
ContentIndex.getAll() - Web APIs
user-visible lists of content. description: A String description of the item. Used in user-visible lists of content. url: A String containing the url of the corresponding HTML document. Needs to be under the scope of the current service worker. category: Optional A String defining the category of content. Can be: '' An empty String, this is the default. homepage article video audio icons: Optional An Array of image resources, defined as an Object with the following data: src: A url String of the source image. sizes: Optional A String representation of the image size. type: Optional The MIME type of the image. Exceptions No exceptions are thrown. If there are no items in the Content Index, an empty Array is returned. Examples...
Binary strings - Web APIs
Web › API › DOMString › Binary
he JavaScript language design. However at least one native function requires binary strings as its input, btoa(): invoking it on a string that contains codepoints greater than 255 will cause a Character Out Of Range error. The reason that brought to use UTF-16 code units as placeholders for uint8 numbers is that as web applications become more and more powerful (adding features such as audio and video manipulation, access to raw data using WebSockets, and so forth) it has become clear that there are times when it would be helpful for JavaScript code to be able to quickly and easily manipulate raw binary data. In the past, this had to be simulated by treating the raw data as a string and using the charCodeAt() method to read the bytes from the data buffer (i.e., using binary strings). However,...
Document.mozSyntheticDocument - Web APIs
Syntax var isSynthetic = document.mozSyntheticDocument; On return, isSynthetic is true if the document is a synthetic one; otherwise it's false. Example This can be useful if you have a contextual menu item you only want to display for synthetic documents (or, conversely, for documents that aren't synthetic). ...
Document - Web APIs
Web › API › Document
astStyleSheetSetRead only Returns the name of the style sheet set that was last enabled. Has the value null until the style sheet is changed by setting the value of selectedStyleSheetSet. Document.linksRead only Returns a list of all the hyperlinks in the document. Document.mozSyntheticDocument Returns a Boolean that is true only if this document is synthetic, such as a standalone image, video, audio file, or the like. Document.pluginsRead only Returns a list of the available plugins. Document.featurePolicy Read only Returns the FeaturePolicy interface which provides a simple API for introspecting the feature policies applied to a specific document. Document.preferredStyleSheetSetRead only Returns the preferred style sheet set as specified by the page author. Document.script...
Element.onfullscreenchange - Web APIs
ent value to the element to see if they're the same node. This gives us a value, isFullscreen, which we pass into a function called adjustMyControls(), which we imagine to be a function that makes adjustments to the app's user interface to present itself optimally when it's in full-screen mode versus being displayed in a window. ...
Element.onfullscreenerror - Web APIs
fullscreenerror event. Example This example attempts to switch into full-screen mode from outside a handler for a user-initiated event (such as a click or keypress event). Since full-screen mode changes are only permitted in response to a user input, this causes an error to occur, which triggers the delivery of the fullscreenerror event to the error handler, let elem = document.querySelector("video")}} elem.onfullscreenerror = function ( event ) { displayWarning("Unable to switch into full-screen mode."); }; //.... elem.requestFullscreen(); Specifications Specification Status Comment Fullscreen APIThe definition of 'onfullscreenerror' in that specification. Living Standard Initial definition. ...
Event - Web APIs
Web › API › Event
dler attributes. Further, when properly added, such handlers can also be disconnected if needed using removeEventListener(). Note: One element can have several such handlers, even for the exact same event--particularly if separate, independent code modules attach them, each for its own independent purposes. ...
Using files from web applications - Web APIs
sabled must be set to false . <iframe id="viewer"> And here is the change of the src attribute: const obj_url = URL.createObjectURL(blob); const iframe = document.getElementById('viewer'); iframe.setAttribute('src', obj_url); URL.revokeObjectURL(obj_url); Example: Using object URLs with other file types You can manipulate files of other formats the same way. Here is how to preview uploaded video: const video = document.getElementById('video'); const obj_url = URL.createObjectURL(blob); video.src = obj_url; video.play(); URL.revokeObjectURL(obj_url); Specifications Specification Status Comment HTML Living StandardThe definition of 'File upload state' in that specification. Living Standard File API Working Draft Initial definition ...
File.type - Web APIs
Web › API › File › type
name: " + name + " , Type: " + type); } } Note: Based on the current implementation, browsers won't actually read the bytestream of a file to determine its media type. It is assumed based on the file extension; a PNG image file renamed to .txt would give "text/plain" and not "image/png". Moreover, file.type is generally reliable only for common file types like images, HTML documents, audio and video. Uncommon file extensions would return an empty string. Client configuration (for instance, the Windows Registry) may result in unexpected values even for common types. Developers are advised not to rely on this property as a sole validation scheme. Specifications Specification Status Comment File APIThe definition of 'type' in that specification. Working Draft ...
Using the Gamepad API - Web APIs
The Gamepad API is a way for developers and designers to access and use gamepads and other game controllers. The Gamepad API introduces new events on the Window object for reading gamepad and controller (hereby referred to as gamepad) state. ...
HTMLCanvasElement.captureStream() - Web APIs
Syntax MediaStream = canvas.captureStream(frameRate); Parameters frameRate Optional A double-precision floating-point value that indicates the rate of capture of each frame. If not set, a new frame will be captured each time the canvas changes; if set to 0, frames will not be captured automatically; instead, they will only be captured when the returned track's requestFrame() method is called. ...
HTMLCanvasElement - Web APIs
context to draw to from the printState object and must then call done() on it when finished. The purpose of mozPrintCallback is to obtain a higher resolution rendering of the canvas at the resolution of the printer being used. See this blog post. Methods Inherits methods from its parent, HTMLElement. HTMLCanvasElement.captureStream() Returns a CanvasCaptureMediaStream that is a real-time video capture of the surface of the canvas. HTMLCanvasElement.getContext() Returns a drawing context on the canvas, or null if the context ID is not supported. A drawing context lets you draw on the canvas. Calling getContext with "2d" returns a CanvasRenderingContext2D object, whereas calling it with "webgl" (or "experimental-webgl") returns a WebGLRenderingContext object. This context is only avail...
HTMLLinkElement.as - Web APIs
Syntax var as = HTMLLinkElement.as HTMLLinkElement.as = as Value A DOMString. Specifications Specification Status Comment PreloadThe definition of 'as' in that specification. Candidate Recommendation Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. ...
HTMLMediaElement.buffered - Web APIs
buffered (if any) at the moment the buffered property is accessed. Note: This feature is not available in Web Workers. Syntax var timeRange = audioObject.buffered Value A TimeRanges object. This object is normalized, which means that ranges are ordered, don't overlap, aren't empty, and don't touch (adjacent ranges are folded into one bigger range). Example var obj = document.createElement('video'); console.log(obj.buffered); // TimeRanges { length: 0 } Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.buffered' in that specification. Living Standard No change from HTML5 HTML5The definition of 'HTMLMediaElement.buffered' in that specification. Recommendation Initial definition. ...
HTMLMediaElement.controls - Web APIs
The HTMLMediaElement.controls property reflects the controls HTML attribute, which controls whether user interface controls for playing the media item will be displayed. Syntax var ctrls = video.controls; audio.controls = true; Value A Boolean. A value of true means controls will be displayed. Example var obj = document.createElement('video'); obj.controls = true; Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.controls' in that specification. Living Standard No change from HTML5 HTML5The definition of 'HTMLMediaElement.controls' in that specification. Recommendation Initial definition. ...
HTMLMediaElement.currentSrc - Web APIs
TY. Syntax var mediaUrl = audioObject.currentSrc; Value A DOMString object containing the absolute URL of the chosen media source; this may be an empty string if networkState is EMPTY; otherwise, it will be one of the resources listed by the HTMLSourceElement contained within the media element, or the value or src if no <source> element is provided. Example var obj = document.createElement('video'); console.log(obj.currentSrc); // "" Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.currentSrc' in that specification. Living Standard No change from HTML5 HTML5The definition of 'HTMLMediaElement.currentSrc' in that specification. Recommendation Initial definition. ...
HTMLMediaElement.currentTime - Web APIs
media without a known duration--such as media being streamed live--it's possible that the browser may not be able to obtain parts of the media that have expired from the media buffer. Also, media whose timeline doesn't begin at 0 seconds cannot be seeked to a time before its timeline's earliest time. The length of the media in seconds can be determined using the duration property. Example var video = document.createElement('video'); console.log(video.currentTime); Usage notes Reduced time precision To offer protection against timing attacks and fingerprinting, browsers may round or otherwise adjust the value returned by currentTime. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.currentTime' in that specifica...
HTMLMediaElement.defaultMuted - Web APIs
The HTMLMediaElement.defaultMuted property reflects the muted HTML attribute, which indicates whether the media element's audio output should be muted by default. This property has no dynamic effect. To mute and unmute the audio output, use the muted property. Syntax var dMuted = video.defaultMuted; audio.defaultMuted = true; Value A Boolean. A value of true means that the audio output will be muted by default. Example var videoEle = document.createElement('video'); videoEle.defaultMuted = true; console.log(videoEle.outerHTML); // <video muted=""></video> Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.defaultMuted' in that specification. Living Standard No change from HTML5 HTML5The definition...
HTMLMediaElement.defaultPlaybackRate - Web APIs
The HTMLMediaElement.defaultPlaybackRate property indicates the default playback rate for the media. Syntax var dSpeed = video.defaultPlaybackRate; audio.defaultPlaybackRate = 1.0; Value A double. 1.0 is "normal speed," values lower than 1.0 make the media play slower than normal, higher values make it play faster. The value 0.0 is invalid and throws a NOT_SUPPORTED_ERR exception. Example var obj = document.createElement('video'); console.log(obj.defaultPlaybackRate); // 1 Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.defaultPlaybackRate' in that specification. Living Standard No change from HTML5 HTML5The definition of 'HTMLMediaElement.defaultPlaybackRate' in that specification. Recommen...
HTMLMediaElement.duration - Web APIs
e element's media in seconds. Syntax myDuration = htmlMediaElement.duration Value A double-precision floating-point value indicating the duration of the media in seconds. If no media data is available, the value NaN is returned. If the element's media doesn't have a known duration--such as for live media streams--the value of duration is +Infinity. Examples var obj = document.createElement('video'); console.log(obj.duration); // NaN Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.duration' in that specification. Living Standard HTML5The definition of 'HTMLMediaElement.duration' in that specification. Recommendation Initial definition. ...
HTMLMediaElement: emptied event - Web APIs
No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onemptied Specification HTML5 media Examples These examples add an event listener for the HTMLMediaElement's emptied event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('video'); video.addEventListener('emptied', (event) => { console.log('Uh oh. The media is empty. Did you call load()?'); }); Using the onemptied event handler property: const video = document.querySelector('video'); video.onemptied = (event) => { console.log('Uh oh. The media is empty. Did you call load()?'); }; Specifications Specification Status ...
HTMLMediaElement.ended - Web APIs
The HTMLMediaElement.ended indicates whether the media element has ended playback. Syntax var isEnded = HTMLMediaElement.ended Value A Boolean which is true if the media contained in the element has finished playing. If the source of the media is a MediaStream, this value is true if the value of the stream's active property is false. Example var obj = document.createElement('video'); console.log(obj.ended); // false Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.ended' in that specification. Living Standard HTML5The definition of 'HTMLMediaElement.ended' in that specification. Recommendation ...
HTMLMediaElement.fastSeek() - Web APIs
The HTMLMediaElement.fastSeek() method quickly seeks the media to the new time with precision tradeoff. Note: If you need to seek with precision, you should set HTMLMediaElement.currentTime instead. Syntax HTMLMediaElement.fastSeek(time); Parameters time A double. Return value None. Example This example quickly seeks to 20-second position of the video element. let myVideo = document.getElementById("myVideoElement"); myVideo.fastSeek(20); Specifications Specification Status Comment HTML Living StandardThe definition of 'fastSeek()' in that specification. Living Standard Initial definition; living specification. ...
HTMLMediaElement.loop - Web APIs
The HTMLMediaElement.loop property reflects the loop HTML attribute, which controls whether the media element should start over when it reaches the end. Syntax var loop = video.loop; audio.loop = true; Value A Boolean. Example var obj = document.createElement('video'); obj.loop = true; // true Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.loop' in that specification. Living Standard HTML5The definition of 'HTMLMediaElement.loop' in that specification. Recommendation ...
HTMLMediaElement.muted - Web APIs
true means muted and false means not muted. Example var obj = document.createElement('video'); console.log(obj.muted); // false Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.muted' in that specification. ...
HTMLMediaElement.networkState - Web APIs
Possible values are: Constant Value Description NETWORK_EMPTY 0 There is no data yet. Also, readyState is HAVE_NOTHING. NETWORK_IDLE 1 HTMLMediaElement is active and has selected a resource, but is not using the network. NETWORK_LOADING 2 The browser is downloading HTMLMediaElement data. NETWORK_NO_SOURCE 3 No HTMLMediaElement src found. ...
HTMLMediaElement.paused - Web APIs
true is paused and false is not paused. Example var obj = document.createElement('video'); console.log(obj.paused); // true Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.paused' in that specification. ...
HTMLMediaElement.seekable - Web APIs
The seekable read-only property of the HTMLMediaElement returns a TimeRanges object that contains the time ranges that the user is able to seek to, if any. Syntax var seekable = audioOrVideo.seekable; Value A TimeRanges object. Examples var video = document.querySelector("video"); var timeRangesObject = video.seekable; var timeRanges = []; //Go through the object and output an array for (let count = 0; count < timeRangesObject.length; count ++) { timeRanges.push([timeRangesObject.start(count), timeRangesObject.end(count)]); } Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement' in that specification. Living Standard No change from HTML5 HTML5The definition of 'HTMLMediaElement' in that specifi...
HTMLMediaElement.src - Web APIs
akes into account selection of a best or preferred media resource from a list provided in an HTMLSourceElement (which represents a <source> element). Syntax var mediaUrl = HTMLMediaElement.src; Value A USVString object containing the URL of a media resource to use in the element; this property reflects the value of the HTML element's src attribute. Example var obj = document.createElement('video'); console.log(obj.src); // "" Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.src' in that specification. Living Standard No change from HTML5 HTML5The definition of 'HTMLMediaElement.src' in that specification. Recommendation Initial definition. ...
HTMLMediaElement.volume - Web APIs
Example var obj = document.createElement('audio'); console.log(obj.volume); // 1 obj.volume = 0.75; Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLMediaElement.volume' in that specification. ...
HTMLScriptElement - Web APIs
HTML <script> elements expose the HTMLScriptElement interface, which provides special properties and methods for manipulating the behavior and execution of <script> elements (beyond the inherited HTMLElement interface). JavaScript files should be served with the application/javascript MIME type, but browsers are lenient and block them only if the script is served with an image type (image/*), video type (video/*), audio type (audio/*), or text/csv. If the script is blocked, its element receives an error event; otherwise, it receives a load event. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600...
HTMLSourceElement - Web APIs
attribute, containing the intended type of the media resource. HTMLSourceElement.sizes Is a DOMString representing image sizes between breakpoints HTMLSourceElement.src Is a DOMString reflecting the src HTML attribute, containing the URL for the media resource. The HTMLSourceElement.src property has a meaning only when the associated <source> element is nested in a media element that is a <video> or an <audio> element. It has no meaning and is ignored when it is nested in a <picture> element. Note: If the src property is updated (along with any siblings), the parent HTMLMediaElement's load method should be called when done, since <source> elements are not re-scanned automatically. HTMLSourceElement.srcset Is a DOMString reflecting the srcset HTML attribute, containing a list of c...
HTMLTrackElement: cuechange event - Web APIs
() { let cues = track.activeCues; // array of current cues } On the track element The underlying TextTrack, indicated by the track property, receives a cuechange event every time the currently-presented cue is changed. This happens even if the track isn't associated with a media element. If the track is associated with a media element, using the <track> element as a child of the <audio> or <video> element, the cuechange event is also sent to the HTMLTrackElement. let textTrackElem = document.getElementById("texttrack"); textTrackElem.addEventListener("cuechange", (event) => { let cues = event.target.track.activeCues; }); In addition, you can use the oncuechange event handler: let textTrackElem = document.getElementById("texttrack"); textTrackElem.oncuechange = (event) => { let c...
HTMLTrackElement - Web APIs
The HTMLTrackElement interface represents an HTML <track> element within the DOM. This element can be used as a child of either <audio> or <video> to specify a text track containing information such as closed captions or subtitles. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignm...
ImageCapture.grabFrame() - Web APIs
Syntax const bitmapPromise = imageCapture.grabFrame() Return value A Promise that resolves to an ImageBitmap object. Example This example is extracted from this Simple Image Capture demo. It shows how to use the Promise returned by grabFrame() to copy the returned frame to a <canvas> element. For simplicy it does not show how to instantiate the ImageCapture object. ...
ImageCapture.takePhoto() - Web APIs
Syntax const blobPromise = imageCaptureObj.takePhoto([photoSettings]) Parameters photoSettings Optional An object that sets options for the photo to be taken. The available options are: fillLightMode: The flash setting of the capture device, one of "auto", "off", or "flash". imageHeight: The desired image height as an integer. The user agent selects the closest height value to this setting if it only supports discrete heights. imageWidth: The desired image width as an integer. ...
MSGraphicsTrust - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The msGraphicsTrust() constructor returns an object that provides properties for info on protected video playback. This proprietary method is specific to Internet Explorer and Microsoft Edge. Syntax var trustObject = media.msGraphicsTrustStatus; Parameters constrictionActive A read-only property which returns true when protected media is forced to play in a lower resolution. status A read-only property which returns an enum with the driver status when playing protected content. Inheritance hie...
MediaCapabilities.decodingInfo() - Web APIs
erefficient, which describe whether decoding the media described would be supported, smooth, and powerefficient. Syntax mediaCapabilities.decodingInfo(MediaDecodingConfiguration) Parameters MediaDecodingConfiguration A valid MediaDecodingConfiguration dictionary containing a valid media decoding type of file or media-source and a valid media configuration: either an AudioConfiguration or a VideoConfiguration. Return value A Promise fulfilling with a MediaCapabilitiesInfo interface containing three Boolean attributes: supported smooth powerEfficient Exceptions A TypeError is raised if the MediaConfiguration passed to the decodingInfo() method is invalid, either because the type is not video or audio, the contentType is not a valid codec MIME type, the media decoding configurati...
MediaDeviceInfo.kind - Web APIs
Syntax var kind = MediaDeviceInfo.kind Value A DOMString. Specifications Specification Status Comment Media Capture and StreamsThe definition of 'kind' in that specification. Candidate Recommendation Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
MediaElementAudioSourceNode - Web APIs
It is an AudioNode that acts as an audio source. A MediaElementSourceNode has no inputs and exactly one output, and is created using the AudioContext.createMediaElementSource() method. The amount of channels in the output equals the number of channels of the audio referenced by the HTMLMediaElement used in the creation of the node, or is 1 if the HTMLMediaElement has no audio. ...
MediaError - Web APIs
A MediaError object describes the error in general terms using a numeric code categorizing the kind of error, and a message, which provides specific diagnostics about what went wrong. Properties This interface doesn't inherit any properties. ...
MediaImage - Web APIs
Properties src The URL from which user agent can fetch the image's data. sizes Specifies the resource in multiple sizes so that user agent does not have to scale a single image. type The MIME type hint for the user agant. ...
MediaKeySystemConfiguration - Web APIs
ut the media key system in use. Properties MediaKeySystemConfiguration.initDataTypes Read only Returns a list of supported initialization data type names. An initialization data type is a string indicating the format of the initialization data. MediaKeySystemConfiguration.audioCapabilities Read only Returns a list of supported audio type and capability pairs. MediaKeySystemConfiguration.videoCapabilities Read only Returns a list of supported video type and capability pairs. MediaKeySystemConfiguration.distinctiveIdentifier Read only Indicates whether a persistent distinctive identifier is required. MediaKeySystemConfiguration.persistentState Read only Indicates whether the ability to persist state is required. Specifications Specification Status Comment ...
MediaRecorder.ignoreMutedMedia - Web APIs
The default is false. Syntax var boolean = MediaRecorder.ignoreMutedMedia MediaRecorder.ignoreMutedMedia = boolean Value A Boolean. Browser Compatibility The compatibility table in this page is generated from structured data. ...
MediaSource.duration - Web APIs
Specifications Specification Status Comment Media Source ExtensionsThe definition of 'duration' in that specification. Recommendation Initial definition. ...
MediaSource.sourceBuffers - Web APIs
Specifications Specification Status Comment Media Source ExtensionsThe definition of 'sourceBuffers' in that specification. Recommendation Initial definition. ...
active - Web APIs
rwise, the value is false. Example In this example, a new stream whose source is the user's local camera and microphone is requested using getUserMedia(). When that stream becomes available (that is, when the returned Promise is fulfilled, a button on the page is updated based on whether or not the stream is currently active. var promise = navigator.mediaDevices.getUserMedia({ audio: true, video: true }); promise.then(function(stream) { var startBtn = document.querySelector('#startBtn'); startBtn.disabled = stream.active; };) Specifications Specification Status Comment Media Capture and StreamsThe definition of 'active' in that specification. Candidate Recommendation Initial definition. ...
MediaStream.getTrackById() - Web APIs
cified ID, this method returns null. Syntax var track = MediaStream.getTrackById(id); Parameters id A DOMString which identifies the track to be returned. Return value If a track is found for which MediaStreamTrack.id matches the specified id string, that MediaStreamTrack object is returned. Otherwise, the returned value is null. Example This example activates a commentary track on a video by ducking the audio level of the main audio track to 50%, then enabling the commentary track. stream.getTrackById("primary-audio-track").applyConstraints({ volume: 0.5 }); stream.getTrackById("commentary-track").enabled = true; Specifications Specification Status Comment Media Capture and StreamsThe definition of 'getTrackById()' in that specification. Candidate...
MediaStream.getTracks() - Web APIs
The getTracks() method of the MediaStream interface returns a sequence that represents all the MediaStreamTrack objects in this stream's track set, regardless of MediaStreamTrack.kind. Syntax var mediaStreamTracks = mediaStream.getTracks() Parameters None. Return value An array of MediaStreamTrack objects. Example navigator.mediaDevices.getUserMedia({audio: false, video: true}) .then(mediaStream => { document.querySelector('video').srcObject = mediaStream; // Stop the stream after 5 seconds setTimeout(() => { const tracks = mediaStream.getTracks() tracks[0].stop() }, 5000) }) Specifications Specification Status Comment Media Capture and StreamsThe definition of 'getTracks()' in that specification. Candidate Recommendation Initial d...
MediaStream.id - Web APIs
Web › API › MediaStream › id
Candidate Recommendation Initial definition. ...
MediaStream.onaddtrack - Web APIs
ch you provide that accepts as input a MediaStreamTrackEvent object representing the addtrack event which has occurred. The MediaStreamTrack representing the track which was added is specified in the event's track property. Example This example adds a listener which, when a new track is added to the stream, appends a new item to a list of tracks; the new item shows the track's kind ("audio" or "video") and label. stream.onaddtrack = function(event) { let trackList = document.getElementById("tracks"); let label = document.createElement("li"); label.innerHTML = event.track.kind + ": " + event.track.label; trackList.appendChild(label); }; Specifications Specification Status Comment Media Capture and StreamsThe definition of 'MediaStream.onaddtrack' in tha...
MediaStreamTrack.getConstraints() - Web APIs
of constraints most recently established for the track using a prior call to applyConstraints(). These constraints indicate values and ranges of values that the Web site or application has specified are required or acceptable for the included constrainable properties. Constraints can be used to ensure that the media meets certain guidelines you prefer. For example, you may prefer high definition video but require that the frame rate be a little low to help keep the data rate low enough not overtax the network. Constraints can also specify ideal and/or acceptable sizes or ranges of sizes. See Capabilities, constraints, and settings for details on how to work with constrainable properties. Syntax const constraints = track.getConstraints() Return value A MediaTrackConstraints object which ind...
MediaStreamTrack.kind - Web APIs
The MediaStreamTrack.kind read-only property returns a DOMString set to "audio" if the track is an audio track and to "video", if it is a video track. It doesn't change if the track is deassociated from its source. Syntax const type = track.kind Value The possible values are a DOMString with on of the following values: "audio": the track is an audio track. "video": the track is a video track. Specifications Specification Status Comment Media Capture and StreamsThe definition of 'MediaStreamTrack.kind' in that specification. Candidate Recommendation Initial specification. ...
MediaStreamTrack.muted - Web APIs
The muted read-only property of the MediaStreamTrack interface returns a Boolean value indicating whether or not the track is currently unable to provide media output. To implement a way for users to mute and unmute a track, use the enabled property. When a track is disabled by setting enabled to false, it generates only empty frames (audio frames in which every sample is 0, or video frames in which every pixel is black). Syntax const mutedFlag = track.muted Value A Boolean which is true if the track is currently muted, or false if the track is currently unmuted. When possible, avoid polling muted to monitor the track's muting status. Instead, add event listeners for the mute and unmute events. Example This example counts the number of tracks in an array of MediaStreamTrack objects...
MediaStreamTrackAudioSourceNode() - Web APIs
its kind property isn't audio. Example This example uses getUserMedia() to obtain access to the user's camera, then creates a new MediaStreamAudioSourceNode from the first audio track provided by the device. ...
MediaStreamTrackAudioSourceOptions.mediaStreamTrack - Web APIs
kAudioSourceNode will be taken. Example This example uses getUserMedia() to obtain access to the user's camera, then creates a new MediaStreamAudioSourceNode from the first audio track provided by the device. ...
Using the MediaStream Recording API - Web APIs
This article aims to provide a basic guide on how to use the MediaRecorder interface, which provides this API. A sample application: Web Dictaphone To demonstrate basic usage of the MediaRecorder API, we have built a web-based dictaphone. It allows you to record snippets of audio and then play them back. It even gives you a visualization of your device's sound input, using the Web Audio API. ...
MediaTrackConstraints.aspectRatio - Web APIs
kSupportedConstraints.aspectRatio as returned by a call to MediaDevices.getSupportedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var constraintsObject = { aspectRatio: constraint }; constraintsObject.aspectRatio = constraint; Value A ConstrainDouble describing the acceptable or required value(s) for a video track's aspect ratio. The value is the width divided by the height and is rounded to ten decimal places. For example, the standard high-definition video aspect ratio of 16:9 can be computed as 1920/1080, or 1.7777777778. If this value is a number, the user agent will attempt to obtain media whose aspect ratio is as close as possible to this number given the capabilities of the hardware and the o...
MediaTrackConstraints.frameRate - Web APIs
iaTrackSupportedConstraints.frameRate as returned by a call to MediaDevices.getSupportedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var constraintsObject = { frameRate: constraint }; constraintsObject.frameRate = constraint; Value A ConstrainDouble describing the acceptable or required value(s) for a video track's frame rate, in frames per second. If this value is a number, the user agent will attempt to obtain media whose frame rate is as close as possible to this number given the capabilities of the hardware and the other constraints specified. Otherwise, the value of this ConstrainDouble will guide the user agent in its efforts to provide an exact match to the required frame rate (if exact is s...
MediaTrackConstraints.logicalSurface - Web APIs
which is true if logical surfaces should be permitted among the selections available to the user. See How constraints are defined in Capabilities, constraints, and settings for an explanation of how to define constraints. Usage notes You can check the setting selected by the user agent after the display media has been created by getDisplayMedia() by calling getSettings() on the display media's video MediaStreamTrack, then checking the value of the returned MediaTrackSettings object's logicalSurface object. For example, if your app needs to know if the selected display surface is a logical one: let isLogicalSurface = displayStream.getVideoTracks()[0].getSettings().logicalSurface; Following this code, isLogicalSurface is true if the display surface contained in the stream is a logical su...
MediaTrackSettings.cursor - Web APIs
The MediaTrackSettings dictionary's cursor property indicates whether or not the cursor should be captured as part of the video track included in the MediaStream returned by getDisplayMedia(). Syntax cursorSetting = mediaTrackSettings.cursor; Value The value of cursor comes from the CursorCaptureConstraint enumerated string type, and may have one of the following values: always The mouse should always be visible in the video content of the {domxref("MediaStream"), unless the mouse has moved outside the area of the content. motion The mouse cursor should always be included in the video if it's moving, and for a short time after it stops moving. never The mouse cursor is never included in the shared video. Specifications Specification Status Comment Screen ...
MediaTrackSettings.groupId - Web APIs
s two devices on it: a microphone which can serve as a source for audio tracks and a speaker which can serve as an output for audio. The group ID is not usable across multiple browsing sessions. However, it can be used to ensure that audio input and output are both being performed on the same headset, for example, or to ensure that the built-in camera and microphone on a phone are being used for video conferencing purposes. The actual value of the string, however, is determined by the source of the track, and there is no guarantee what form it will take, although the specification does recommend it be a GUID. Since this property isn't stable across browsing sessions, its usefulness when calling getUserMedia() is generally limited to ensuring that tasks performed during the same browsing sess...
MediaTrackSettings.height - Web APIs
ether or not this constraint is supported by checking the value of MediaTrackSupportedConstraints.height as returned by a call to MediaDevices.getSupportedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var height = MediaTrackSettings.height; Value An integer value indicating the height, in pixels, of the video track as currently configured. Example See Example: Constraint exerciser in Capabilities, constraints, and settings for an example. Specifications Specification Status Comment Media Capture and StreamsThe definition of 'height' in that specification. Candidate Recommendation Initial specification. ...
MediaTrackSettings.logicalSurface - Web APIs
area being captured is a logical surface. Logical surfaces are those which are not necessarily entirely onscreen, or may even be off-screen, such as windows' backing buffers (where only part of the buffer is visible without scrolling the containing window) and offscreen rendering contexts. Syntax isLogicalSurface = mediaTrackSettings.logicalSurface; Value A Boolean value which is true if the video track in the stream of captured video is taken from a logical display surface. The most common scenario in which a display surface may be a logical one is if the selected surface contains the entire content area of a window which is too large to display onscreen at once. Since the window that contains the surface has to be scrolled to show the rest of the contents, the surface is a logical one. ...
MediaTrackSettings.width - Web APIs
e whether or not this constraint is supported by checking the value of MediaTrackSupportedConstraints.width as returned by a call to MediaDevices.getSupportedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var width = MediaTrackSettings.width; Value An integer value indicating the width, in pixels, of the video track as currently configured. Example See Example: Constraint exerciser in Capabilities, constraints, and settings for an example. Specifications Specification Status Comment Media Capture and StreamsThe definition of 'width' in that specification. Candidate Recommendation Initial specification. ...
MediaTrackSupportedConstraints - Web APIs
lean value whose value is true if the channelCount constraint is supported in the current environment. deviceId A Boolean value whose value is true if the deviceId constraint is supported in the current environment. groupId A Boolean value whose value is true if the groupId constraint is supported in the current environment. Properties specific to shared screen tracks For tracks containing video sources from the user's screen contents, the following additional properties are may be included in addition to those available for video tracks. cursor A Boolean value which is true if the cursor constraint is supported in the current environment. displaySurface A Boolean value which is true if the cursor constraint is supported in the current environment. logicalSurface A Boolea...
MimeTypeArray - Web APIs
mber of items in the array. Methods MimeTypeArray.item() Returns the MimeType object with the specified index. MimeTypeArray.namedItem() Returns the MimeType object with the specified name. Example The following example tests whether a plugin is available for the application/pdf mime type and if so, which plugin that is. var mimeTypes = navigator.MimeType; var flashPlugin = mimeTypes['video/x-flv']; if (typeof flashPlugin === "undefined") { var vid = document.createElement('video'); // Use vid.canPlayType() to test for a supported mime type. } else { // Notify the user that flash is being deprecated and they // should upgrade their browser. } Specifications Specification Status Comment HTML Living StandardThe definition of 'MimeTypeArray' in that...
msGraphicsTrustStatus - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. msGraphicsTrustStatus is a read-only property which returns an object containing information on protected video playback. This proprietary property is specific to Internet Explorer and Microsoft Edge. Syntax status = object.msGraphicsTrustStatus; Example //Specifies the output device id that the audio will be sent to. msAudioDeviceType: string; readonly msGraphicsTrustStatus: MSGraphicsTrust; ...
msRealTime - Web APIs
s that low-latency playback will be enabled on the media element. Low-latency playback is useful in communication and some gaming scenarios, but is more demanding on power consumption and less reliable for smooth media playback. You must set the msRealTime before setting the src property in code. msRealTime should not be used in non-real-time or non-communication scenarios, such as audio and/or video playback, as this can affects playback startup latency of audio and video playback. ...
msSetMediaProtectionManager - Web APIs
is specific to Internet Explorer and Microsoft Edge. Syntax HTMLMediaElement.msSetMediaProtectionManager(mediaProtectionManager); Parameters The Windows.Media.Protection namespace provides classes to manage Digital Rights Management (DRM) media contents. The MediaProtectionManager class can be passed as an input to a media playback API or the mediaProtectionManager property inside the tag's video or audio. The optional parameter of the msSetMediaProtectionManager property is mediaProtectionManager and can be any type. Return value This method does not return a value. ...
Navigator.requestMediaKeySystemAccess() - Web APIs
The Navigator.requestMediaKeySystemAccess() method returns a Promise which delivers a MediaKeySystemAccess object that can be used to access a particular media key system, which can in turn be used to create keys for decrypting a media stream. This method is part of the Encrypted Media Extensions API, which brings support for encrypted media and DRM-protected video to the web. This method may have user-visible effects such as asking for permission to access one or more system resources. Consider that when deciding when to call requestMediaKeySystemAccess(); you don't want those requests to happen at inconvenient times. As a general rule, this function should be called only when it's about time to create and use a MediaKeys object by calling the returned MediaKeySystemAccess object's createMed...
Navigator.share() - Web APIs
Web › API › Navigator › share
{ resultPara.textContent = 'Error: ' + err } }); Sharing Files To share files, first test for and call navigator.canShare(). Then include an array of files in the call to navigator.share(): Notice: That the sample handles feature detection by testing for navigator.canShare() rather than for navigator.share(). The data object passed to canShare() only supports the files property. Image, video, audio, and text files can be shared. if (navigator.canShare && navigator.canShare({ files: filesArray })) { navigator.share({ files: filesArray, title: 'Pictures', text: 'Our Pictures.', }) .then(() => console.log('Share was successful.')) .catch((error) => console.log('Sharing failed', error)); } else { console.log(`Your system doesn't support sharing files.`); } Specif...
Navigator - Web APIs
Web › API › Navigator
Returns a PointerLock object for the Mouse Lock API. Methods Doesn't inherit any method, but implements those defined in NavigatorID, NavigatorContentUtils, NavigatorUserMedia, and NavigatorStorageUtils. Standard Navigator.canShare() Returns true if a call to Navigator.share() would succeed. Navigator.getUserMedia() After having prompted the user for permission, returns the audio or video stream associated to a camera or microphone on the local computer. Navigator.registerContentHandler() Obsolete since Gecko 59 Allows web sites to register themselves as a possible handler for a given MIME type. Navigator.registerProtocolHandler() Allows web sites to register themselves as a possible handler for a given protocol. Navigator.requestMediaKeySystemAccess() Returns a Promise fo...
ProgressEvent - Web APIs
The ProgressEvent interface represents events measuring progress of an underlying process, like an HTTP request (for an XMLHttpRequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>). <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle"...
RTCConfiguration.bundlePolicy - Web APIs
olicy }; rtcConfiguration.bundlePolicy = policy; Value A DOMString identifying the SDP bundling policy to use for the RTP streams used by the RTCPeerConnection. This string, which must be a member of the RTCBundlePolicy enumeration, has the following possible values: balanced The ICE agent begins by creating one RTCDtlsTransport to handle each type of content added: one for audio, one for video, and one for the RTC data channel, if applicable. If the remote peer isn't BUNDLE-aware, the ICE agent chooses one audio track and one video track and those two tracks are each assigned to the corresponding RTCDtlsTransport. All other tracks are ignored by the connection. This is the default, and most compatible, policy. max-compat The ICE agent intially creates one RTCDtlsTransport for each me...
RTCConfiguration.iceTransportPolicy - Web APIs
well as to simply limit the number of candidates. This is the default. relay The ICE agent only considers media relay candidates when evaluating candidates. This includes, for example, those candidates relayed by a STUN or TURN server. This can be used to prevent the remote endpoint from receiving the user's IP addresses, which may be important in some security situations. For example, in a video calling application, the app may want to prevent unknown callers from learning the callee's IP addresses until the callee has agreed to receive the call. Examples In this example, a new connection is configured to only accept relay candidates. let config = { iceServers: [ { urls: [ "stun:stun.example.com" ] }, ], iceTransportPolicy: "relay" }; let pc = new RTCPeerConnec...
RTCConfiguration - Web APIs
at that point. Note: In technical terms, a BUNDLE lets all media flow between two peers flow across a single 5-tuple; that is, from a single IP and port on one peer to a single IP and port on the other peer, using the same transport protocol. Constant Description "balanced" The ICE agent initially creates one RTCDtlsTransport for each type of content added: audio, video, and data channels. If the remote endpoint is not BUNDLE-aware, then each of these DTLS transports then handles all the communication for one type of data. "max-compat" The ICE agent initially creates one RTCDtlsTransport per media track and a separate one for data channels. If the remote endpoint is not BUNDLE-aware, everything is negotiated on these separate DTLS transports. ...
RTCDtlsTransport - Web APIs
d RTCRtpReceiver, has its own transport, and all RTCDataChannel objects share a transport dedicated to SCTP. When using BUNDLE When the connection is using BUNDLE, each RTCDtlsTransport object represents a group of RTCRtpTransceiver objects. If the connection was created using max-compat mode, each transport is responsible for handling all of the communications for a given type of media (audio, video, or data channel). Thus, a connection that has any number of audio and video channels will always have exactly one DTLS transport for audio and one for video communications. Because transports are established early in the negotiation process, it's likely that it won't be known until after they're created whether or not the remote peer supports bundling or not. For this reason, you'll sometimes s...
RTCIceCandidate - Web APIs
verify generations of ICE generation; each generation of the same ICE process will use the same usernameFragment, even across ICE restarts. Methods toJSON() Given the RTCIceCandidate's current configuration, toJSON() returns a DOMString containing a JSON representation of that configuration in the form of a RTCIceCandidateInit object. Examples For examples, see the article Signaling and video calling, which demonstrates the entire process. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidate' in that specification. Candidate Recommendation Initial definition. ...
RTCInboundRtpStreamStats.firCount - Web APIs
Intra Request (FIR) packets have been sent by the receiver to the sender. The receiver sends a FIR packet when the stream falls behind and needs to skip frames in order to catch up. Syntax var firCount = rtcInboundRtpStreamStats.firCount; Value An integer value indicating how many FIR packets have been received by the sender during the current connection. This statistic is available only for video tracks. The receiver sends a FIR packet to the sender any time it falls bahind or loses packets and cannot decode the incoming stream any longer because of the lost data. This tells the sender to send a full frame instead of a delta frame, so that the receiver can catch up. The higher firCount is, the more often frames were dropped, which may be an indication that the media's bit rate is too hi...
RTCInboundRtpStreamStats.framesDecoded - Web APIs
The framesDecoded property of the RTCInboundRtpStreamStats dictionary indicates the total number of frames which have been decoded successfully for this media source. Syntax var framesDecoded = rtcInboundRtpStreamStats.framesDecoded; Value An integer value indicating the total number of video frames which have been decoded for this stream so far. This represents the number of frames that would have been displayed assuming no frames were skipped. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCInboundRtpStreamStats.framesDecoded' in that specification. Candidate Recommendation Initial definition. ...
RTCInboundRtpStreamStats.pliCount - Web APIs
The pliCount property of the RTCInboundRtpStreamStats dictionary states the number of times the RTCRtpReceiver described by these statistics sent a Picture Loss Indication (PLI) packet to the sender. A PLI packet indicates that some amount of encoded video data has been lost for one or more frames. Syntax var pliCount = RTCInboundRtpStreamStats.pliCount; Value An integer value indicating the number of times a PLI packet was sent by the RTCRtpReceiver to the sender. These are sent by the receiver's decoder to notify the encoder (the sender) that an undefined amount of coded video data, which may span frame boundaries, has been lost. This information is only available for video streams. This may trigger the sender to send a full frame in order to allow the receiver to re-synchronize, since ...
RTCInboundRtpStreamStats.receiverId - Web APIs
The receiverId property of the RTCInboundRtpStreamStats dictionary specifies the id of the RTCAudioReceiverStats or RTCVideoReceiverStats object representing the RTCRtpReceiver receiving the stream. Syntax var receiverStatsId = rtcInboundRtpStreamStats.receiverId; Value A DOMString which contains the ID of the RTCAudioReceiverStats or RTCVideoReceiverStats object which provides information about the RTCRtpReceiver which is receiving the streamed media. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCInboundRtpStreamStats.receiverId' in that specification. Candidate Recommendation Initial definition. ...
RTCInboundRtpStreamStats.sliCount - Web APIs
ecoming corrupted between the sender and the receiver, requiring resends or dropping frames. Syntax var sliCount = rtcInboundRtpStreamStats.sliCount; Value An unsigned integer indicating the number of SLI packets this receiver sent to the remote sender due to lost runs of macroblocks. A high value of sliCount may be an indication of an unreliable network. This is a very technical part of how video codecs work. For details, see RFC 4585: 6.3.2. Note: This value is only present for video media. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCInboundRtpStreamStats.sliCount' in that specification. Candidate Recommendation Initial definition. ...
RTCInboundRtpStreamStats.trackId - Web APIs
The trackId property of the RTCInboundRtpStreamStats dictionary indicates the id of the RTCReceiverAudioTrackAttachmentStats or RTCReceiverVideoTrackAttachmentStats object representing the MediaStreamTrack which is receiving the incoming media. Syntax var trackStatsId = rtcInboundRtpStreamStats.trackId; Value A DOMString containing the ID of the RTCReceiverAudioTrackAttachmentStats or RTCReceiverVideoTrackAttachmentStats object representing the track which is receiving the media from this RTP session. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCInboundRtpStreamStats.trackId' in that specification. Candidate Recommendation Initial definition. ...
RTCOutboundRtpStreamStats.firCount - Web APIs
The firCount property of the RTCOutboundRtpStreamStats dictionary indicates the number of Full Intra Request (FIR) that the remote RTCRtpReceiver has sent to this RTCRtpSender. A FIR packet is sent when the receiver finds that it has fallen behind and needs to skip frames in order to catch up; the sender should respond by sending a full frame instead of a delta frame. Available only on video media. Syntax var firCount = RTCOutboundRtpStreamStats.firCount; Value An integer value indicating how many FIR packets have been received by the sender during the current connection. This statistic is available only for video tracks. The receiver sends a FIR packet to the sender any time it falls bahind or loses packets and cannot decode the incoming stream any longer because of the lost data. This ...
RTCOutboundRtpStreamStats.framesEncoded - Web APIs
The framesEncoded property of the RTCOutboundRtpStreamStats dictionary indicates the total number of frames that have been encoded by this RTCRtpSender for this media source. Syntax var framesEncoded = RTCOutboundRtpStreamStats.framesEncoded; Value An integer value indicating the total number of video frames that this sender has encoded so far for this stream. Note: This property is only valid for video streams. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCOutboundRtpStreamStats.framesEncoded' in that specification. Candidate Recommendation Initial definition. ...
RTCOutboundRtpStreamStats.pliCount - Web APIs
The pliCount property of the RTCOutboundRtpStreamStats dictionary states the number of times the remote peer's RTCRtpReceiver sent a Picture Loss Indication (PLI) packet to the RTCRtpSender for which this object provides statistics. A PLI packet indicates that some amount of encoded video data has been lost for one or more frames. Syntax var pliCount = RTCOutboundRtpStreamStats.pliCount; Value An integer value indicating the number of times a PLI packet was sent to this sender by the remote peer's RTCRtpReceiver. These are sent by the receiver's decoder to notify the sender's encoder that an undefined amount of coded video data, which may span frame boundaries, has been lost. Note: This property is only used for video streams. Usage notes Upon receiving a PLI packet, the sender may ha...
RTCOutboundRtpStreamStats.sliCount - Web APIs
der and the receiver, causing the receiver to request retransmits or to drop frames entirely. Syntax var sliCount = RTCOutboundRtpStreamStats.sliCount; Value An unsigned integer indicating the number of SLI packets the sender received from the receiver due to lost runs of macroblocks. A high value of sliCount may be an indication of an unreliable network. This is a very technical part of how video codecs work. For details, see RFC 4585: 6.3.2. Note: This value is only present for video media. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCOutboundRtpStreamStats.sliCount' in that specification. Candidate Recommendation Initial definition. ...
RTCOutboundRtpStreamStats.trackId - Web APIs
The trackId property of the RTCOutboundRtpStreamStats dictionary indicates the id of the RTCSenderAudioTrackAttachmentStats or RTCSenderVideoTrackAttachmentStats object representing the MediaStreamTrack which is being sent on this stream. Syntax var trackStatsId = RTCOutboundRtpStreamStats.trackId; Value A DOMString containing the ID of the RTCSenderAudioTrackAttachmentStats or RTCSenderVideoTrackAttachmentStats object representing the track which is the source of the media being sent on this stream. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCOutboundRtpStreamStats.trackId' in that specification. Candidate Recommendation Initial definition. ...
RTCPeerConnection.addIceCandidate() - Web APIs
d. The end-of-candidates notification is transmitted to the remote peer using a candidate with an a-line value of end-of-candidates. During negotiation, your app will likely receive many candidates which you'll deliver to the ICE agent in this way, allowing it to build up a list of potential connection methods. This is covered in more detail in the articles WebRTC connectivity and Signaling and video calling. Syntax aPromise = pc.addIceCandidate(candidate); addIceCandidate(candidate, successCallback, failureCallback); Parameters candidate Optional An object conforming to the RTCIceCandidateInit dictionary, or an RTCIceCandidate object; the contents of the object should be constructed from a message received over the signaling channel, describing a newly received ICE candidate tha...
RTCPeerConnection.addTransceiver() - Web APIs
RtpSender. Each entry is of type RTCRtpEncodingParameters. streams Optional A list of MediaStream objects to add to the transceiver'sRTCRtpReceiver; when the remote peer's RTCPeerConnection's track event occurs, these are the streams that will be specified by that event. Exceptions TypeError A string was specified as trackOrKind which is not valid. The string must be either "audio" or "video". Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCPeerConnection.addTransceiver()' in that specification. Candidate Recommendation ...
RTCPeerConnection.onicecandidate - Web APIs
r. When this happens, the connection's iceGatheringState has also changed to complete. You don't need to watch for this explicitly; instead, if you need to sense the end of signaling, you should watch for a icegatheringstatechange event indicating that the ICE negotiation has transitioned to the complete state. Example The example below, which is based on the code from the article Signaling and video calling, sets up a handler for icecandidate events to send the candidates to the remote peer. pc.onicecandidate = function(event) { if (event.candidate) { // Send the candidate to the remote peer } else { // All ICE candidates have been sent } } Notice that the end of negotiation is detected here when the event's candidate property is null. Specifications Specification ...
RTCPeerConnection.onnegotiationneeded - Web APIs
onnection.onnegotiationneeded = eventHandler; Value This should be set to a function you provide which is passed a single parameter: an Event object containing the negotiationneeded event. There's no additional information provided in the event; anything you need, you can get by examining the properties of the RTCPeerConnection. Example This example, derived from the example in Signaling and video calling, establishes a handler for negotiationneeded events to handle creating an offer, configuring the local end of the connection, and sending the offer to the remote peer. pc.onnegotiationneeded = function() { pc.createOffer().then(function(offer) { return pc.setLocalDescription(offer); }) .then(function() { // Send the offer to the remote peer through the signaling server ...
RTCRtpStreamStats.firCount - Web APIs
f Full Intra Request (FIR) packets have been sent by the receiver to the sender. This is a measure of how often the stream falls behind and has to skip frames in order to catch up. Syntax var firCount = RTCRtpStreamStats.firCount; Value An integer value indicating how many FIR packets have been received by the sender during the current connection. This value is available only on receivers for video tracks. The receiver sends a FIR packet to the sender any time it falls bahind or loses packets and cannot decode the incoming stream any longer because of the lost data. This tells the sender to send a full frame instead of a delta frame, so that the receiver can catch up. The higher firCount is, the more often frames were dropped, which may be an indication that the media's bit rate is too hi...
RTCRtpStreamStats.kind - Web APIs
The kind property of the RTCRtpStreamStats dictionary is a string indicating whether the described RTP stream contains audio or video media. Its value is always either "audio" or "video". This property was previously called mediaType. The name was changed in the specification in February, 2018. See Browser compatibility below to determine how this affects the browsers you're targeting. Syntax mediaKind = RTCRtpStreamStats.kind; Value A DOMString whose value is "audio" if the track whose statistics are given by the RTCRtpStreamStats object contains audio, or "video" if the track contains video media. This string will always be the same as the one provided by the associated MediaStreamTrack object's kind property. It will also match the statistics object's RTCCodecStats.codec property's me...
RTCRtpStreamStats.qpSum - Web APIs
The qpSum property of the RTCRtpStreamStats dictionary is a value generated by adding the Quantization Parameter (QP) values for every frame sent or received to date on the video track corresponding to this RTCRtpStreamStats object. In general, the higher this number is, the more heavily compressed the video data is. Syntax var qpSum = RTCRtpStreamStats.qpSum; Value An unsigned 64-bit integer value which indicates the sum of the quantization parameter (QP) value for every frame sent or received so far on the track described by the RTCRtpStreamStats object. Since the value of QP is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. Note: This value is only available for video media. Usage notes Qua...
RTCRtpStreamStats.sliCount - Web APIs
d media. Syntax var sliCount = RTCRtpStreamStats.sliCount; Value An unsigned long integer indicating the number of SLI packets the sender received from the receiver due to lost runs of macroblocks. A high value of sliCount may be an indication of an unreliable network. For technical details, see RFC 4585: 6.3.2. Note: This value is sent by the sender to the receiver and is only present for video media. Specifications Specification Status Comment Identifiers for WebRTC's Statistics APIThe definition of 'RTCInboundRtpStreamStats: sliCount' in that specification. Candidate Recommendation Initial definition. Identifiers for WebRTC's Statistics APIThe definition of 'RTCOutboundRtpStreamStats: sliCount' in that specification. Candidate Recommendatio...
RTCRtpTransceiver.setCodecPreferences() - Web APIs
erences. To determine which codecs are supported by the transceiver, call the sender's getCapabilities() and the receiver's getCapabilities() methods and get the codecs list from the results of each. The following code snippet demonstrates how to get both the list of codecs supported by the transceiver's RTCRtpSender and RTCRtpReceiver. var availSendCodecs = transceiver.sender.getCapabilities("video").codecs; var availReceiveCodecs = transceiver.receiver.getCapabilities("video").codecs; Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCRtpTransceiver.setCodecPreferences()' in that specification. Candidate Recommendation ...
RTCSessionDescription() - Web APIs
This example uses the constructor to convert an SDP offer into an RTCSessionDescription object. This is no longer necessary, however; RTCPeerConnection.setLocalDescription() and other methods which take SDP as input now directly accept an object conforming to the RTCSessionDescriptionInit dictionary, so you don't have to instantiate an RTCSessionDescription yourself. navigator.getUserMedia({video: true}, function(stream) { pc.onaddstream({stream: stream}); // Adding a local stream won't trigger the onaddstream callback pc.addStream(stream); pc.createOffer(function(offer) { pc.setLocalDescription(new RTCSessionDescription(offer), function() { // send the offer to a server to be forwarded to the friend you're calling. }, error); }, error); } Specifications ...
RTCTrackEventInit.receiver - Web APIs
The RTCTrackEventInit dictionary's receiver property specifies the RTCRtpReceiver associated with the event. Syntax var trackEventInit = { receiver: rtpReceiver, track: mediaStreamTrack, streams: [videoStream], transceiver: rtpTransceiver }; var rtpReceiver = trackEventInit.receiver; Value The RTCRtpTransceiver which pairs the receiver with a sender and other properties which establish a single bidirectional SRTP stream for use by the track associated with the RTCTrackEvent. Note: The transceiver includes its own receiver property, which will always be the same RTCRtpReceiver as this one. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCTrackEventInit.receiver' in that specificati...
RTCTrackEventInit.streams - Web APIs
The RTCTrackEventInit dictionary's optional streams property provides an array containing a MediaStream object for each of the streams associated with the event's track. Syntax var trackEventInit = { receiver: rtpReceiver, track: mediaStreamTrack, streams: [videoStream], transceiver: rtpTransceiver }; var streamList = trackEventInit.streams; Value An array of MediaStream objects, one for each stream which make up the track. If streams is not specified, its default value is an empty array. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCTrackEventInit.streams' in that specification. Candidate Recommendation Initial specification. ...
RTCTrackEventInit.track - Web APIs
This is the track that's being added to the RTCPeerConnection. ...
RTCTrackEventInit.transceiver - Web APIs
The RTCTrackEventInit dictionary's transceiver property specifies the RTCRtpTransceiver associated with the track event. The transceiver pairs the track's receiver with an RTCRtpSender to allow bidirectional communication. Syntax var trackEventInit = { receiver: rtpReceiver, track: mediaStreamTrack, streams: [videoStream], transceiver: rtpTransceiver }; var rtpTransceiver = trackEventInit.transceiver; Value The RTCRtpTransceiver which pairs the receiver with a sender and other properties which establish a single bidirectional SRTP stream for use by the track associated with the RTCTrackEvent. Note: The RTCRtpReceiver referred to by this RTCRtpReceiver's receiver property will always be the same as the RTCTrackEvent's receiver property. Specifications Specification ...
ReadableStream.pipeThrough() - Web APIs
ers transformStream A TransformStream (or an object with the structure {writable, readable}) consisting of a readable stream and a writable stream working together to transform some data from one form to another. Data writen to the writable stream can be read in some transformed state by the readable stream. For example, a TextDecoder, has bytes written to it and strings read from it, while a video decoder has encoded bytes written to it and uncompressed video frames read from it. options Optional The options that should be used when piping to the writable stream. Available options are: preventClose: If this is set to true, the source ReadableStream closing will no longer cause the destination WritableStream to be closed. The method will return a fulfilled promise once this process co...
Request.context - Web APIs
Web › API › Request › context
xt read-only property of the Request interface contains the context of the Request (e.g., audio, image, iframe). This defines what sort of resource is being fetched. This has been replaced by the destination property. The context of a request is only relevant in the ServiceWorker API; a service worker can make decisions based on whether the URL is for an image, or an embeddable object such as a <video>, iframe, etc. Note: You can find a full list of the different available contexts including associated context frame types, CSP directives, and platform feature examples in the Fetch spec request context section. Syntax var myContext = request.context; Value A RequestContext value. Example In the following snippet, we create a new request using the Request.Request() constructor (for an i...
Request.mode - Web APIs
Web › API › Request › mode
Example In the following snippet, we create a new request using the Request.Request() constructor (for an image file in the same directory as the script), then save the request mode in a variable: var myRequest = new Request('flowers.jpg'); var myMode = myRequest.mode; // returns "cors" by default Specifications Specification Status C...
RequestDestination - Web APIs
"image" The target is an image. "manifest" The target is a manifest. "object" The target is an object. "paintworklet" The target is a paint worklet. "report" The target is a report. "script" The target is a script. "serviceworker" The target is a service worker. "sharedworker" The target is a shared worker. "style" The target is a style "track" The target is an HTML <track>. "video" The target is video data. "worker" The target is a worker. "xslt" The target is an XLST transform. Specifications Specification Status Comment FetchThe definition of 'RequestDestination' in that specification. Living Standard Initial definition ...
ShadowRoot.mode - Web APIs
Web › API › ShadowRoot › mode
The mode property of the ShadowRoot specifies its mode -- either open or closed. This defines whether or not the shadow root's internal features are accessible from JavaScript. When the mode of a shadow root is "closed", the shadow root's implementation internals are inaccessible and unchangeable from JavaScript--in the same way the implementation internals of, for example, the <video> element are inaccessible and unchangeable from JavaScript. Syntax var mode = shadowRoot.mode Value A value defined in the ShadowRootMode enum -- either open or closed. Examples let customElem = document.querySelector('my-shadow-dom-element'); let shadow = customElem.shadowRoot; // Another way to check whether the shadow root is open; it will return null if not if(shadow) { // If it is open, close it to...
SourceBuffer.abort() - Web APIs
uring on a sourcebuffer, and then immediately start performing operations on it again. For example, consider this code: sourceBuffer.addEventListener('updateend', function (_) { ... }); sourceBuffer.appendBuffer(buf); Let's say that after the call to appendBuffer BUT before the updateend event fires (i.e. a buffer is being appended but the operation has not yet completed) a user "scrubs" the video seeking to a new point in time. In this case you would want to manually call abort() on the source buffer to stop the decoding of the current buffer, then fetch and append the newly requested segment that relates to the current new position of the video. You can see something similar in action in Nick Desaulnier's bufferWhenNeeded demo -- in line 48, an event listener is added to the playing vi...
Streams API concepts - Web APIs
ce represented in JavaScript by a ReadableStream object that flows from an underlying source -- this is a resource somewhere on the network or elsewhere on your domain that you want to get data from. There are two types of underlying source: Push sources constantly push data at you when you've accessed them, and it is up to you to start, pause, or cancel access to the stream. Examples include video streams and TCP/Web sockets. Pull sources require you to explicitly request data from them once connected to. Examples include a file access operation via a Fetch or XHR call. The data is read sequentially in small pieces called chunks. A chunk can be a single byte, or it can be something larger such as a typed array of a certain size. A single stream can contain chunks of different sizes and ...
TextTrack: cuechange event - Web APIs
() { let cues = track.activeCues; // array of current cues } On the track element The underlying TextTrack, indicated by the track property, receives a cuechange event every time the currently-presented cue is changed. This happens even if the track isn't associated with a media element. If the track is associated with a media element, using the <track> element as a child of the <audio> or <video> element, the cuechange event is also sent to the HTMLTrackElement. let textTrackElem = document.getElementById("texttrack"); textTrackElem.addEventListener("cuechange", (event) => { let cues = event.target.track.activeCues; }); In addition, you can use the oncuechange event handler: let textTrackElem = document.getElementById("texttrack"); textTrackElem.oncuechange = (event) => { let c...
TextTrackCue - Web APIs
yed) and the end time (the time at which it will be removed from the display), as well as other information. Properties This interface also inherits properties from EventTarget. TextTrackCue.track Read only The TextTrack that this cue belongs to, or null if it doesn't belong to any. TextTrackCue.id A DOMString that identifies the cue. TextTrackCue.startTime A double that represents the video time that the cue will start being displayed, in seconds. TextTrackCue.endTime A double that represents the video time that the cue will stop being displayed, in seconds. TextTrackCue.pauseOnExit A boolean for whether the video will pause when this cue stops being displayed. Event handlers TextTrackCue.onenter The event handler for the enter event. TextTrackCue.onexit The event handle...
TextTrackList: addtrack event - Web APIs
The addtrack event is fired when a track is added to a TextTrackList. Bubbles No Cancelable No Interface TrackEvent Event handler property onaddtrack Examples Using addEventListener(): const mediaElement = document.querySelector('video, audio'); mediaElement.textTracks.addEventListener('addtrack', (event) => { console.log(`Text track: ${event.track.label} added`); }); Using the onaddtrack event handler property: const mediaElement = document.querySelector('video, audio'); mediaElement.textTracks.onaddtrack = (event) => { console.log(`Text track: ${event.track.label} added`); }; Specifications Specification Status HTML Living StandardThe definition of 'addtrack' in that specification. Living Standard ...
TextTrackList: change event - Web APIs
The change event is fired when a text track is made active or inactive, or a textTrackList is otherwise changed. Bubbles No Cancelable No Interface Event Event handler property onchange Examples Using addEventListener(): const mediaElement = document.querySelectorAll('video, audio')[0]; mediaElement.textTracks.addEventListener('change', (event) => { console.log(`'${event.type}' event fired`); }); Using the onchange event handler property: const mediaElement = document.querySelector('video, audio'); mediaElement.textTracks.onchange = (event) => { console.log(`'${event.type}' event fired`); }; Specifications Specification Status HTML Living StandardThe definition of 'change' in that specification. Liv...
TextTrackList.length - Web APIs
he media. Syntax var trackCount = TextTrackList.length; Value A number indicating how many text tracks are included in the TextTrackList. Each track can be accessed by treating the TextTrackList as an array of objects of type TextTrack. Example This snippet gets the number of text tracks in the first media element found in the DOM by querySelector(). var mediaElem = document.querySelector("video, audio"); var numTextTracks = 0; if (mediaElem.textTracks) { numTextTracks = mediaElem.textTracks.length; } Note that this sample checks to be sure HTMLMediaElement.textTracks is defined, to avoid failing on browsers without support for TextTrack. Specifications Specification Status Comment HTML Living StandardThe definition of 'TextTrackList: length' in that sp...
TextTrackList.onremovetrack - Web APIs
ackList.onremovetrack = eventHandler; Value Set onremovetrack to a function that accepts as input a TrackEvent object which indicates in its track property which text track has been removed from the media element. Example This simple example just fetches the current number of text tracks in the first media element whenever a track is removed from the media element. document.querySelectorAll("video, audio")[0].textTracks.onremovetrack = function(event) { myTrackCount = document.querySelectorAll("video, audio")[0].textTracks.length; }; The current number of text tracks remaining in the media element is obtained from TextTrackList property length. Specifications Specification Status Comment HTML Living StandardThe definition of 'TextTrackList: onremovetrack' ...
TextTrackList - Web APIs
e via the onremovetrack property. Usage notes In addition to being able to obtain direct access to the text tracks present on a media element, TextTrackList lets you set event handlers on the addtrack and removetrack events, so that you can detect when tracks are added to or removed from the media element's stream. See onaddtrack and onremovetrack for details and examples. Examples Getting a video element's text track list To get a media element's TextTrackList, use its textTracks property. var textTracks = document.querySelector("video").textTracks; Monitoring track count changes In this example, we have an app that displays information about the number of channels available. To keep it up to date, handlers for the addtrack and removetrack events are set up. textTracks.onaddtrack = u...
TimeRanges.end() - Web APIs
Web › API › TimeRanges › end
Returns the time offset at which a specified time range ends. Syntax endTime = TimeRanges.end(index) Parameters index is the range number to return the ending time for. Exceptions INDEX_SIZE_ERR A DOMException thrown if the specified index doesn't correspond to an existing range. Example Given a video element with the ID "myVideo": var v = document.getElementById("myVideo"); var buf = v.buffered; var numRanges = buf.length; if (buf.length == 1) { // only one range if (buf.start(0) == 0 && buf.end(0) == v.duration) { // The one range starts at the beginning and ends at // the end of the video, so the whole thing is loaded } } This example looks at the time ranges and looks to see if the entire video has been loaded. Specifications Specification ...
TimeRanges.length - Web APIs
Web › API › TimeRanges › length
The TimeRanges.length read-only property returns the number of ranges in the object. Syntax length = TimeRanges.length; Example Given a video element with the ID "myVideo": var v = document.GetElementById("myVideo"); var buf = v.buffered; var numRanges = buf.length; if (buf.length == 1) { // Only one range if (buf.start(0) == 0 && buf.end(0) == v.duration) { // The one range starts at the beginning and ends at // the end of the video, so the whole thing is loaded } } This example looks at the time ranges and looks to see if the entire video has been loaded. Specifications Specification Status Comment HTML Living StandardThe definition of 'TimeRanges.length()' in that specification. Living Standard Initial definition ...
TimeRanges.start() - Web APIs
Web › API › TimeRanges › start
Returns the time offset at which a specified time range begins. Syntax startTime = TimeRanges.start(index) Parameters index is the range number to return the starting time for. Exceptions INDEX_SIZE_ERR A DOMException thrown if the specified index doesn't correspond to an existing range. Example Given a video element with the ID "myVideo": var v = document.getElementById("myVideo"); var buf = v.buffered; var numRanges = buf.length; if (buf.length == 1) { // only one range if (buf.start(0) == 0 && buf.end(0) == v.duration) { // The one range starts at the beginning and ends at // the end of the video, so the whole thing is loaded } } This example looks at the time ranges and looks to see if the entire video has been loaded. Specifications Specifica...
TimeRanges - Web APIs
A TimeRanges object includes one or more ranges of time, each specified by a starting and ending time offset. You reference each time range by using the start() and end() methods, passing the index number of the time range you want to retrieve. ...
TrackDefault.TrackDefault() - Web APIs
The TrackDefault() constructor of the TrackDefault interface constructs and returns a new TrackDefault object. Syntax var trackDefault = new TrackDefault(type, language, label, kinds, byteStreamTrackID); Parameters type A DOMString specifying a media segment data type for the SourceBuffer to contain. Can be audio, video, or text. language A DOMString specifying a default language for the SourceBuffer to use when an initialization segment does not contain language information for a new track. label A DOMString specifying a default label for the SourceBuffer to use when an initialization segment does not contain label information for a new track. kinds An array (sequence) of DOMStrings specifying default kinds for the SourceBuffer to use when an initialization segment doe...
TrackDefault - Web APIs
this information in the initialization segments of a media chunk. A TrackDefault object is provided to a SourceBuffer object by setting its SourceBuffer.trackDefaults property. Constructor TrackDefault() Constructs and returns a new TrackDefault object. Properties TrackDefault.type Read only Returns the type of track that this SourceBuffer's media segment data relates to (i.e. audio, video, or text track.) TrackDefault.byteStreamTrackID Read only Returns the ID of the specific track that the SourceBuffer should apply to. TrackDefault.language Read only Returns the default language to use when an initialization segment does not contain language information for a new track. TrackDefault.label Read only Returns the default label to use when an initialization segment does not ...
TrackEvent() - Web APIs
The TrackEvent() constructor creates and returns a new TrackEvent object describing an event which occurred on a list of tracks (AudioTrackList, VideoTrackList, or TextTrackList). Syntax trackEvent = new TrackEvent(type, eventInfo); Parameters type The type of track event which is described by the object: "addtrack" or "removetrack". eventInfo Optional An optional dictionary providing additional information configuring the new event; it can contain the following fields in any combination: track Optional The track to which the event refers; this is null by default, but should be set to a VideoTrack, AudioTrack, or TextTrack as appropriate given the type of track. bubbles Optional A Boolean indicating whether the event bubbles or not. cancelable Optional A Boolean indicati...
URL.createObjectURL() - Web APIs
e released by calling URL.revokeObjectURL() when you no longer need them. Browsers will release object URLs automatically when the document is unloaded; however, for optimal performance and memory usage, if there are safe times when you can explicitly unload them, you should do so. Using object URLs for media streams In older versions of the Media Source specification, attaching a stream to a <video> element required creating an object URL for the MediaStream. This is no longer necessary, and browsers are removing support for doing this. Important: If you still have code that relies on createObjectURL() to attach streams to media elements, you need to update your code to simply set srcObject to the MediaStream directly. Specifications Specification Status Comment ...
VTTCue() - Web APIs
Web › API › VTTCue › VTTCue
e shown during the time span indicated by startTime and endTime. Return value A new VTTCue object representing a cue which will be presented during the time span given. Example // Create a cue that is shown from 2 to 3 seconds and uses the given text. var cue = new VTTCue(2, 3, 'Cool text to be displayed'); Specifications Specification Status Comment WebVTT: The Web Video Text Tracks FormatThe definition of 'VTTCue()' in that specification. Candidate Recommendation ...
WebGL by example - Web APIs
h solid colors, scissoring, animation, and user interaction. Shader programming basics Hello GLSL A very basic shader program that draws a solid color square. Hello vertex attributes Combining shader programming and user interaction through vertex attributes. Textures from code A simple demonstration of procedural texturing with fragment shaders. Miscellaneous advanced examples Video textures This example demonstrates how to use video files as textures. Next >> ...
Using textures in WebGL - Web APIs
ses can't be used as WebGL textures. A 2D <canvas> becomes tainted, for example, when a cross-domain image is drawn on it. Note: CORS support for Canvas 2D drawImage is implemented in Gecko 9.0. This means that using a cross-domain image with CORS approval does no longer taint the 2D canvas, so the 2D canvas remains usable as the source of a WebGL texture. Note: CORS support for cross-domain videos and the crossorigin attribute for <video> elements is implemented in Gecko 12.0. << PreviousNext >> ...
WebGL tutorial - Web APIs
ate objects to create simple animations. Creating 3D objects using WebGL Shows how to create and animate a 3D object (in this case, a cube). Using textures in WebGL Demonstrates how to map textures onto the faces of an object. Lighting in WebGL How to simulate lighting effects in your WebGL context. Animating textures in WebGL Shows how to animate textures; in this case, by mapping an Ogg video onto the faces of a rotating cube. ...
WebRTC coding guide - Web APIs
Once you have an overall understanding of what WebRTC does and how it works, your mind likely turns to implementation. How do you create a Web application that uses two-way video or data streams without having to do all the hard work of compressing frames, building streams, and so forth by yourself? This coding guide will explain in depth how WebRTC works, and will dive into actual code that uses WebRTC to do useful things. There are no subpages at this time. If you need to learn more about the fundamentals of how WebRTC and its protocols work, check out our High-level guides for WebRTC. ...
High-level guides - Web APIs
The high-level guides listed below introduce WebRTC technology from a top-down perspective, describing the overall architecture, the life cycle of a WebRTC connection, and basic security and technological issues you might run into as you explore and build Web content or apps using the WebRTC API. ...
A simple RTCDataChannel sample - Web APIs
teDescriptionError); Let's go through this line by line and decipher what it means. First, we call RTCPeerConnection.createOffer() method to create an SDP (Session Description Protocol) blob describing the connection we want to make. This method accepts, optionally, an object with constraints to be met for the connection to meet your needs, such as whether the connection should support audio, video, or both. In our simple example, we don't have any constraints. If the offer is created successfully, we pass the blob along to the local connection's RTCPeerConnection.setLocalDescription() method. This configures the local end of the connection. The next step is to connect the local peer to the remote by telling the remote peer about it. This is done by calling remoteConnection.RTCPeerConnect...
Fundamentals of WebXR - Web APIs
g events, while other controls are available through a special WebXR-specific implementation of the Gamepad object. Basic concepts Before getting into too much detail, let's consider some basic concepts that you need to know before you learn how to develop XR code. Field of view The term field of view (FOV) is one which applies to any visual technology, from old film cameras to modern digital video cameras, including the cameras in computers and mobile devices. What is field of view? The field of view is, at its essence, the extent of the environment you are able to see at any one time. The width of the field of view is measured as the angle defining the arc from the far left edge of your field of view to the far right edge, and is specified in either degrees or radians. A human eye is t...
Geometry and reference spaces in WebXR - Web APIs
most space--the one obtained by calling the XRSession method requestReferenceSpace()--describes the coordinate system used for the overall world space. Everything is fundamentally tied to this coordinate system, which represents the relationship between the user's equipment's position and the virtual world. While you can use WebXR for everything from augmenting the world with annotations to 360? video playback to scientific simulations to virtual reality training systems or anything else you can imagine, let's take a 3D video game as an example of a typical WebXR application. Consider the model of a player's avatar standing in the game world's space. You position that avatar relative to the world space, using the coordinate system defined by the world's reference space. To move the player to ...
Lighting a WebXR setting - Web APIs
m but wants to determine if the other person is also in the same room. Another scenario in which lighting estimation can be used to obtain information about the user without permission: if the light sensor is close enough to the user's display to detect lighting changes caused by the contents of the display, an algorithm could be used to determine whether or not the user is watching a particular video--or even to potentially identify which of a number of videos the user is watching. The Lighting Estimation API specification mandates that all user agents perform temporal and spatial filtering to fuzz the data in a manner that reduces its usefulness for the purpose of locating the user or performing side-channel attacks. ...
Basic concepts behind Web Audio API - Web APIs
nt a specific audio layout. Any discrete channel structure is supported, including mono, stereo, quad, 5.1, and so on. Audio sources can be obtained in a number of ways: Sound can be generated directly in JavaScript by an audio node (such as an oscillator). Created from raw PCM data (the audio context has methods to decode supported audio formats). Taken from HTML media elements (such as <video> or <audio>). Taken directly from a WebRTC MediaStream (such as a webcam or microphone). Audio data: what's in a sample When an audio signal is processed, sampling means the conversion of a continuous signal to a discrete signal; or put another way, a continuous sound wave, such as a band playing live, is converted to a sequence of samples (a discrete-time signal) that allow a computer to han...
Web Audio API best practices - Web APIs
tyle. In this article, we'll share a number of best practices -- guidelines, tips, and tricks for working with the Web Audio API. Loading sounds/files There are four main ways to load sound with the Web Audio API and it can be a little confusing as to which one you should use. When working with files, you are looking at either the grabbing the file from an HTMLMediaElement (i.e. an <audio> or <video> element), or you're looking to fetch the file and decode it into a buffer. Both are legitimate ways of working, however, it's more common to use the former when you are working with full-length tracks, and the latter when working with shorter, more sample-like tracks. Media elements have streaming support out of the box. The audio will start playing when the browser determines it can load the r...
self.createImageBitmap() - Web APIs
he method exists on the global scope in both windows and workers. It accepts a variety of different image sources, and returns a Promise which resolves to an ImageBitmap. Syntax const imageBitmapPromise = createImageBitmap(image[, options]); const imageBitmapPromise = createImageBitmap(image, sx, sy, sw, sh[, options]); Parameters image An image source, which can be an <img>, SVG <image>, <video>, <canvas>, HTMLImageElement, SVGImageElement, HTMLVideoElement, HTMLCanvasElement, Blob, ImageData, ImageBitmap, or OffscreenCanvas object. sx The x coordinate of the reference point of the rectangle from which the ImageBitmap will be extracted. sy The y coordinate of the reference point of the rectangle from which the ImageBitmap will be extracted. sw The width of the rectangle from which...
XRSession: select event - Web APIs
The WebXR event select is sent to an XRSession when one of the session's input sources has completed a primary action. Examples of comon kinds of primary action are users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer. Bubbles Yes Cancelable No Interface XRInputSourceEvent Event handler property onselect For details on how the selectstart, select, and selectend events work, and how you should react to them, see Primary actions in Inputs and input sources. Examples The following example uses addEventListener() to set up a handler for the select event. The handler fetches the pose representing the t...
XRSession: selectend event - Web APIs
event selectend is sent to an XRSession when one of its input sources ends its primary action or when an input source that's in the process of handling an ongoing primary action is disconnected without successfully completing the action. Primary actions include things like users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer. Bubbles Yes Cancelable No Interface XRInputSourceEvent Event handler property onselectend For details on how the selectstart, select, and selectend events work, and how you should react to them, see Primary actions in Inputs and input sources. Examples The following example uses...
XRSession: selectstart event - Web APIs
The WebXR event selectstart is sent to an XRSession when the user begins a primary action on one of its input sources. Primary actions include things like users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer. Bubbles Yes Cancelable No Interface XRInputSourceEvent Event handler property onselectstart For details on how the selectstart, select, and selectend events work, and how you should react to them, see Primary actions in Inputs and input sources. Examples The following example uses addEventListener() to establish handlers for the selection events: selectstart, selectend, and select. This snipp...
XRSession: squeeze event - Web APIs
The WebXR event squeeze is sent to an XRSession when one of the session's input sources has completed a primary squeeze action. Examples of comon kinds of primary action are users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer. Bubbles Yes Cancelable No Interface XRInputSourceEvent Event handler property onsqueeze For details on how the squeezestart, squeeze, and squeezeend events work, and how you should react to them, see Primary squeeze actions in Inputs and input sources. Examples The following example uses addEventListener() to set up a handler for the squeeze event. The handler fetches the p...
XRSession: squeezeend event - Web APIs
eezeend is sent to an XRSession when one of its input sources ends its primary action or when an input source that's in the process of handling an ongoing primary action is disconnected without successfully completing the action. Primary squeeze actions include things like users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer. Bubbles Yes Cancelable No Interface XRInputSourceEvent Event handler property onsqueezeend For details on how the squeezestart, squeeze, and squeezeend events work, and how you should react to them, see Primary squeeze actions in Inputs and input sources. Examples The following ...
ARIA: figure role - Accessibility
- an image and a caption. This is wrapped by a <div> element that identifies the content as a figure using role="figure". Instead of using ARIA to create a figure, consider using the native, semantic HTML <figure> element. along with the <figcaption> element. See Best practices below. Description Any content that should be grouped together and consumed as a figure (which could include images, video, audio, code snippets, or other content) can be identified as a figure using role="figure". There are no hard and fast rules about how you should write your figure content. You should make sure that it is accessible just like any other content. For example, make sure it is perceivable by users of assistive technology, navigable by keyboard as well as mouse, and so on. You can add a caption or l...
ARIA: img role - Accessibility
d as a single image. These elements could be images, code snippets, text, emojis, or other content that can be combined to deliver information in a visual manner. <div role="img" aria-label="Description of the overall image"> <img src="graphic1.png" alt=""> <img src="graphic2.png"> </div> Description Any set of content that should be consumed as a single image (which could include images, video, audio, code snippets, emojis, or other content) can be identified using role="img". You shouldn't count on the alt text of individual elements images for conveying context to assistive technologies; most screenreaders will consider the element with role="img" set on it to be to be like a black box, and not access the individual elements inside it. Therefore, provide a comprehensive overall des...
Accessibility: What users can do to browse more safely - Accessibility
n example, it explains that by changing the value the image.animation_mode from "normal" to "none", all animated images will be blocked. To reverse it, you will have to change the value back to "normal" Use browser extensions Gif Blocker For Chrome, GIF Blocker is an extension available at the web store. Gif Scrubber Gif Scrubber is a chrome extension that allows you to control gifs like a video player. There is a Github repository for it at https://github.com/0ui/gif-scrubber Beeline Reader Beeline Reader has a browser extension that allows you to set up for grayscale and Dyslexi font, among other things Take advantage Operating System accessibility features Most operating systems such as Windows 10, have accessibility options that are surprisingly powerful. Usually they are quit...
Operable - Accessibility
ld be invalidated if it were turned off. 2.2.2 Pausing, stopping, hiding (A) For moving/blinking content that starts automatically, lasts longer than 5 seconds, and is shown alongside other content, controls should be provided to pause, stop, or hide it. This does not apply to moving/blinking content that is essential to the experience. Examples include scrolling text and videos. For auto-updating information that starts automatically and is shown alongside other content, controls should be provided to pause, stop, or hide it, or to control the frequency of updates. This does not apply to auto-updating content that is essential to the experience. Examples include carousels or rotating annoucements. 2.2.3 No time limits (AAA) This builds on crite...
Color contrast - Accessibility
ck; } .bad { background-color: #400064; } Solution When choosing a color scheme for your website, choose foreground and background colors that have good contrast. Make the color contrast as good as it can be within your design constraints -- ideally go for the AAA rating (see 1.4.6 below), but at least meet the AA rating (see 1.4.3 below). If you are including non-text content such as video or animation, you should follow 1.4.11 (again, see below). To check your contrast as you make your color choices, use a tool such as WebAIM's Color Contrast Checker. You can also check color contrast on the fly using Firefox's Developer Tools -- see our Accessibility inspector guide, and in particular the section Check for accessibility issues. Try using it on the live examples in the descripti...
Understandable - Accessibility
rs access to pronounciation of words where they are is needed to understand the content fully. The HTML5 <audio> element can be used to create a control that allows the reader to play back an audio file containing the correct pronounciation, and it also makes sense to include a textual pronounciation guide after difficult words, in the same way that you find in dictionary entries. See Video and audio content, and Pronunciation Guide for English Dictionary Note: Also see the WCAG description for Guideline 3.1 Readable: Make text content readable and understandable. Guideline 3.2 -- Predictable: Make Web pages appear and operate in predictable ways This guideline focuses on making user interfaces intuitive and understandable. Success criteria How to conform to ...
Accessibility
ated content can be difficult. WAI-ARIA is a technology that can help with such problems by adding in further semantics that browsers and assistive technologies can recognize and use to let users know what is going on. Here we'll show how to use it at a basic level to improve accessibility. Accessible multimedia Another category of content that can create accessibility problems is multimedia -- video, audio, and image content need to be given proper textual alternatives so they can be understood by assistive technologies and their users. This article shows how. Mobile accessibility With web access on mobile devices being so popular, and popular platforms such as iOS and Android having fully-fledged accessibility tools, it is important to consider the accessibility of your web content on the...
::backdrop - CSS: Cascading Style Sheets
s to the screen. The ::backdrop pseudo-element makes it possible to obscure, style, or completely hide everything located below the element when it's the topmost one in the top layer. ::backdrop neither inherits from nor is inherited by any other elements. No restrictions are made on what properties apply to this pseudo-element. Syntax ::backdrop Examples Styling the backdrop for full-screen video In this example, the backdrop style used when a video is shifted to full-screen mode is configured to be a grey-blue color rather than the black it defaults to in most browsers. video::backdrop { background-color: #448; } The resulting screen looks like this: Note the dark grey-blue letterbox effect above and below where the backdrop is visible. Normally that area is black, but its appea...
::cue-region - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition. ...
::cue - CSS: Cascading Style Sheets
Web › CSS › ::cue
Candidate Recommendation Initial definition. ...
Introduction to the CSS basic box model - CSS: Cascading Style Sheets
dard CSS basic box model. CSS determines the size, position, and properties (color, background, border size, etc.) of these boxes. Every box is composed of four parts (or areas), defined by their respective edges: the content edge, padding edge, border edge, and margin edge. The content area, bounded by the content edge, contains the "real" content of the element, such as text, an image, or a video player. Its dimensions are the content width (or content-box width) and the content height (or content-box height). It often has a background color or background image. If the box-sizing property is set to content-box (default) and if the element is a block element, the content area's size can be explicitly defined with the width, min-width, max-width, height, min-height, and max-height properti...
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
which also gives methods of reordering content with flex-direction and the order property. The concept of visual display following document source order is detailed in the WCAG Techniques for Success Criteria - Technique C27. As a way to start thinking about these issues, as you use CSS Grid Layout I would suggest reading Flexbox & the Keyboard Navigation Disconnect from Leonie Watson. Also the video of Leonie's presentation from ffconf is helpful to understand more about how screen readers work with the visual representation of things in CSS. Adrian Roselli has also posted regarding tab order in various browsers - although this was prior to grid support being fully implemented in Firefox. ...
Subgrid - CSS: Cascading Style Sheets
A presentation from CSSConf.eu ...
CSS Grid Layout - CSS: Cascading Style Sheets
CSS Grid Layout Candidate Recommendation Initial definition. ...
Replaced elements - CSS: Cascading Style Sheets
stylesheets of their own, but they don't inherit the styles of the parent document. The only other impact CSS can have on a replaced element is that there are properties which support controlling the positioning of the element's content within its box. See Controlling object position within the content box for further information. Replaced elements Typical replaced elements are: <iframe> <video> <embed> <img> Some elements are treated as replaced elements only in specific cases: <option> <audio> <canvas> <object> <applet> HTML spec also says that an <input> element can be replaced, because <input> elements of the "image" type are replaced elements similar to <img>. However, other form controls, including other types of <input> elements, are explicitly listed as non-replaced...
aspect-ratio - CSS: Cascading Style Sheets
Mapping width and height to aspect-ratio Firefox has added an internal aspect-ratio property (in version 69 onwards) that applies to replaced elements and other related elements that accept width and height attributes. This appears in the browser's internal UA stylesheet. Chrome is also shipping this feature. In Firefox, the internal stylesheet rule looks like this: img, input[type="image"], video, embed, iframe, marquee, object, table { aspect-ratio: attr(width) / attr(height); } Specifications Specification Status Comment CSS Box Sizing Module Level 4The definition of 'aspect-ratio' in that specification. Editor's Draft Initial definition Browser compatibility The compatibility table on this page is generated from structured data. If you'd li...
object-fit - CSS: Cascading Style Sheets
You can alter the alignment of the replaced element's content object within the element's box using the object-position property. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax The object-fit property is specified as a single keyword chosen from the list of values below. ...
resize - CSS: Cascading Style Sheets
Web › CSS › resize
to resize it in the inline direction (either horizontally or vertically, depending on the writing-mode and direction value). resize does not apply to the following: Inline elements Block elements for which the overflow property is set to visible Formal definition Initial valuenoneApplies toelements with overflow other than visible, and optionally replaced elements representing images or videos, and iframesInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax none | both | horizontal | vertical | block | inline Examples Disabling resizability of textareas In many browsers, <textarea> elements are resizable by default. You may override this behavior with the resize property. HTML <textarea>Type some text here.</textarea> CSS textarea { resize: none; /* Dis...
Overview of events and handlers - Developer guides
although this list is currently incomplete. Some notable events are: Note: This list of events will need work to make relevant; that work is awaiting some global reorganization work on the documents. This will also need finding a good explanation of the events involved during page loading, such as discussed partially in this web page or in this St...
Event developer guide - Developer guides
Web › Guide › Events
nts are commonly called synthetic events, as opposed to the events fired by the browser itself.DOM on-event handlersThe Web platform provides several ways to get notified of DOM events. Two common styles are: the generalized addEventListener() and a set of specific on-event handlers.Media eventsVarious events are sent when handling media that are embedded in HTML documents using the <audio> and <video> elements; this section lists them and provides some helpful information about using them.Mouse gesture eventsGecko 1.9.1 added support for several Mozilla-specific DOM events used to handle mouse gestures. These are special movements that can be made with a mouse or trackpad and can be interpreted to perform specific tasks.Mutation eventsMutation events provide a mechanism for a web page or an e...
Graphics on the Web - Developer guides
APIs to draw 2D graphics using JavaScript. SVG Scalable Vector Graphics (SVG) lets you use lines, curves, and other geometric shapes to render graphics. With vectors, you can create images that scale cleanly to any size. View All... 3D Graphics WebGL A guide to getting started with WebGL, the 3D graphics API for the Web. This technology lets you use standard OpenGL ES in web content. Video Using HTML5 audio and video Embedding video and/or audio in a web page and controlling its playback. WebRTC The RTC in WebRTC stands for Real-Time Communications, a technology that enables audio/video streaming and data sharing between browser clients (peers). ...
A hybrid approach - Developer guides
nd a flexible layout. You may even be able to make your mobile site design adaptable enough to extend comfortably to tablets as well. Examples For Mozilla's Web O' Wonder demo site, we tried out a basic version of the hybrid approach, with positive results. We used some elements of responsive web design to give the site a mobile layout, along with user-agent detection to provide mobile-friendly videos and to re-order the demos if the user is on a phone. Feel free to check out the source code on github. We could also be doing more development involving this approach very soon! In fact, one potential path for the main Mozilla site is roughly outlined in the "The Good" section above: Using user-agent detection, route visitors to a landing page for the Firefox version for their device. Every...
HTML attribute: crossorigin - HTML: Hypertext Markup Language
Depending on the element, the attribute can be a CORS settings attribute. The crossorigin content attribute on media elements is a CORS settings attribute. These attributes are enumerated, and have the following possible values: Keyword Description anonymous CORS requests for this element will have the credentials flag set to 'same-origin'. ...
Allowing cross-origin use of images and canvas - HTML: Hypertext Markup Language
th an appropriate CORS header, allows images defined by the <img> element that are loaded from foreign origins to be used in a <canvas> as if they had been loaded from the current origin. See CORS settings attributes for details on how the crossorigin attribute is used. Security and tainted canvases Because the pixels in a canvas's bitmap can come from a variety of sources, including images or videos retrieved from other hosts, it's inevitable that security problems may arise. As soon as you draw into a canvas any data that was loaded from another origin without CORS approval, the canvas becomes tainted. A tainted canvas is one which is no longer considered secure, and any attempts to retrieve image data back from the canvas will cause an exception to be thrown. If the source of the foreig...
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
Web › HTML › Element › iframe
ld concisely describe the embedded content: <iframe title="Wikipedia page for Avocados" src="https://en.wikipedia.org/wiki/Avocado"></iframe> Without this title, they have to navigate into the <iframe> to determine what its embedded content is. This context shift can be confusing and time-consuming, especially for pages with multiple <iframe>s and/or if embeds contain interactive content like video or audio. Specifications Specification Status Comment Referrer PolicyThe definition of 'referrerpolicy attribute' in that specification. Candidate Recommendation Added the referrerpolicy attribute. HTML Living StandardThe definition of '<iframe>' in that specification. Living Standard HTML5The definition of '<iframe>' in that specificat...
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
Web › HTML › Element › input
creen reader will announce the label of the form control receiving focus, the screen reader will not announce anything before the label, and the sighted user on a small device will equally miss the context created by the preceding content. capture Introduced in the HTML Media Capture specification and valid for the file input type only, the capture attribute defines which media--microphone, video, or camera--should be used to capture a new file for upload with file upload control in supporting scenarios. See the file input type. checked Valid for both radio and checkbox types, checked is a Boolean attribute. If present on a radio type, it indicates that that radio button is the currently selected one in the group of same-named radio buttons. If present on a checkbox type, it indicat...
<link>: The External Resource Link element - HTML: Hypertext Markup Language
Web › HTML › Element › link
ute. font CSS @font-face image <img> and <picture> elements with srcset or imageset attributes, SVG <image> elements, CSS *-image rules object <object> elements script <script> elements, Worker importScripts style <link rel=stylesheet> elements, CSS @import track <track> elements video <video> elements worker Worker, SharedWorker crossorigin This enumerated attribute indicates whether CORS must be used when fetching the resource. CORS-enabled images can be reused in the <canvas> element without being tainted. The allowed values are: anonymous A cross-origin request (i.e. with an Origin HTTP header) is performed, but no credential is sent (...
<script>: The Script element - HTML: Hypertext Markup Language
Web › HTML › Element › script
dardized. The type attribute should be used instead. Notes Scripts without async , defer or type="module" attributes, as well as inline scripts, are fetched and executed immediately, before the browser continues to parse the page. The script should be served with the text/javascript MIME type, but browsers are lenient and only block them if the script is served with an image type (image/*); a video type (video/*); an audio (audio/*) type; or text/csv. If the script is blocked, an error is sent to the element, if not a load event is sent. Examples Basic usage These examples show how to import (an external) script using the <script> element. <script src="javascript.js"></script> And the following examples show how to put (an inline) script inside the <script> element. <script> alert(...
Inline elements - HTML: Hypertext Markup Language
<bdi> <bdo> <big> <br> <button> <canvas> <cite> <code> <data> <datalist> <del> <dfn> <em> <embed> <i> <iframe> <img> <input> <ins> <kbd> <label> <map> <mark> <meter> <noscript> <object> <output> <picture> <progress> <q> <ruby> <s> <samp> <script> <select> <slot> <small> <span> <strong> <sub> <sup> <svg> <template> <textarea> <time> <u> <tt> <var> <video> <wbr> See also Block-level elements HTML element reference display Content categories Block and Inline Layout in Normal Flow ...
Microdata - HTML: Hypertext Markup Language
s or meaning of an Item. Web developers can design a custom vocabulary or use vocabularies available on the web, such as the widely used schema.org vocabulary. A collection of commonly used markup vocabularies are provided by Schema.org. Commonly used vocabularies: Creative works: CreativeWork, Book, Movie, MusicRecording, Recipe, TVSeries Embedded non-text objects: AudioObject, ImageObject, VideoObject Event Health and medical types: Notes on the health and medical types under MedicalEntity Organization Person Place, LocalBusiness, Restaurant Product, Offer, AggregateOffer Review, AggregateRating Action Thing Intangible Major search engine operators like Google, Microsoft, and Yahoo! rely on the schema.org vocabulary to improve search results. For some purposes, an ad-hoc voca...
Evolution of HTTP - HTTP
HTTP (HyperText Transfer Protocol) is the underlying protocol of the World Wide Web. Developed by Tim Berners-Lee and his team between 1989-1991, HTTP has seen many changes, keeping most of the simplicity and further shaping its flexibility. HTTP has evolved from an early protocol to exchange files in a semi-trusted laboratory environment, to the modern maze of the Internet, now carrying images, videos in high resolution and 3D. Invention of the World Wide Web In 1989, while he was working at CERN, Tim Berners-Lee wrote a proposal to build a hypertext system over the Internet. Initially calling it the Mesh, it was later renamed to World Wide Web during its implementation in 1990. Built over the existing TCP and IP protocols, it consisted of 4 building blocks: A textual format to represent...
Identifying resources on the Web - HTTP
ing parameters is by asking the Web server owner. Fragment #SomewhereInTheDocument is an anchor to another part of the resource itself. An anchor represents a sort of "bookmark" inside the resource, giving the browser the directions to show the content located at that "bookmarked" spot. On an HTML document, for example, the browser will scroll to the point where the anchor is defined; on a video or audio document, the browser will try to go to the time the anchor represents. It is worth noting that the part after the #, also known as fragment identifier, is never sent to the server with the request. Usage notes When using URLs in HTML content, you should generally only use a few of these URL schemes. When referring to subresources -- that is, files that are being loaded as part of a l...
Cross-Origin Resource Sharing (CORS) - HTTP
Web › HTTP › CORS
ding. What requests use CORS? This cross-origin sharing standard can enable cross-site HTTP requests for: Invocations of the XMLHttpRequest or Fetch APIs, as discussed above. Web Fonts (for cross-domain font usage in @font-face within CSS), so that servers can deploy TrueType fonts that can only be cross-site loaded and used by web sites that are permitted to do so. WebGL textures. Images/video frames drawn to a canvas using drawImage(). CSS Shapes from images. This article is a general discussion of Cross-Origin Resource Sharing and includes a discussion of the necessary HTTP headers. Functional overview The Cross-Origin Resource Sharing standard works by adding new HTTP headers that let servers describe which origins are permitted to read that information from a web browser. Addi...
Content negotiation - HTTP
ists the MIME types of media resources that the agent is willing to process. It is comma-separated lists of MIME types, each combined with a quality factor, a parameter indicating the relative degree of preference between the different MIME types. The Accept header is defined by the browser, or any other user-agent, and can vary according to the context, like fetching an HTML page or an image, a video, or a script: It is different when fetching a document entered in the address bar or an element linked via an <img>, <video> or <audio> element. Browsers are free to use the value of the header that they think is the most adequate; an exhaustive list of default values for common browsers is available. The Accept-CH header This is part of an experimental technology called Client Hints. Initia...
Feature Policy - HTTP
ng which features are available. With Feature Policy, you opt-in to a set of "policies" for the browser to enforce on specific features used throughout a website. These policies restrict what APIs the site can access or modify the browser's default behavior for certain features. Examples of what you can do with Feature Policy: Change the default behavior of autoplay on mobile and third party videos. Restrict a site from using sensitive APIs like camera or microphone. Allow iframes to use the fullscreen API. Block the use of outdated APIs like synchronous XHR and document.write(). Ensure images are sized properly and are not too big for the viewport. Concepts and usage Feature Policy allows you to control which origins can use which features, both in the top-level page and in embedde...
Accept - HTTP
Web › HTTP › Headers › Accept
IME types, the client is able to understand. Using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the Content-Type response header. Browsers set adequate values for this header depending on the context where the request is done: when fetching a CSS stylesheet a different value is set for the request than when fetching an image, video or a script. Header type Request header Forbidden header name no CORS-safelisted request header yes, with the additional restriction that values can't contain a CORS-unsafe request header byte: 0x00-0x1F (except 0x09 (HT)), "():<>?@[\]{}, and 0x7F (DEL). Syntax Accept: <MIME_type>/<MIME_subtype> Accept: <MIME_type>/* Accept: */* // Multiple types, wei...
Content-Security-Policy - HTTP
ectives. font-src Specifies valid sources for fonts loaded using @font-face. frame-src Specifies valid sources for nested browsing contexts loading using elements such as <frame> and <iframe>. img-src Specifies valid sources of images and favicons. manifest-src Specifies valid sources of application manifest files. media-src Specifies valid sources for loading media using the <audio> , <video> and <track> elements. object-src Specifies valid sources for the <object>, <embed>, and <applet> elements. Elements controlled by object-src are perhaps coincidentally considered legacy HTML elements and are not receiving new standardized features (such as the security attributes sandbox or allow for <iframe>). Therefore it is recommended to restrict this fetch-directive (e.g., explicitly set...
Expect - HTTP
Web › HTTP › Headers › Expect
rectives 100-continue Informs recipients that the client is about to send a (presumably large) message body in this request and wishes to receive a 100 (Continue) interim response. Examples Large message body A client sends a request with a Expect header and waits for the server to respond before sending the message body. PUT /somewhere/fun HTTP/1.1 Host: origin.example.com Content-Type: video/h264 Content-Length: 1234567890987 Expect: 100-continue The server now checks the request headers and may respond with a 100 (Continue) response to instruct the client to go ahead and send the message body, or it will send a 417 (Expectation Failed) status if any of the expectations cannot be met. Specifications Specification Title RFC 7231, section 5.1.1: Expect H...
Feature-Policy: autoplay - HTTP
The HTTP Feature-Policy header autoplay directive controls whether the current document is allowed to autoplay media requested through the HTMLMediaElement interface. When this policy is enabled and there were no user gestures, the Promise returned by HTMLMediaElement.play() will reject with a DOMException. The autoplay attribute on <audio> and <video> elements will be ignored. For more details on autoplay and autoplay blocking, see the article Autoplay guide for media and Web Audio APIs. Syntax Feature-Policy: autoplay <allowlist>; <allowlist> An allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: The feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': T...
Feature-Policy: camera - HTTP
When this policy is enabled, the Promise returned by MediaDevices.getUserMedia() will reject with a NotAllowedError. Syntax Feature-Policy: camera <allowlist>; <allowlist> An allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: The feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': The feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. ...
Feature-Policy: fullscreen - HTTP
re-Policy: fullscreen 'self' https://example.com With an <iframe> element FastCorp Inc. wants to disable fullscreen for all cross-origin child frames, except for a specific <iframe>. It can do so by delivering the following HTTP response header to define a feature policy: Feature-Policy: fullscreen 'self' Then include an allow attribute on the <iframe> element: <iframe src="https://other.com/videoplayer" allow="fullscreen"></iframe> iframe attributes can selectively enable features in certain frames, and not in others, even if those frames contain documents from the same origin. Specifications Specification Status Comment Feature Policy Editor's Draft Initial definition. Fullscreen APIThe definition of 'Fullscreen' in that specification. Edi...
Feature-Policy: picture-in-picture - HTTP
Syntax Feature-Policy: picture-in-picture <allowlist>; <allowlist> An allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: The feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': The feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin. ...
Save-Data - HTTP
is a boolean which, in requests, indicates the client's preference for reduced data usage. This could be for reasons such as high transfer costs, slow connection speeds, etc. A value of On indicates explicit user opt-in into a reduced data usage mode on the client, and when communicated to origins allows them to deliver alternative content to reduce the data downloaded such as smaller image and video resources, different markup and styling, disabled polling and automatic updates, and so on. Note: Disabling HTTP/2 Server Push (RFC 7540, section 8.2: Server Push) might be desirable too for reducing data downloads. Syntax Save-Data: <sd-token> Directives <sd-token> A numerical value indicating whether the client wants to opt in to reduced data usage mode. on indicates yes, while off (t...
Sec-Fetch-Dest - HTTP
audioworklet Sec-Fetch-Dest: document Sec-Fetch-Dest: embed Sec-Fetch-Dest: empty Sec-Fetch-Dest: font Sec-Fetch-Dest: image Sec-Fetch-Dest: manifest Sec-Fetch-Dest: nested-document Sec-Fetch-Dest: object Sec-Fetch-Dest: paintworklet Sec-Fetch-Dest: report Sec-Fetch-Dest: script Sec-Fetch-Dest: serviceworker Sec-Fetch-Dest: sharedworker Sec-Fetch-Dest: style Sec-Fetch-Dest: track Sec-Fetch-Dest: video Sec-Fetch-Dest: worker Sec-Fetch-Dest: xslt Sec-Fetch-Dest: audioworklet Sec-Fetch-Dest: audioworklet Values audio audioworklet document embed empty font image manifest object paintworklet report script serviceworker sharedworker style track video worker xslt nested-document Examples TODO Specifications Specification ...
HTTP headers - HTTP
Web › HTTP › Headers
d Header whose value is a boolean so possible values are ?0 for false and ?1 for true. Sec-Fetch-Dest It is a request header that indicates the request's destination to a server. It is a Structured Header whose value is a token with possible values audio, audioworklet, document, embed, empty, font, image, manifest, object, paintworklet, report, script, serviceworker, sharedworker, style, track, video, worker, xslt, and nested-document. Server-sent events Last-Event-ID ... NEL Defines a mechanism that enables developers to declare a network error reporting policy. Ping-From ... Ping-To ... Report-To Used to specify a server endpoint for the browser to send warning and error reports to. Transfer coding Transfer-Encoding Specifies the form of encoding used to safely transfe...
Indexed collections - JavaScript
nsole.log(chr) }) Typed Arrays JavaScript typed arrays are array-like objects and provide a mechanism for accessing raw binary data. As you already know, Array objects grow and shrink dynamically and can have any JavaScript value. JavaScript engines perform optimizations so that these arrays are fast. However, as web applications become more and more powerful, adding features such as audio and video manipulation, access to raw data using WebSockets, and so forth, it has become clear that there are times when it would be helpful for JavaScript code to be able to quickly and easily manipulate raw binary data in typed arrays. Buffers and views: typed array architecture To achieve maximum flexibility and efficiency, JavaScript typed arrays split the implementation into buffers and views. A buf...
JavaScript typed arrays - JavaScript
JavaScript typed arrays are array-like objects that provide a mechanism for reading and writing raw binary data in memory buffers. As you may already know, Array objects grow and shrink dynamically and can have any JavaScript value. JavaScript engines perform optimizations so that these arrays are fast. However, as web applications become more and more powerful, adding features such as audio and video manipulation, access to raw data using WebSockets, and so forth, it has become clear that there are times when it would be helpful for JavaScript code to be able to quickly and easily manipulate raw binary data. This is where typed arrays come in. Each entry in a JavaScript typed array is a raw binary value in one of a number of supported formats, from 8-bit integers to 64-bit floating-point numb...
Authoring MathML - MathML
nd has an option to use MathML instead of PNG images. This command will generate an XHTML+MathML document foo.xml from a foo.tex LaTeX source: mk4ht mzlatex foo.tex # Linux/Mac platforms mzlatex foo.tex # Windows platform Note that tex4ebook relies on TeX4ht to generate EPUB documents. LaTeXML is another tool that can generate HTML5 and EPUB documents. Windows users can watch this video tutorial. Given a foo.tex LaTeX file, you can use these simple commands: latexmlc --dest foo.html foo.tex # Generate a HTML5 document foo.html latexmlc --dest foo.epub foo.tex # Generate an EPUB document foo.epub To handle the case of browsers without MathML support, you can use the --javascript parameter to tell LaTeXML to include one of the fallback scripts: latexmlc --dest foo.html --...
Mapping the width and height attributes of media container elements to their aspect-ratio - Web media technologies
to this work, browsers are working on adding a new mechanism for sizing images before the actual image is loaded. Firefox has added an internal aspect-ratio property (in version 69 onwards) that applies to replaced elements, and other related elements that accept width and height attributes. This appears in the browser's internal UA stylesheet, similar to the following: img, input[type="image"], video, embed, iframe, marquee, object, table { aspect-ratio: attr(width) / attr(height); } This actually affects any element that acts as a container for complex or mixed visual media -- <embed>, <iframe>, <marquee>, <object>, <table>, and <video>, in addition to actual images (<img> and <input type="image">). When such an element has width and height attributes set on it, its aspect ratio will be ...
Using images in HTML - Web media technologies
Web › Media › images
on't see the image. <picture> The HTML <picture> element contains zero or more <source> elements and one <img> element which provides versions of an image for different display/device scenarios. The browser considers each child <source> element and chooses the best match among them. CSS object-fit The object-fit CSS property sets how the content of a replaced element, such as an <img> or <video>, should be resized to fit its container. object-position The object-position CSS property specifies the alignment of content in a selected replaced element within the element's box. Areas of the box which aren't covered by the replaced element's object will show the element's background. background-image The background-image CSS property sets one or more background images for an element. ...
Performance fundamentals - Web Performance
ues. What you do in this regard is up to you -- do some testing and find out what's best for your particular app. Use requestAnimationFrame() instead of setInterval() Calls to window.setInterval() run code at a presumed frame rate that may or may not be possible under current circumstances. It tells the browser to render results even while the browser isn't actually drawing; that is, while the video hardware hasn't reached the next display cycle. This wastes processor time and can even lead to reduced battery life on the user's device. Instead, you should try to use window.requestAnimationFrame(). This waits until the browser is actually ready to start building the next frame of your animation, and won't bother if the hardware isn't going to actually draw anything. Another benefit to this A...
Populating the page: how browsers work - Web Performance
initial paint, the drawing to the screen is generally broken down into several layers. If this occurs, then compositing is necessary. Painting can break the elements in the layout tree into layers. Promoting content into layers on the GPU (instead of the main thread on the CPU) improves paint and repaint performance. There are specific properties and elements that instantiate a layer, including <video> and <canvas>, and any element which has the CSS properties of opacity, a 3D transform, will-change, and a few others. These nodes will be painted onto their own layer, along with their descendants, unless a descendant necessitates its own layer for one (or more) of the above reasons. Layers do improve performance, but are expensive when it comes to memory management, so should not be overused a...
Recommended Web Performance Timings: How long is too long? - Web Performance
n of the critical rendering path, when received, browsers immediately start processing the HTML, rendering the content as it is received rather than waiting for additional assets to load. Yes, one second for loading is a goal, but it's something few sites achieve. Expectations differ. A 'hello world' on the corporate network would be expected to load in milliseconds, but a user downloading a cat video on a five-year-old device over an edge network in northern Siberia would likely find a 20-second download speedy. If you wait three or four seconds without communicating to the user that a load is happening and showing some progress, the typical site will lose potential visitors, and those visitors will take a long time to come back if they ever do. In optimizing for performance, do set an ambit...
Lazy loading - Web Performance
are off-screen (non-critical), requiring user interaction (an example being scroll) in order to view them. Loading attribute The loading attribute on an <img> element (or the loading attribute on an <iframe>) can be used to instruct the browser to defer loading of images/iframes that are off-screen until the user scrolls near them. <img src="image.jpg" loading="lazy" alt="..." /> <iframe src="video-player.html" loading="lazy"></iframe> The load event fires when the eagerly-loaded content has all been loaded; at that time, it's entirely possible (or even likely) that there may be lazily-loaded images that are within the visual viewport that haven't yet loaded. You can determine if a given image has finished loading by examining the value of its Boolean complete property. Polyfill Include...
Progressive web app structure - Progressive web apps (PWAs)
HTML, as the browser is actually streaming the data already and you can see when the elements are loaded and rendered on the website. To have the JavaScript "operational", however, it has to be downloaded in its entirety. The Streams API allows developers to have direct access to data streaming from the server -- if you want to perform an operation on the data (for example, adding a filter to a video), you no longer need to wait for all of it to be downloaded and converted to a blob (or whatever) -- you can start right away. It provides fine-grained control -- the stream can be started, chained with another stream, cancelled, checked for errors, and more. In theory, streaming is a better model, but it's also more complex, and at the time of writing (March 2018) the Streams API is still a wor...
Mobile first - Progressive web apps (PWAs)
ery easy to use.) HTML structure For this example app, the HTML structure is going to be very simple: I am just including a heading, navigation menu and filler text to highlight the fact that articles can get very long on narrow screen devices. Our HTML looks like this: <article> <nav> <ul> <li><a href="#">Home</a></li> <li><a href="#">Articles</a></li> <li><a href="#">Videos</a></li> <li><a href="#">Work</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> </nav> <header> <a id="top" href="#bottom">Jump to menu</a> <h1>My article</h1> </header> <div class="main"> <p>Lorem ipsum ... </p> <a id="bottom" href="#top">Back to top</a> </div> </article> <button id="install-btn">Install</button> ...
Structural overview of progressive web apps - Progressive web apps (PWAs)
th HTML, as the browser is actually streaming the data already and you can see when the elements are loaded and rendered on the website. To have the JavaScript actually work, however, it has to be downloaded in its entirety. The Streams API allows developers to have direct access to data streaming from the server. If you want to perform an operation on the data (for example, adding a filter to a video), you no longer need to wait for all of it to be downloaded and converted to a blob (or whatever). Instead, you can start right away. It provides fine-grained control: the stream can be started, chained with another stream, canceled, checked for errors, and more. In theory, streaming is a better model than the app shell model, but it's also more complex, and the Streams API isn't yet fully suppo...
opacity - SVG: Scalable Vector Graphics
Web › SVG › Attribute › opacity
CSS property. See the css opacity property for more information. ...
systemLanguage - SVG: Scalable Vector Graphics
rences. 35 elements are using this attribute: <a>, <altGlyph>, <animate>, <animateColor>, <animateMotion>, <animateTransform>, <audio>, <canvas>, <circle>, <clipPath>, <cursor>, <defs>, <discard>, <ellipse>, <foreignObject>, <g>, <iframe>, <image>, <line>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <set>, <svg>, <switch>, <text>, <textPath>, <tref>, <tspan>, <unknown>, <use>, and <video> Usage notes Value <language-tags> Default value None Animatable No <language-tags> The value is a set of comma-separated tokens, each of which must be a Language-Tag value, as defined in BCP 47. systemLanguage is often used in conjunction with the <switch> element. If the attribute is used in other situations, then it represents a simple switch o...
visibility - SVG: Scalable Vector Graphics
te, visibility can be used as a CSS property. See the css visibility property for more information. ...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
on-rendered elements not included in addressable characters Implementation status unknown Unknown elements in text render as unpositioned spans Implementation status unknown Offset distances of text positioned along a transformed path measured in text elements coordinate system Implementation status unknown Embedded Content Change Notes <video> Implementation status unknown <audio> Implementation status unknown <iframe> Implementation status unknown <canvas> Implementation status unknown <source> Implementation status unknown <track> Implementation status unknown Painting Change Notes paint-order Implemented (bug 828805) will-cha...
Same-origin policy - Web security
></script>. Error details for syntax errors are only available for same-origin scripts. CSS applied with <link rel="stylesheet" href="...">. Due to the relaxed syntax rules of CSS, cross-origin CSS requires a correct Content-Type header. Restrictions vary by browser: Internet Explorer, Firefox, Chrome, Safari (scroll down to CVE-2010-0051) and Opera. Images displayed by <img>. Media played by <video> and <audio>. External resources embedded with <object> and <embed>. Fonts applied with @font-face. Some browsers allow cross-origin fonts, others require same-origin. Anything embedded by <iframe>. Sites can use the X-Frame-Options header to prevent cross-origin framing. How to allow cross-origin access Use CORS to allow cross-origin access. CORS is a part of HTTP that lets servers specify...
WebAssembly Concepts - WebAssembly
CSSOM, WebGL, IndexedDB, Web Audio API, etc.). Historically, the VM has been able to load only JavaScript. This has worked well for us as JavaScript is powerful enough to solve most problems people have on the Web today. We have run into performance problems, however, when trying to use JavaScript for more intensive use cases like 3D games, Virtual and Augmented Reality, computer vision, image/video editing, and a number of other domains that demand native performance (see WebAssembly use cases for more ideas). Additionally, the cost of downloading, parsing, and compiling very large JavaScript applications can be prohibitive. Mobile and other resource-constrained platforms can further amplify these performance bottlenecks. WebAssembly is a different language from JavaScript, but it is not ...
Using the WebAssembly JavaScript API - WebAssembly
he text representation of any wasm code included in a web page. To view it, you can go to the Debugger Panel and click on the "wasm://" entry. Starting soon in Firefox, in addition to viewing WebAssembly as text, developers will be able to debug (place breakpoints, inspect the callstack, single-step, etc.) WebAssembly using the text format. See WebAssembly debugging with Firefox DevTools for a video preview. Memory In the low-level memory model of WebAssembly, memory is represented as a contiguous range of untyped bytes called Linear Memory that are read and written by load and store instructions inside the module. In this memory model, any load or store can access any byte in the entire linear memory, which is necessary to faithfully represent C/C++ concepts like pointers. Unlike a nati...