Skip to main content
Version: 3.x

LivePusherContext

The LivePusherContext instance can be obtained with Taro.createLivePusherContext. LivePusherContext is bound to the unique live-pusher component on the page to use the live-pusher component.

Reference

Methods

pause

Pauses stream pushing

Reference

(option?: PauseOption) => void
PropertyType
optionPauseOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePusherContext.pause✔️

pauseBGM

Pauses BGM

Reference

(option?: PauseBGMOption) => void
PropertyType
optionPauseBGMOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePusherContext.pauseBGM✔️

playBGM

Plays BGM

Reference

(option: PlayBGMOption) => void
PropertyType
optionPlayBGMOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePusherContext.playBGM✔️

resume

Resumes stream pushing

Reference

(option?: ResumeOption) => void
PropertyType
optionResumeOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePusherContext.resume✔️

resumeBGM

Resumes BGM

Reference

(option?: ResumeBGMOption) => void
PropertyType
optionResumeBGMOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePusherContext.resumeBGM✔️

setBGMVolume

Sets BGM volume

Reference

(option: SetBGMVolumeOption) => void
PropertyType
optionSetBGMVolumeOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePusherContext.setBGMVolume✔️

snapshot

Snapshot

Reference

(option?: SnapshotOption) => void
PropertyType
optionSnapshotOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePusherContext.snapshot✔️

start

Starts stream pushing and enables camera preview

Reference

(option?: StartOption) => void
PropertyType
optionStartOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePusherContext.start✔️

startPreview

Enables camera preview

Reference

(option?: StartPreviewOption) => void
PropertyType
optionStartPreviewOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePusherContext.startPreview✔️

stop

Stops stream pushing and stops camera preview

Reference

(option?: StopOption) => void
PropertyType
optionStopOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePusherContext.stop✔️

stopBGM

Stops BGM

Reference

(option?: StopBGMOption) => void
PropertyType
optionStopBGMOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePusherContext.stopBGM✔️

stopPreview

Disables camera preview

Reference

(option?: StopPreviewOption) => void
PropertyType
optionStopPreviewOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePusherContext.stopPreview✔️

switchCamera

Switches between the front and rear cameras

Reference

(option?: SwitchCameraOption) => void
PropertyType
optionSwitchCameraOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePusherContext.switchCamera✔️

toggleTorch

Toggles torch

Reference

(option?: ToggleTorchOption) => void
PropertyType
optionToggleTorchOption

API Support

APIWeChat Mini-ProgramH5React Native
LivePusherContext.toggleTorch✔️

Parameters

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

PauseBGMOption

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

PlayBGMOption

PropertyTypeRequiredDescription
urlstringYesThe URL of the audio added to the BGM
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

ResumeBGMOption

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

SetBGMVolumeOption

PropertyTypeRequiredDescription
volumestringYesVolume. Its values range from 0 to 1.
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

StartOption

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

StartPreviewOption

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

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

StopBGMOption

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

StopPreviewOption

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

SwitchCameraOption

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

ToggleTorchOption

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
LivePusherContext.pause✔️
LivePusherContext.pauseBGM✔️
LivePusherContext.playBGM✔️
LivePusherContext.resume✔️
LivePusherContext.resumeBGM✔️
LivePusherContext.setBGMVolume✔️
LivePusherContext.snapshot✔️
LivePusherContext.start✔️
LivePusherContext.startPreview✔️
LivePusherContext.stop✔️
LivePusherContext.stopBGM✔️
LivePusherContext.stopPreview✔️
LivePusherContext.switchCamera✔️
LivePusherContext.toggleTorch✔️