小程序
小游戏
企业微信
微信支付
扫描小程序码分享
ios 正常连接播放安卓 老是无法连接服务器,基本上 10次 才有可能成功 1次
debug 后发现 调用了 videoContext.play() 方法,但是onPlayEvent 这个监听状态的方法一直没有响应,
ios小程序端 每次都有响应 ,
所以有没有监听 videoContext.play() 是否调用成功 的方法或者成功回调方法
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
最终方案写了一个重连
/**
* 直播网络状态
*/
onPlayStatus: function(e) {
relinkStatus = 1;
},
* 重连
relinkPlay: function() {
var that = this;
var relink = setInterval(function() {
if (relinkStatus) {
//清除定时器
clearInterval(relink);
}else{
//重新连接
that.data.videoContext.stop();
that.data.videoContext.play();
}
}, 4000) //4 秒重连一次
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
最终方案写了一个重连
/**
* 直播网络状态
*/
onPlayStatus: function(e) {
relinkStatus = 1;
},
/**
* 重连
*/
relinkPlay: function() {
var that = this;
var relink = setInterval(function() {
if (relinkStatus) {
//清除定时器
clearInterval(relink);
}else{
//重新连接
that.data.videoContext.stop();
that.data.videoContext.play();
}
}, 4000) //4 秒重连一次
},
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)