Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

HTMLMediaElement

Adds to HTMLElement the properties and methods needed to support basic media-related capabilities that are common to audio and video.

interface HTMLMediaElement extends HTMLElement {
autoplay: boolean;
readonly buffered: TimeRanges;
controls: boolean;
crossOrigin: string | null;
readonly currentSrc: string;
currentTime: number;
defaultMuted: boolean;
defaultPlaybackRate: number;
disableRemotePlayback: boolean;
readonly duration: number;
readonly ended: boolean;
readonly error: MediaError | null;
readonly HAVE_CURRENT_DATA: number;
readonly HAVE_ENOUGH_DATA: number;
readonly HAVE_FUTURE_DATA: number;
readonly HAVE_METADATA: number;
readonly HAVE_NOTHING: number;
loop: boolean;
readonly mediaKeys: MediaKeys | null;
muted: boolean;
readonly NETWORK_EMPTY: number;
readonly NETWORK_IDLE: number;
readonly NETWORK_LOADING: number;
readonly NETWORK_NO_SOURCE: number;
readonly networkState: number;
onencrypted: ((this: HTMLMediaElement, ev: MediaEncryptedEvent) => any) | null;
onwaitingforkey: ((this: HTMLMediaElement, ev: Event) => any) | null;
readonly paused: boolean;
playbackRate: number;
readonly played: TimeRanges;
preload:
| "none"
| "metadata"
| "auto"
| "";
preservesPitch: boolean;
readonly readyState: number;
readonly remote: RemotePlayback;
readonly seekable: TimeRanges;
readonly seeking: boolean;
src: string;
srcObject: MediaProvider | null;
readonly textTracks: TextTrackList;
volume: number;
addEventListener<K extends keyof HTMLMediaElementEventMap>(
type: K,
listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void;
addTextTrack(
label?: string,
language?: string,
): TextTrack;
canPlayType(type: string): CanPlayTypeResult;
fastSeek(time: number): void;
load(): void;
pause(): void;
play(): Promise<void>;
removeEventListener<K extends keyof HTMLMediaElementEventMap>(
type: K,
listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void;
setMediaKeys(mediaKeys: MediaKeys | null): Promise<void>;
}
var HTMLMediaElement: {
prototype: HTMLMediaElement;
readonly HAVE_CURRENT_DATA: number;
readonly HAVE_ENOUGH_DATA: number;
readonly HAVE_FUTURE_DATA: number;
readonly HAVE_METADATA: number;
readonly HAVE_NOTHING: number;
readonly NETWORK_EMPTY: number;
readonly NETWORK_IDLE: number;
readonly NETWORK_LOADING: number;
readonly NETWORK_NO_SOURCE: number;
}
;

§Extends

§Properties

§
autoplay: boolean
[src]

Gets or sets a value that indicates whether to start playing the media automatically.

§
readonly buffered: TimeRanges
[src]

Gets a collection of buffered time ranges.

§
controls: boolean
[src]

Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player).

§
crossOrigin: string | null
[src]
§
readonly currentSrc: string
[src]

Gets the address or URL of the current media resource that is selected by IHTMLMediaElement.

§
currentTime: number
[src]

Gets or sets the current playback position, in seconds.

§
defaultMuted: boolean
[src]
§
defaultPlaybackRate: number
[src]

Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource.

§
disableRemotePlayback: boolean
[src]
§
readonly duration: number
[src]

Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming.

§
readonly ended: boolean
[src]

Gets information about whether the playback has ended or not.

§
readonly error: MediaError | null
[src]

Returns an object representing the current error state of the audio or video element.

§
readonly HAVE_CURRENT_DATA: number
[src]
§
readonly HAVE_ENOUGH_DATA: number
[src]
§
readonly HAVE_FUTURE_DATA: number
[src]
§
readonly HAVE_METADATA: number
[src]
§
readonly HAVE_NOTHING: number
[src]
§
loop: boolean
[src]

Gets or sets a flag to specify whether playback should restart after it completes.

§
readonly mediaKeys: MediaKeys | null
[src]

Available only in secure contexts.

§
muted: boolean
[src]

Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted.

§
readonly NETWORK_EMPTY: number
[src]
§
readonly NETWORK_IDLE: number
[src]
§
readonly NETWORK_LOADING: number
[src]
§
readonly NETWORK_NO_SOURCE: number
[src]
§
readonly networkState: number
[src]

Gets the current network activity for the element.

§
onencrypted: ((this: HTMLMediaElement, ev: MediaEncryptedEvent) => any) | null
[src]
§
onwaitingforkey: ((this: HTMLMediaElement, ev: Event) => any) | null
[src]
§
readonly paused: boolean
[src]

Gets a flag that specifies whether playback is paused.

§
playbackRate: number
[src]

Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource.

§
readonly played: TimeRanges
[src]

Gets TimeRanges for the current media resource that has been played.

§
preload: "none" | "metadata" | "auto" | ""
[src]

Gets or sets a value indicating what data should be preloaded, if any.

§
preservesPitch: boolean
[src]
§
readonly readyState: number
[src]
§
readonly remote: RemotePlayback
[src]
§
readonly seekable: TimeRanges
[src]

Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked.

§
readonly seeking: boolean
[src]

Gets a flag that indicates whether the client is currently moving to a new playback position in the media resource.

§
src: string
[src]

The address or URL of the a media resource that is to be considered.

§
srcObject: MediaProvider | null
[src]
§
readonly textTracks: TextTrackList
[src]
§
volume: number
[src]

Gets or sets the volume level for audio portions of the media element.

§Methods

§
addEventListener<K extends keyof HTMLMediaElementEventMap>(
type: K,
listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void
[src]
§
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void
[src]
§
addTextTrack(
label?: string,
language?: string,
): TextTrack
[src]
§
canPlayType(type: string): CanPlayTypeResult
[src]

Returns a string that specifies whether the client can play a given media resource type.

§
fastSeek(time: number): void
[src]
§
load(): void
[src]

Resets the audio or video object and loads a new media resource.

§
pause(): void
[src]

Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not.

§
play(): Promise<void>
[src]

Loads and starts playback of a media resource.

§
removeEventListener<K extends keyof HTMLMediaElementEventMap>(
type: K,
listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void
[src]
§
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void
[src]
§
setMediaKeys(mediaKeys: MediaKeys | null): Promise<void>
[src]

Available only in secure contexts.