Skip to main content
Version: 下个版本

LivePlayerContext

LivePlayerContext 实例,可通过 Taro.createLivePlayerContext 获取。 LivePlayerContext 通过 id 跟一个 live-player 组件绑定,操作对应的 live-player 组件。

支持情况:

参考文档

方法​

exitFullScreen​

退出全屏

支持情况:

参考文档

(option?: ExitFullScreenOption) => void
参数类型
optionExitFullScreenOption

exitPictureInPicture​

退出小窗,该方法可在任意页面调用

支持情况:

参考文档

(option?: ExitPictureInPictureOption) => void
参数类型
optionExitPictureInPictureOption

mute​

静音

支持情况:

参考文档

(option?: MuteOption) => void
参数类型
optionMuteOption

pause​

暂停

支持情况:

参考文档

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

play​

播放

支持情况:

参考文档

(option?: PlayOption) => void
参数类型
optionPlayOption

requestFullScreen​

进入全屏

支持情况:

参考文档

(option: RequestFullScreenOption) => void
参数类型
optionRequestFullScreenOption

requestPictureInPicture​

进入全屏

支持情况:

参考文档

(option: RequestPictureInPictureOption) => void
参数类型
optionRequestPictureInPictureOption

resume​

恢复

支持情况:

参考文档

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

snapshot​

截图

支持情况:

参考文档

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

stop​

停止

支持情况:

参考文档

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

参数​

ExitFullScreenOption​

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

ExitPictureInPictureOption​

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

MuteOption​

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

PauseOption​

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

PlayOption​

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

RequestFullScreenOption​

参数类型必填说明
complete(res: TaroGeneral.CallbackResult) => void否接口调用结束的回调函数(调用成功、失败都会执行)
direction0 or 90 or -90否设置全屏时的方向

可选值:
- 0: 正常竖向;
- 90: 屏幕逆时针90度;
- -90: 屏幕顺时针90度;
fail(res: TaroGeneral.CallbackResult) => void否接口调用失败的回调函数
success(res: TaroGeneral.CallbackResult) => void否接口调用成功的回调函数

RequestPictureInPictureOption​

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

ResumeOption​

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

SnapshotOption​

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

SnapshotSuccessCallbackResult​

参数类型说明
heightstring图片的高度
tempImagePathstring图片文件的临时路径
widthstring图片的宽度
errMsgstring调用结果

StopOption​

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

API 支持度​

API微信小程序H5React Native
LivePlayerContext✔️
LivePlayerContext.exitFullScreen✔️
LivePlayerContext.exitPictureInPicture✔️
LivePlayerContext.mute✔️
LivePlayerContext.pause✔️
LivePlayerContext.play✔️
LivePlayerContext.requestFullScreen✔️
LivePlayerContext.requestPictureInPicture✔️
LivePlayerContext.resume✔️
LivePlayerContext.snapshot✔️
LivePlayerContext.stop✔️