VideoPlay循环播放多条远端视频时,有小概率播着播着不播了

  • Creator 版本: 2.4.5

  • 目标平台: Android /谷歌浏览器

  • 重现方式:循环播放远端视频链接有小概率出现播着播着卡住了

  • 首个报错: 无报错

  • 之前哪个版本是正常的:

  • 手机型号:

  • 手机浏览器:

  • 编辑器操作系统:

  • 重现概率: 播6条视频重复来回五六次触发一次吧

const { ccclass, property } = cc._decorator;

@ccclass

export default class NewClass extends cc.Component {

private videoList = [];

   

private vIndex = 0;

@property(cc.Node)

vNode: cc.Node = null;

@property(cc.Label)

lNode: cc.Label = null;

onLoad() {

    this.vNode.on('ready-to-play', this.isread.bind(this), this);

    this.vNode.on('error', this.onErrorBack.bind(this), this);

    this.vNode.on('completed', this.play.bind(this), this);

    this.vNode.on('meta-loaded', this.isReadyplay.bind(this), this);

}

start() {

    this.lNode.getComponent(cc.Label).string = this.videoList[this.vIndex].videoPath;

    this.vNode.getComponent(cc.VideoPlayer).remoteURL = this.videoList[this.vIndex].videoPath;

    this.vNode.getComponent(cc.VideoPlayer).play();

}

/**准备好去播放了 */

private isread(): void {

    console.log('ready-to-play');

    this.vNode.getComponent(cc.VideoPlayer).play();

}

private onErrorBack(): void {

    console.log('error');

}

/**

* 视频播放完成回调

*/

play(): void {

    this.vIndex++;

    if (this.vIndex >= this.videoList.length) {

        console.error('end');

        return;

    }

    this.lNode.getComponent(cc.Label).string = this.videoList[this.vIndex].videoPath;

    // this.vNode.getComponent(cc.VideoPlayer).remoteURL = '';

    this.vNode.getComponent(cc.VideoPlayer).remoteURL = this.videoList[this.vIndex].videoPath;

}

/**准备好去播放了 */

private isReadyplay(): void {

    console.log('meta-loaded');

}

}
DEMO 脚本 Label只是确认是那个视频的可以忽视videoList 里放远端视频链接,因为我这边是公司内部的不好提供,我这边能明确的是触发卡住的时候meta-loaded是触发了的但是ready-to-play是没有触发的,安卓端长时间这样卡住后就会提示系统级的弹窗说无反应,问你是等待还是关闭