as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
跳转到主要内容
VideoPlayer is a component that implements the HTMLVideoElement interface that extends HTMLMediaElement interface. This is a typescript class and not a react native component. Apps need to create an instance of VideoPlayer and use it to start buffering the content without rendering video on screen. It doesn’t render video to the screen by default, nor does it render the media controls GUI. Apps are expected to build their own media controls UI and control the playback experience. When the app wants to show the video on screen, it must add KeplerVideoSurfaceView React Native component to the render tree, receive onSurfaceViewCreated event and pass the surface handle obtained in the event callback to VideoPlayer through the setSurfaceHandle API.

Extends

  • MediaPlayer

Implements

Constructors

new VideoPlayer()

new VideoPlayer(): VideoPlayer

Returns

VideoPlayer

Methods

clearSurfaceHandle()

clearSurfaceHandle(surfaceHandle: string): void
Sets the surface handle to which video is rendered.

Parameters

surfaceHandle
string

deinitialize()

deinitialize(): Promise<void>
DeInitiailzes the player.

Returns

Promise<void> Promise that is resolved when player is deInitialized.

deinitializeSync()

deinitializeSync(timeoutInMs: number): NativeInterfaces.MediaPlayerDeInitStatus
DeInitiailzes the player synchronously

Parameters

timeoutInMs
number time out threshold set by client to return the deinit control.

Returns

NativeInterfaces.MediaPlayerDeInitStatus MediaPlayerDeInitStatus

getVideoPlaybackQuality()

getVideoPlaybackQuality(): VideoPlaybackQuality
Fetches video playback quality attributes.

Returns

VideoPlaybackQuality

handleEvent()

handleEvent(event: NativeInterfaces.NativeMediaElementEvent): void

Parameters

event
NativeInterfaces.NativeMediaElementEvent

initialize()

initialize(): Promise<void>
Initiailzes the player. Wait for the promise to be fulfilled before calling any other fucntion.

Returns

Promise<void> Promise that is resolved when player is initialized..

setMediaControlFocus()

setMediaControlFocus(componentInstance: IComponentInstance, mediaControlHandler?: any): Promise<void>
setup the component instance with current mediaplayer being used and pass mediaControlHandler in case client wants to opt handling of mediacontrol commands.

Parameters

componentInstance
IComponentInstance
mediaControlHandler?
any

Returns

Promise<void>

setSurfaceHandle()

setSurfaceHandle(surfaceHandle: string): void
Sets the surface handle to which video is rendered.

Parameters

surfaceHandle
string
最后修改于 2026年8月25日