LivePusherContext.applyBlusherStickMakeup(Object object)

从基础库 2.14.0 开始支持,低版本需要做兼容处理。

以 Promise 风格调用:不支持

微信小程序插件:不支持

功能描述

添加腮红美妆特效

参数

Object object

属性 类型 默认值 必填 说明
alpha number 是 上色程度,取值范围 0-1
path string 是 左腮红资源路径
blendMode string 是
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)

LivePusherContext

相关文档: live-pusher 组件

LivePusherContext 实例,可通过 wx.createLivePusherContext 获取。

LivePusherContext 与页面内唯一的 live-pusher 组件绑定,用于操作对应的 live-pusher 组件。

方法

LivePusherContext.start()

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

LivePusherContext.stop()

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

LivePusherContext.pause()

暂停推流

LivePusherContext.resume()

恢复推流

LivePusherContext.switchCamera()

切换前后摄像头

LivePusherContext.snapshot(Object object)

进行快照

LivePusherContext.toggleTorch()

切换手电筒

LivePusherContext.playBGM(Object object)

播放背景音

LivePusherContext.stopBGM()

停止背景音

LivePusherContext.pauseBGM()

暂停背景音

LivePusherContext.resumeBGM()

恢复背景音

LivePusherContext.setBGMVolume(Object object)

设置背景音音量

LivePusherContext.setMICVolume(Object object)

设置麦克风音量

LivePusherContext.startPreview()

开启摄像头预览

LivePusherContext.stopPreview()

关闭摄像头预览

LivePusherContext.sendMessage(Object object)

发送 SEI 消息

LivePusherContext.exitPictureInPicture()

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

LivePusherContext.setZoom(Object object)

设置缩放级别

LivePusherContext.getMaxZoom()

获取最大缩放级别

LivePusherContext.applyFilter(Object object)

添加滤镜效果

LivePusherContext.clearFilters()

清除所有滤镜效果

LivePusherContext.applySticker(Object object)

添加贴纸特效

LivePusherContext.clearStickers()

清除所有贴纸特效

LivePusherContext.applyLipStickMakeup(Object object)

添加口红美妆特效

LivePusherContext.applyEyeShadowMakeup(Object object)

添加眼影美妆特效

LivePusherContext.applyBlusherStickMakeup(Object object)

添加腮红美妆特效

LivePusherContext.applyFaceContourMakeup(Object object)

添加修容美妆特效

LivePusherContext.applyEyeBrowMakeup(Object object)

添加眉毛美妆特效

LivePusherContext.clearMakeups()

清除所有美妆特效

LivePusherContext.onCustomRendererEvent(string event, LivePusherContext.customRendererFrameEventCallback|LivePusherContext.customRendererUpdateEventCallback callback)

开启自定义渲染后,开发者可通过此方法订阅相关事件,客户端 8.0.31 版本开始支持。

LivePusherContext.createOffscreenCanvas(object options)

创建一个能够承接 LivePusher 采集纹理的离屏 Canvas,客户端 8.0.31 版本开始支持。

示例代码

在开发者工具中预览效果

LivePlayerContext.switchCasting(Object object)

从基础库 2.32.0 版本开始支持,低版本需要做兼容处理。

以 Promise 风格调用:不支持

微信小程序插件:支持

限制:仅在点击行为时调用

相关文档: live-player 组件

功能描述

切换投屏设备。仅支持在 tap 事件回调内调用。

参数

Object object

属性 类型 默认值 必填 说明
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)

LivePlayerContext.stop(Object object)

以 Promise 风格调用:不支持

微信小程序插件:支持

相关文档: live-player 组件

功能描述

停止

参数

Object object

属性 类型 默认值 必填 说明
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)

LivePlayerContext.startCasting(Object object)

从基础库 2.32.0 开始支持,低版本需要做兼容处理。

以 Promise 风格调用:不支持

微信小程序插件:支持

限制:仅在点击行为时调用

相关文档: live-player 组件

功能描述

开始投屏,拉起半屏搜索设备。仅支持在 tap 事件回调内调用。

参数

Object object

属性 类型 默认值 必填 说明
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)

LivePlayerContext.snapshot(Object object)

基础库 2.7.1 开始支持,低版本需做兼容处理。

以 Promise 风格调用:不支持

微信小程序插件:支持

相关文档: live-player 组件

功能描述

截图

参数

Object object

属性 类型 默认值 必填 说明 最低版本
quality string raw 否 图片的质量 2.10.0
合法值 说明
raw 原图
compressed 压缩图
sourceType string stream 否 截取的源类型 2.25.0
合法值 说明
stream 截取视频源
view 截取渲染后的画面
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)

object.success 回调函数

参数
Object res
属性 类型 说明
tempImagePath string 图片文件的临时路径 (本地路径)
width string 图片的宽度
height string 图片的高度

LivePlayerContext.resume(Object object)

从基础库 1.9.90 开始支持,低版本需要做兼容处理。

以 Promise 风格调用:不支持

微信小程序插件:支持

相关文档: live-player 组件

功能描述

恢复

参数

Object object

属性 类型 默认值 必填 说明
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)

LivePlayerContext.requestFullScreen(Object object)

以 Promise 风格调用:不支持

微信小程序插件:支持

相关文档: live-player 组件

功能描述

进入全屏

参数

Object object

属性 类型 默认值 必填 说明
direction number 0 否 设置全屏时的方向
合法值 说明
0 正常竖向
90 屏幕逆时针90度
-90 屏幕顺时针90度
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)

LivePlayerContext.reconnectCasting(Object object)

从基础库 2.32.0 开始支持,低版本需做兼容处理。

以 Promise 风格调用:不支持

微信小程序插件:支持

限制:仅在点击行为时调用

相关文档: live-player 组件

功能描述

重连投屏设备。仅支持在 tap 事件回调内调用。

参数

Object object

属性 类型 默认值 必填 说明
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)