This feature is not Baseline because it does not work in some of the most widely-used browsers.
The Remote Playback API extends the HTMLMediaElement to enable the control of media played on a remote device.
Remote playback devices are connected devices such as TVs, projectors, or speakers. The API takes into account wired devices connected via HDMI or DVI, and wireless devices, for example Chromecast or AirPlay.
The API enables a page, which has an media element such as a video or audio file, to initiate and control playback of that media on a connected remote device. For example, playing a video on a connected TV.
Note: Safari for iOS has some APIs which enable remote playback on AirPlay. Details of these can be found in the Safari 9.0 release notes.
Android versions of Firefox and Chrome also contain some remote playback features. These devices will show a Cast button if there is a Cast device available in the local network.
RemotePlaybackAllows the page to detect availability of remote playback devices, then connect to and control playing on these devices.
HTMLMediaElement.disableRemotePlaybackA boolean that sets or returns the remote playback state, indicating whether the media element is allowed to have a remote playback UI.
HTMLMediaElement.remote Read only
Return a RemotePlayback object instance associated with the media element.
The following example demonstrates a player with custom controls that supports remote playback. Initially the button used to select a device is hidden.
<video id="videoElement" src="https://example.org/media.ext"> <button id="deviceBtn" class="hidden">Pick device</button> </video>
.hidden {
display: none;
}
The RemotePlayback.watchAvailability() method watches for available remote playback devices. If a device is available, use the callback to show the button.
const deviceBtn = document.getElementById("deviceBtn");
const videoElem = document.getElementById("videoElement");
function availabilityCallback(available) {
// Show or hide the device picker button depending on device availability.
if (available) {
deviceBtn.classList.remove("hidden");
} else {
deviceBtn.classList.add("hidden");
}
}
videoElem.remote.watchAvailability(availabilityCallback).catch(() => {
// If the device cannot continuously watch available,
// show the button to allow the user to try to prompt for a connection.
deviceBtn.style.display = "inline";
});
| Specification |
|---|
| Remote Playback API> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
Remote_Playback_API |
121 | 121 | No | 107 | 13.1 | 56 | No | 43 | 13.4 | 6.0 | No | 13.4 |
cancelWatchAvailability |
121 | 121 | No | 107 | 13.1 | 56 | No | 43 | 13.4 | 6.0 | No | 13.4 |
connect_event |
121 | 121 | No | 107 | 13.1 | 56 | No | 43 | 13.4 | 6.0 | No | 13.4 |
connecting_event |
121 | 121 | No | 107 | 13.1 | 56 | No | 43 | 13.4 | 6.0 | No | 13.4 |
disconnect_event |
121 | 121 | No | 107 | 13.1 | 56 | No | 43 | 13.4 | 6.0 | No | 13.4 |
prompt |
121 | 121 | No | 107 | 13.1 | 56 | No | 43 | 13.4 | 6.0 | No | 13.4 |
state |
121 | 121 | No | 107 | 13.1 | 56 | No | 43 | 13.4 | 6.0 | No | 13.4 |
watchAvailability |
121 | 121 | No | 107 | 13.1 | 56 | No | 43 | 13.4 | 6.0 | No | 13.4 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Remote_Playback_API