Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/evt/lib/types/index.ts>dom.HTMLMediaElement

💧EventEmitter's typesafe replacement
Go to Latest
interface dom.HTMLMediaElement
implements HTMLElement
import { type dom } from "https://deno.land/x/evt@v2.4.16/lib/types/index.ts";
const { HTMLMediaElement } = dom;

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

Properties

readonly
audioTracks: AudioTrackList

Returns an AudioTrackList object with the audio tracks for a given video element.

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.

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
msAudioCategory: string

Specifies the purpose of the audio or video media, such as background audio or alerts.

msAudioDeviceType: string

Specifies the output device id that the audio will be sent to.

readonly
msGraphicsTrustStatus: MSGraphicsTrust
readonly
deprecated
msKeys: MSMediaKeys
msPlayToDisabled: boolean

Gets or sets whether the DLNA PlayTo device is available.

msPlayToPreferredSourceUri: string

Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.

msPlayToPrimary: boolean

Gets or sets the primary DLNA PlayTo device.

readonly
msPlayToSource: any

Gets the source associated with the media element for use by the PlayToManager.

msRealTime: boolean

Specifies whether or not to enable low-latency playback on the media element.

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
deprecated
onmsneedkey: ((this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => 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: string

Gets or sets the current playback position, in seconds.

readonly
readyState: number
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:
readonly
textTracks: TextTrackList
readonly
videoTracks: VideoTrackList
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.

load(): void

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

msClearEffects(): void

Clears all effects from the media pipeline.

msGetAsCastingSource(): any
msInsertAudioEffect(
activatableClassId: string,
effectRequired: boolean,
config?: any,
): void

Inserts the specified audio effect into media pipeline.

deprecated
msSetMediaKeys(mediaKeys: MSMediaKeys): void
msSetMediaProtectionManager(mediaProtectionManager?: any): void

Specifies the media protection manager for a given media pipeline.

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