LivePlayerContext¶
- wx.createLivePlayerContext(id, this)¶
 1.7.0 新版功能: 低版本需做 兼容处理 。
创建 live-player 上下文 LivePlayerContext 对象。
- 参数
 id (
string()) – <live-player> 组件的 idthis (
Object()) – 在自定义组件下,当前组件实例的this,以操作组件内 <live-player> 组件
- 返回
 
- class LivePlayerContext()¶
 LivePlayerContext 实例,可通过
wx.createLivePlayerContext()获取。livePlayerContext 通过 id 跟一个 <live-player> 组件绑定,操作对应的 <live-player> 组件。
方法¶
- LivePlayerContext.play({[success][, fail][, complete]})¶
 播放
- 参数
 success (
function()) – 接口调用成功的回调函数fail (
function()) – 接口调用失败的回调函数complete (
function()) – 接口调用结束的回调函数(调用成功、失败都会执行)
- LivePlayerContext.stop({[success][, fail][, complete]})¶
 停止
- 参数
 success (
function()) – 接口调用成功的回调函数fail (
function()) – 接口调用失败的回调函数complete (
function()) – 接口调用结束的回调函数(调用成功、失败都会执行)
- LivePlayerContext.mute({[success][, fail][, complete]})¶
 静音
- 参数
 success (
function()) – 接口调用成功的回调函数fail (
function()) – 接口调用失败的回调函数complete (
function()) – 接口调用结束的回调函数(调用成功、失败都会执行)
- LivePlayerContext.pause({[success][, fail][, complete]})¶
 暂停
- 参数
 success (
function()) – 接口调用成功的回调函数fail (
function()) – 接口调用失败的回调函数complete (
function()) – 接口调用结束的回调函数(调用成功、失败都会执行)
- LivePlayerContext.resume({[success][, fail][, complete]})¶
 1.9.90 新版功能: 低版本需做 兼容处理
恢复
- 参数
 success (
function()) – 接口调用成功的回调函数fail (
function()) – 接口调用失败的回调函数complete (
function()) – 接口调用结束的回调函数(调用成功、失败都会执行)
- LivePlayerContext.requestFullScreen({[direction][, success][, fail][, complete]})¶
 进入全屏
- 参数
 direction (
number()) –0设置全屏时的方向0 正常竖向
90 屏幕逆时针90度
-90 屏幕顺时针90度
success (
function()) – 接口调用成功的回调函数fail (
function()) – 接口调用失败的回调函数complete (
function()) – 接口调用结束的回调函数(调用成功、失败都会执行)
- LivePlayerContext.exitFullScreen({[success][, fail][, complete]})¶
 退出全屏
- 参数
 success (
function()) – 接口调用成功的回调函数fail (
function()) – 接口调用失败的回调函数complete (
function()) – 接口调用结束的回调函数(调用成功、失败都会执行)
示例代码