Skip to main content
Version: 3.x

LivePusherContext

LivePusherContext 实例,可通过 Taro.createLivePusherContext 获取。 LivePusherContext 与页面内唯一的 live-pusher 组件绑定,操作对应的 live-pusher 组件。

参考文档

方法#

pause#

暂停推流

参考文档

(option?: PauseOption) => void
参数类型
optionPauseOption

API 支持度#

API微信小程序H5React Native
LivePusherContext.pause✔️

pauseBGM#

暂停背景音

参考文档

(option?: PauseBGMOption) => void
参数类型
optionPauseBGMOption

API 支持度#

API微信小程序H5React Native
LivePusherContext.pauseBGM✔️

playBGM#

播放背景音

参考文档

(option: PlayBGMOption) => void
参数类型
optionPlayBGMOption

API 支持度#

API微信小程序H5React Native
LivePusherContext.playBGM✔️

resume#

恢复推流

参考文档

(option?: ResumeOption) => void
参数类型
optionResumeOption

API 支持度#

API微信小程序H5React Native
LivePusherContext.resume✔️

resumeBGM#

恢复背景音

参考文档

(option?: ResumeBGMOption) => void
参数类型
optionResumeBGMOption

API 支持度#

API微信小程序H5React Native
LivePusherContext.resumeBGM✔️

setBGMVolume#

设置背景音音量

参考文档

(option: SetBGMVolumeOption) => void
参数类型
optionSetBGMVolumeOption

API 支持度#

API微信小程序H5React Native
LivePusherContext.setBGMVolume✔️

snapshot#

快照

参考文档

(option?: SnapshotOption) => void
参数类型
optionSnapshotOption

API 支持度#

API微信小程序H5React Native
LivePusherContext.snapshot✔️

start#

开始推流,同时开启摄像头预览

参考文档

(option?: StartOption) => void
参数类型
optionStartOption

API 支持度#

API微信小程序H5React Native
LivePusherContext.start✔️

startPreview#

开启摄像头预览

参考文档

(option?: StartPreviewOption) => void
参数类型
optionStartPreviewOption

API 支持度#

API微信小程序H5React Native
LivePusherContext.startPreview✔️

stop#

停止推流,同时停止摄像头预览

参考文档

(option?: StopOption) => void
参数类型
optionStopOption

API 支持度#

API微信小程序H5React Native
LivePusherContext.stop✔️

stopBGM#

停止背景音

参考文档

(option?: StopBGMOption) => void
参数类型
optionStopBGMOption

API 支持度#

API微信小程序H5React Native
LivePusherContext.stopBGM✔️

stopPreview#

关闭摄像头预览

参考文档

(option?: StopPreviewOption) => void
参数类型
optionStopPreviewOption

API 支持度#

API微信小程序H5React Native
LivePusherContext.stopPreview✔️

switchCamera#

切换前后摄像头

参考文档

(option?: SwitchCameraOption) => void
参数类型
optionSwitchCameraOption

API 支持度#

API微信小程序H5React Native
LivePusherContext.switchCamera✔️

toggleTorch#

切换手电筒

参考文档

(option?: ToggleTorchOption) => void
参数类型
optionToggleTorchOption

API 支持度#

API微信小程序H5React Native
LivePusherContext.toggleTorch✔️

参数#

PauseOption#

参数类型必填说明
complete(res: CallbackResult) => void接口调用结束的回调函数(调用成功、失败都会执行)
fail(res: CallbackResult) => void接口调用失败的回调函数
success(res: CallbackResult) => void接口调用成功的回调函数

PauseBGMOption#

参数类型必填说明
complete(res: CallbackResult) => void接口调用结束的回调函数(调用成功、失败都会执行)
fail(res: CallbackResult) => void接口调用失败的回调函数
success(res: CallbackResult) => void接口调用成功的回调函数

PlayBGMOption#

参数类型必填说明
urlstring加入背景混音的资源地址
complete(res: CallbackResult) => void接口调用结束的回调函数(调用成功、失败都会执行)
fail(res: CallbackResult) => void接口调用失败的回调函数
success(res: CallbackResult) => void接口调用成功的回调函数

ResumeOption#

参数类型必填说明
complete(res: CallbackResult) => void接口调用结束的回调函数(调用成功、失败都会执行)
fail(res: CallbackResult) => void接口调用失败的回调函数
success(res: CallbackResult) => void接口调用成功的回调函数

ResumeBGMOption#

参数类型必填说明
complete(res: CallbackResult) => void接口调用结束的回调函数(调用成功、失败都会执行)
fail(res: CallbackResult) => void接口调用失败的回调函数
success(res: CallbackResult) => void接口调用成功的回调函数

SetBGMVolumeOption#

参数类型必填说明
volumestring音量大小,范围是 0-1
complete(res: CallbackResult) => void接口调用结束的回调函数(调用成功、失败都会执行)
fail(res: CallbackResult) => void接口调用失败的回调函数
success(res: CallbackResult) => void接口调用成功的回调函数

SnapshotOption#

参数类型必填说明
complete(res: CallbackResult) => void接口调用结束的回调函数(调用成功、失败都会执行)
fail(res: CallbackResult) => void接口调用失败的回调函数
success(res: CallbackResult) => void接口调用成功的回调函数

StartOption#

参数类型必填说明
complete(res: CallbackResult) => void接口调用结束的回调函数(调用成功、失败都会执行)
fail(res: CallbackResult) => void接口调用失败的回调函数
success(res: CallbackResult) => void接口调用成功的回调函数

StartPreviewOption#

参数类型必填说明
complete(res: CallbackResult) => void接口调用结束的回调函数(调用成功、失败都会执行)
fail(res: CallbackResult) => void接口调用失败的回调函数
success(res: CallbackResult) => void接口调用成功的回调函数

StopOption#

参数类型必填说明
complete(res: CallbackResult) => void接口调用结束的回调函数(调用成功、失败都会执行)
fail(res: CallbackResult) => void接口调用失败的回调函数
success(res: CallbackResult) => void接口调用成功的回调函数

StopBGMOption#

参数类型必填说明
complete(res: CallbackResult) => void接口调用结束的回调函数(调用成功、失败都会执行)
fail(res: CallbackResult) => void接口调用失败的回调函数
success(res: CallbackResult) => void接口调用成功的回调函数

StopPreviewOption#

参数类型必填说明
complete(res: CallbackResult) => void接口调用结束的回调函数(调用成功、失败都会执行)
fail(res: CallbackResult) => void接口调用失败的回调函数
success(res: CallbackResult) => void接口调用成功的回调函数

SwitchCameraOption#

参数类型必填说明
complete(res: CallbackResult) => void接口调用结束的回调函数(调用成功、失败都会执行)
fail(res: CallbackResult) => void接口调用失败的回调函数
success(res: CallbackResult) => void接口调用成功的回调函数

ToggleTorchOption#

参数类型必填说明
complete(res: CallbackResult) => void接口调用结束的回调函数(调用成功、失败都会执行)
fail(res: CallbackResult) => void接口调用失败的回调函数
success(res: CallbackResult) => void接口调用成功的回调函数

API 支持度#

API微信小程序H5React 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✔️