微信小程序动态设置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)
设置背景音音量
而

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

data:

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