tencent cloud

文档反馈

实时音视频

最后更新时间:2024-03-04 23:01:18

    createLivePusherContext

    该 API 使用方法为 LivePusherContext wx.createLivePusherContext()
    说明:
    基础库 1.4.96 开始支持,低版本需做兼容处理。
    功能说明:创建 live-pusher 上下文 LivePusherContext 对象。
    返回值:LivePusherContext

    LivePusherContext

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

    .start

    该 方法 使用方式为 LivePusherContext.start(Object object)
    功能说明:开始推流,同时开启摄像头预览。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .stop

    该 方法 使用方式为 LivePusherContext.stop(Object object)
    功能说明:停止推流,同时停止摄像头预览。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .pause

    该 方法 使用方式为 LivePlayerContext.pause(Object object)
    功能说明:暂停推流。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .resume

    该 方法 使用方式为 LivePusherContext.resume(Object object)
    功能说明:恢复推流。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .switchCamera

    该 方法 使用方式为 LivePusherContext.switchCamera(Object object)
    功能说明:切换前后摄像头。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .snapshot

    该 方法 使用方式为 LivePusherContext.snapshot(Object object)
    功能说明:快照。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .toggleTorch

    该 方法 使用方式为 LivePusherContext.toggleTorch(Object object)
    功能说明:切换手电筒。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .playBGM

    该 方法 使用方式为 LivePusherContext.playBGM(Object object)
    功能说明:播放背景音。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    url
    String
    -
    加入背景混音的资源地址
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .stopBGM

    该 方法 使用方式为 LivePusherContext.stopBGM(Object object)
    功能说明:停止背景音。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .pauseBGM

    该 方法 使用方式为 LivePusherContext.pauseBGM(Object object)
    功能说明:暂停背景音。
    参数及说明:Object objec。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .resumeBGM

    该 方法 使用方式为 LivePusherContext.resumeBGM(Object object)
    功能说明:恢复背景音。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .setBGMPosition

    该 方法 使用方式为 LivePusherContext.setBGMPosition(Object object)
    功能说明:设置背景音进度。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    position
    Number
    -
    背景音进度,单位:秒
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .setMICVolume

    该 方法 使用方式为 LivePusherContext.setMICVolume(Object object)
    功能说明:设置麦克风音量。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    volume
    String
    -
    音量大小,范围是 0-1
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .setBGMVolume

    该 方法 使用方式为 LivePusherContext.setBGMVolume(Object object)
    功能说明:设置背景音量。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    volume
    String
    -
    音量大小,范围是 0-1
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .setAudioReverbType

    该 方法 使用方式为 LivePusherContext.setAudioReverbType(Object object)
    功能说明:设置混音类型。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    audioReverbType
    Number
    -
    混音类型,0 ~ 6 分别对应 "关闭混响", "KTV", "小房间", "大会堂", "低沉", "洪亮", "磁性"
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .startPreview

    该 方法 使用方式为 LivePusherContext.startPreview(Object object)
    功能说明:开启摄像头预览。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    function
    -
    接口调用成功的回调函数
    fail
    function
    -
    接口调用失败的回调函数
    complete
    function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .stopPreview

    该 方法 使用方式为 LivePusherContext.stopPreview(Object object)
    功能说明:关闭摄像头预览。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .startAudioRecord

    该 方法 使用方式为 LivePusherContext.startAudioRecord(Object object)
    功能说明:开始录音,当主动调用 LivePusherContext.stopAudioRecord 时,或者录音超过1分钟时自动结束录音。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .stopAudioRecord

    该 方法 使用方式为 LivePusherContext.stopAudioRecord(Object object)
    功能说明:结束录音。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)
    object.success 回调函数参数:Object res。
    属性
    类型
    说明
    tempFilePath
    String
    录音文件的临时路径 (本地路径)

    createLivePlayerContext

    该 API 使用方法为 LivePlayerContext wx.createLivePlayerContext(string id, Object this)
    说明:
    基础库 1.4.96 开始支持,低版本需做兼容处理。
    功能说明:创建 live-player 上下文 LivePlayerContext 对象。
    参数及说明:string id,live-player 组件的 id;Object this,在自定义组件下,当前组件实例的 this,以操作组件内 live-player 组件。
    返回值:LivePlayerContext

    LivePlayerContext

    .exitfullscreen

    该 方法 使用方式为 LivePlayerContext.exitFullScreen(Object object)
    功能说明:退出全屏。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .mute

    该 方法 使用方式为 LivePlayerContext.mute(Object object)
    功能说明:静音。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .pause

    该 方法 使用方式为 LivePlayerContext.pause(Object object)
    功能说明:暂停。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .play

    该 方法 使用方式为 LivePlayerContext.play(Object object)
    功能说明:播放。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .requestFullScreen

    该 方法 使用方式为 LivePlayerContext.requestFullScreen(Object object)
    功能说明:进入全屏。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    direction
    Number
    0
    设置全屏时的方向
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)
    object.direction 的合法值。
    说明
    0
    正常竖向
    90
    屏幕逆时针 90 度
    -90
    屏幕顺时针 90 度

    .resume

    该 方法 使用方式为 LivePlayerContext.resume(Object object)
    功能说明:恢复。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    .snapshot

    该 方法 使用方式为 LivePlayerContext.snapshot(Object object)
    功能说明:截图。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)
    object.success 回调函数参数:Object res。
    属性
    类型
    说明
    tempImagePath
    String
    图片文件的临时路径
    width
    String
    图片的宽度
    height
    String
    图片的高度

    .stop

    该 方法 使用方式为 LivePlayerContext.stop(Object object)
    功能说明:停止。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    Function
    -
    接口调用成功的回调函数
    fail
    Function
    -
    接口调用失败的回调函数
    complete
    Function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)
    
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持