Skip to main content
Version: Next

LivePlayerContext

The LivePlayerContext instance can be obtained with Taro.createLivePlayerContext. LivePlayerContext is bound to an live-player component with an id, to work with the live-player component.

Reference

Methods

exitFullScreen

Exits the full screen

Reference

(option?: ExitFullScreenOption) => void
PropertyType
optionExitFullScreenOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePlayerContext.exitFullScreen✔️

mute

Mute

Reference

(option?: MuteOption) => void
PropertyType
optionMuteOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePlayerContext.mute✔️

pause

Pause

Reference

(option?: PauseOption) => void
PropertyType
optionPauseOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePlayerContext.pause✔️

play

Plays an audio file.

Reference

(option?: PlayOption) => void
PropertyType
optionPlayOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePlayerContext.play✔️

requestFullScreen

Enters the full screen.

Reference

(option: RequestFullScreenOption) => void
PropertyType
optionRequestFullScreenOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePlayerContext.requestFullScreen✔️

resume

Redoes the operation.

Reference

(option?: ResumeOption) => void
PropertyType
optionResumeOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePlayerContext.resume✔️

snapshot

Screenshot

Reference

(option?: SnapshotOption) => void
PropertyType
optionSnapshotOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePlayerContext.snapshot✔️

stop

Stop

Reference

(option?: StopOption) => void
PropertyType
optionStopOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePlayerContext.stop✔️

Parameters

ExitFullScreenOption

PropertyTypeRequiredDescription
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

MuteOption

PropertyTypeRequiredDescription
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

PauseOption

PropertyTypeRequiredDescription
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

PlayOption

PropertyTypeRequiredDescription
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

RequestFullScreenOption

PropertyTypeRequiredDescription
direction0 | 90 | -90NoSpecifies the direction in the full screen
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

ResumeOption

PropertyTypeRequiredDescription
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

SnapshotOption

PropertyTypeRequiredDescription
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

SnapshotSuccessCallbackResult

PropertyTypeDescription
heightstringThe height of an image
tempImagePathstringTemporary path to images files
widthstringThe width of an image
errMsgstringCall result

StopOption

PropertyTypeRequiredDescription
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

API Support

APIWeChat Mini-ProgramH5React Native
LivePlayerContext.exitFullScreen✔️
LivePlayerContext.mute✔️
LivePlayerContext.pause✔️
LivePlayerContext.play✔️
LivePlayerContext.requestFullScreen✔️
LivePlayerContext.resume✔️
LivePlayerContext.snapshot✔️
LivePlayerContext.stop✔️