YouTip LogoYouTip

Av Prop Controller

## HTML Audio/Video DOM: The `controller` Property The `controller` property is a part of the HTML5 Audio/Video DOM API. It is designed to return the current media controller associated with an audio or video element, allowing developers to synchronize multiple media elements. --- ## Definition and Usage The `controller` property returns the **MediaController** object of the audio or video element. By default, audio and video elements do not have an associated media controller. If a media controller has been explicitly assigned to the element, this property returns it as a `MediaController` object. This object allows you to control the playback, volume, and status of multiple media elements simultaneously. --- ## Syntax ```javascript let mediaController = audioOrVideoElement.controller; ``` ### Return Value * **Type**: `MediaController` object (or `null`/`undefined` if no controller is assigned). * **Description**: Represents the media controller governing the element. #### Properties and Methods of the `MediaController` Object: When a `MediaController` is active, it exposes the following properties and methods to manage synchronized playback: | Property / Method | Description | | :--- | :--- | | `buffered` | Returns a `TimeRanges` object representing the buffered ranges of the media. | | `seekable` | Returns a `TimeRanges` object representing the seekable ranges of the media. | | `duration` | Returns the total duration of the media in seconds. | | `currentTime` | Gets or sets the current playback position in seconds. | | `paused` | Returns a boolean indicating whether playback is currently paused. | | `played` | Returns a `TimeRanges` object representing the ranges of the media that have already been played. | | `defaultPlaybackRate` | Gets or sets the default playback speed of the media. | | `playbackRate` | Gets or sets the current playback speed of the media. | | `volume` | Gets or sets the audio volume (from 0.0 to 1.0). | | `muted` | Gets or sets whether the audio output is muted. | | `play()` | Starts playback of all associated media elements. | | `pause()` | Pauses playback of all associated media elements. | --- ## Code Example The following example demonstrates how to check if a video element has an active media controller assigned to it: ```html Media Controller Example - YouTip
``` --- ## Browser Support and Modern Considerations > ⚠️ **Important Compatibility Note** > > The `MediaController` interface and the `controller` property were originally proposed in HTML5 to synchronize multiple media elements (such as playing a video alongside a separate sign-language or commentary audio track). However, **this feature was deprecated and removed from the HTML standard** due to a lack of implementation consensus among browser vendors. > > Currently, **no major modern browsers** (including Google Chrome, Mozilla Firefox, Apple Safari, Microsoft Edge, or Opera) support the `controller` property. It will return `undefined` in modern environments. ### Modern Alternatives If you need to synchronize multiple audio or video elements today, you should implement synchronization programmatically using JavaScript event listeners (such as listening to the `play`, `pause`, `seeking`, and `timeupdate` events of a master element and updating the slave elements accordingly).
← Av Prop ControlsAv Prop Buffered β†’