微信小程序动态设置live-pusher/live-player属性

最近开发小程序视频会议,发现通过api wx.createLivePusherContext() 创建LivePusherContext之后,只能暂停背景音,或者切换摄像头,并没有关闭摄像头而打开背景音的方法:

方法

LivePusherContext.start()

播放推流

LivePusherContext.stop()

停止推流

LivePusherContext.pause()

暂停推流

LivePusherContext.resume()

恢复推流

LivePusherContext.switchCamera()

切换前后摄像头

LivePusherContext.snapshot()

快照

LivePusherContext.toggleTorch()

切换

LivePusherContext.playBGM(Object object)

播放背景音

LivePusherContext.stopBGM()

停止背景音

LivePusherContext.pauseBGM()

暂停背景音

LivePusherContext.resumeBGM()

恢复背景音

LivePusherContext.setBGMVolume(Object object)

设置背景音音量

组件的属性中是有enable-camera这个属性的,并且组件的推流url也是通过双向数据绑定来动态添加上去的;

于是想到通过双向数据绑定给组件动态添加属性,从而通过修改live-pusher的属性达到开关摄像头的目的:

wxml:

 

data:

同样的道理,live-player也可以这样操作


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部