live-player 在 Component中,无法调用play等方法
发布于 5 年前 作者 funa 5093 次浏览 来自 问答

wxml

<live-player id=“player” src=“地址测试过可用” mode=“RTC” autoplay />

<button bindtap=“bindPlay”>播放</button>

js

Component({

ready:function(res){

this.ctx = wx.createLivePlayerContext(‘player’)

},

methods: {

bindPlay() {

this.ctx.play({

success: res => {

console.log(‘play success’)

},

fail: res => {

console.log(res)

}

})

}

}

})

调用play方法,没有任何反应

3 回复

遇到同样的问题,在自定义组件中无法调用live-play的各项方法:play、stop等方法,调用时不会报错,但无效。

如果把live-play设置为自动播放,则可以正常播放,但同样无法调用stop方法停止播放。

你好,请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

live-player-bug

live-player 在自定义组件Component中调用 live-player的play方法没有反应。

机型:小米note2

微信版本号:6.6.6

在微信小程序开发工具中也有同样的问题

代码片段链接

wechatide://minicode/9FSWCnml6rZ8

回到顶部