Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/yxz/typing/lib.dom.ts>HTMLMediaElement

Deno Standard Extensions
Go to Latest
interface HTMLMediaElement
implements HTMLElement
import { type HTMLMediaElement } from "https://deno.land/x/yxz@0.17.0/typing/lib.dom.ts";

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

Properties

autoplay: boolean

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

readonly
buffered: TimeRanges

Gets a collection of buffered time ranges.

controls: boolean

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
readonly
currentSrc: string

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

currentTime: number

Gets or sets the current playback position, in seconds.

defaultMuted: boolean
defaultPlaybackRate: number

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
readonly
duration: number

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

Gets information about whether the playback has ended or not.

readonly
error: MediaError | null

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

loop: boolean

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

readonly
mediaKeys: MediaKeys | null

Available only in secure contexts.

muted: boolean

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

readonly
networkState: number

Gets the current network activity for the element.

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

Gets a flag that specifies whether playback is paused.

playbackRate: number

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

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

preload:
| "none"
| "metadata"
| "auto"
| ""

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

readonly
readyState: number
readonly
remote: RemotePlayback
readonly
seekable: TimeRanges

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

readonly
seeking: boolean

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

src: string

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

srcObject: MediaProvider | null
readonly
textTracks: TextTrackList
volume: number

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

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

Methods

addTextTrack(
label?: string,
language?: string,
): TextTrack
canPlayType(type: string): CanPlayTypeResult

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

fastSeek(time: number): void
load(): void

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

pause(): void

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>

Loads and starts playback of a media resource.

setMediaKeys(mediaKeys: MediaKeys | null): Promise<void>

Available only in secure contexts.

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
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