- 当前 Bug 的表现(可附上截图)
iphone6手机端点击切换闪光灯,无反应,控制台提示"operateLivePusher:fail", 无错误码。
安卓C8手机,切换正常。
- 预期表现
同一套代码,iphone手机端正常切换闪光灯。
- 复现路径
省略。
- 提供一个最简复现 Demo
< view class = "page-body" > < view class = "page-section tc" > < live-pusher id = "pusher" url = "rtmp://***/ford/cashi" mode = "RTC" autopush bindstatechange = "statechange" /> < view class = "btn-area" > < button bindtap = "bindStart" class = "page-body-button" type = "primary" >播放推流</ button > < button bindtap = "bindPause" class = "page-body-button" type = "primary" >暂停推流</ button > < button bindtap = "bindStop" class = "page-body-button" type = "primary" >停止推流</ button > < button bindtap = "bindResume" class = "page-body-button" type = "primary" >恢复推流</ button > < button bindtap = "bindSwitchCamera" class = "page-body-button" type = "primary" >切换前后摄像头</ button > < button bindtap = "bindToggleTorch" class = "page-body-button" type = "primary" >切换闪光灯</ button > </ view > </ view > </ view > |
Page({ onReady(res) { this .ctx = wx.createLivePusherContext( 'pusher' ) }, statechange(e) { console.log( 'live-pusher code:' , e.detail.code) }, bindStart() { this .ctx.start({ success: res => { console.log( 'start success' ) }, fail: res => { console.log( 'start fail' ) } }) }, bindPause() { this .ctx.pause({ success: res => { console.log( 'pause success' ) }, fail: res => { console.log( 'pause fail' ) } }) }, bindStop() { this .ctx.stop({ success: res => { console.log( 'stop success' ) }, fail: res => { console.log( 'stop fail' ) } }) }, bindResume() { this .ctx.resume({ success: res => { console.log( 'resume success' ) }, fail: res => { console.log( 'resume fail' ) } }) }, bindSwitchCamera() { this .ctx.switchCamera({ success: res => { console.log( 'switchCamera success' ) }, fail: res => { console.log( 'switchCamera fail' ) } }) }, bindToggleTorch() { this .ctx.toggleTorch({ success: res => { console.log( 'toggleTorch success' ) }, fail: res => { console.log( 'toggleTorch fail' , res) } }) } }) |
需要切到后置摄像头才能打开闪光灯
感谢解答!刚才验证了,iPhone下的确需要后置摄像头,才能开启闪光灯。
按照教程提供下代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
代码片段已经提交