live-player 插件安卓端老是连接不上?
发布于 5 年前 作者 yixiuying 11994 次浏览 来自 官方Issues

ios   正常连接播放
安卓 老是无法连接服务器,基本上 10次 才有可能成功 1次

debug 后发现  调用了 videoContext.play() 方法,但是onPlayEvent 这个监听状态的方法一直没有响应,

ios小程序端 每次都有响应 ,

所以有没有监听 videoContext.play() 是否调用成功 的方法或者成功回调方法

2 回复

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段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 秒重连一次

 },

回到顶部