微信小程序API 实时音视频·LivePlayerContext实例
LivePlayerContextLivePlayerContext 实例,可通过 wx.createLivePlayerContext 获取。
LivePlayerContext 通过 id 跟一个 live-player 组件绑定,操作对应的 live-player 组件。
方法:
LivePlayerContext.exitFullScreen(Object object)
退出全屏
参数
Object object
属性 类型 默认值 必填 说明
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)
LivePlayerContext.exitPictureInPicture(Object object)
退出小窗,该方法可在任意页面调用
参数
Object object
属性 类型 默认值 必填 说明
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)
LivePlayerContext.mute(Object object)
静音
参数
Object object
属性 类型 默认值 必填 说明
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)
LivePlayerContext.pause(Object object)
基础库 1.9.90 开始支持,低版本需做兼容处理。
暂停
参数
Object object
属性 类型 默认值 必填 说明
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)
LivePlayerContext.play(Object object)
播放
参数
Object object
属性 类型 默认值 必填 说明
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)
LivePlayerContext.requestFullScreen(Object object)
进入全屏
参数
Object object
属性 类型 默认值 必填 说明
direction number 0 否 设置全屏时的方向
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)
object.direction 的合法值
值 说明 最低版本
0 正常竖向
90 屏幕逆时针90度
-90 屏幕顺时针90度
LivePlayerContext.resume(Object object)
基础库 1.9.90 开始支持,低版本需做兼容处理。
恢复
参数
Object object
属性 类型 默认值 必填 说明
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)
LivePlayerContext.snapshot(string quality)
基础库 2.7.1 开始支持,低版本需做兼容处理。
截图
参数
string quality
基础库 2.10.0 开始支持,低版本需做兼容处理。
图片的质量,默认原图。有效值为 raw、compressed
LivePlayerContext.stop(Object object)
停止
参数
Object object
属性 类型 默认值 必填 说明
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)
页:
[1]