as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
跳转到主要内容
https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement

Extends

  • React.Component

Extended by

Implements

Constructors

new Media()

new Media(props, mediaPlayer): Media

Parameters

props
any
mediaPlayer
MediaPlayer

Returns

Media

Properties

preservesPitch?

optional preservesPitch: boolean | undefined
https://html.spec.whatwg.org/multipage/media.html#dom-media-preservespitch Not implemented

Methods

addEventListener()

addEventListener(type: string, listener: EventListener, options?: boolean | AddEventListenerOptions | undefined): void
Adds a event listener

Parameters

type
string
listener
EventListener
options?
boolean | AddEventListenerOptions | undefined

addTextTrack()

addTextTrack(kind: TextTrackKind, label?: string | undefined, language?: string | undefined, uri?: string | undefined, mimeType?: string | undefined): TextTrack
https://html.spec.whatwg.org/multipage/media.html#dom-media-addtexttrack

Parameters

kind
TextTrackKind The kind attribute must return the text track kind of the text track that the TextTrack object represents.
label?
string | undefined The label attribute must return the text track label of the text track that the TextTrack object represents.
language?
string | undefined The language attribute must return the text track language of the text track that the TextTrack object represents.
uri?
string | undefined The uri attribute must return the uri of the out of band subtitle of the text track that the TextTrack object represents. This is a custom addition (not as per w3c spec). If uri is provided, this component will take care of parsing and rendering subtitles.
mimeType?
string | undefined The mimeType attribute must return the mime type of the out of band subtitle of the text track that the TextTrack object represents. This is a custom addition (not as per w3c spec).

Returns

TextTrack

canPlayType()

canPlayType(type: string): CanPlayTypeResult
https://html.spec.whatwg.org/multipage/media.html#dom-navigator-canplaytype

Parameters

type
string mime type

Returns

CanPlayTypeResult

componentDidMount()

componentDidMount(): void

componentWillUnmount()

componentWillUnmount(): void

fastSeek()

fastSeek(time: number): void
https://html.spec.whatwg.org/multipage/media.html#dom-media-fastseek

Parameters

time
number

getStartDate()

getStartDate(): Date
https://html.spec.whatwg.org/multipage/media.html#dom-media-getstartdate

Returns

Date

handleEvent()

handleEvent(event: NativeInterfaces.NativeMediaElementEvent): void
Handle all media element and audio/video track list events.

Parameters

event
NativeInterfaces.NativeMediaElementEvent

load()

load(): void

onCaptionViewCreated()

onCaptionViewCreated(captionViewHandle: string): void

Parameters

captionViewHandle
string

pause()

pause(): void
https://html.spec.whatwg.org/multipage/media.html#dom-media-pause

play()

play(): Promise<void>
https://html.spec.whatwg.org/multipage/media.html#dom-media-play

Returns

Promise<void>

removeEventListener()

removeEventListener(type: string, listener: EventListener, options?: boolean | EventListenerOptions | undefined): void
Removes event listener

Parameters

type
string
listener
EventListener
options?
boolean | EventListenerOptions | undefined

setMediaKeys()

setMediaKeys(mediaKeys?: MediaKeys | undefined): Promise<void>

Parameters

mediaKeys?
MediaKeys | undefined

Returns

Promise<void>
最后修改于 2026年8月25日