title: LivePusherContext
sidebar_label: 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
Property |
Type |
option |
PauseOption |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
LivePusherContext.pause |
✔️ |
|
pauseBGM
Pauses BGM
Reference
(option?: PauseBGMOption) => void
Property |
Type |
option |
PauseBGMOption |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
LivePusherContext.pauseBGM |
✔️ |
|
playBGM
Plays BGM
Reference
(option: PlayBGMOption) => void
Property |
Type |
option |
PlayBGMOption |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
LivePusherContext.playBGM |
✔️ |
|
resume
Resumes stream pushing
Reference
(option?: ResumeOption) => void
Property |
Type |
option |
ResumeOption |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
LivePusherContext.resume |
✔️ |
|
resumeBGM
Resumes BGM
Reference
(option?: ResumeBGMOption) => void
Property |
Type |
option |
ResumeBGMOption |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
LivePusherContext.resumeBGM |
✔️ |
|
setBGMVolume
Sets BGM volume
Reference
(option: SetBGMVolumeOption) => void
Property |
Type |
option |
SetBGMVolumeOption |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
LivePusherContext.setBGMVolume |
✔️ |
|
snapshot
Snapshot
Reference
(option?: SnapshotOption) => void
Property |
Type |
option |
SnapshotOption |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
LivePusherContext.snapshot |
✔️ |
|
start
Starts stream pushing and enables camera preview
Reference
(option?: StartOption) => void
Property |
Type |
option |
StartOption |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
LivePusherContext.start |
✔️ |
|
startPreview
Enables camera preview
Reference
(option?: StartPreviewOption) => void
Property |
Type |
option |
StartPreviewOption |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
LivePusherContext.startPreview |
✔️ |
|
stop
Stops stream pushing and stops camera preview
Reference
(option?: StopOption) => void
Property |
Type |
option |
StopOption |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
LivePusherContext.stop |
✔️ |
|
stopBGM
Stops BGM
Reference
(option?: StopBGMOption) => void
Property |
Type |
option |
StopBGMOption |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
LivePusherContext.stopBGM |
✔️ |
|
stopPreview
Disables camera preview
Reference
(option?: StopPreviewOption) => void
Property |
Type |
option |
StopPreviewOption |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
LivePusherContext.stopPreview |
✔️ |
|
switchCamera
Switches between the front and rear cameras
Reference
(option?: SwitchCameraOption) => void
Property |
Type |
option |
SwitchCameraOption |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
LivePusherContext.switchCamera |
✔️ |
|
toggleTorch
Toggles torch
Reference
(option?: ToggleTorchOption) => void
Property |
Type |
option |
ToggleTorchOption |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
LivePusherContext.toggleTorch |
✔️ |
|
Parameters
PauseOption
Property |
Type |
Required |
Description |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
PauseBGMOption
Property |
Type |
Required |
Description |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
PlayBGMOption
Property |
Type |
Required |
Description |
url |
string |
Yes |
The URL of the audio added to the BGM |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
ResumeOption
Property |
Type |
Required |
Description |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
ResumeBGMOption
Property |
Type |
Required |
Description |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
SetBGMVolumeOption
Property |
Type |
Required |
Description |
volume |
string |
Yes |
Volume. Its values range from 0 to 1. |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
SnapshotOption
Property |
Type |
Required |
Description |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
StartOption
Property |
Type |
Required |
Description |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
StartPreviewOption
Property |
Type |
Required |
Description |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
StopOption
Property |
Type |
Required |
Description |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
StopBGMOption
Property |
Type |
Required |
Description |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
StopPreviewOption
Property |
Type |
Required |
Description |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
SwitchCameraOption
Property |
Type |
Required |
Description |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
ToggleTorchOption
Property |
Type |
Required |
Description |
complete |
(res: any) => void |
No |
The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail |
(res: any) => void |
No |
The callback function for a failed API call |
success |
(res: Result) => void |
No |
The callback function for a successful API call |
API Support
API |
WeChat Mini-Program |
H5 |
React 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 |
✔️ |
|
|