langhuihui / jessibuca

Jessibuca是一款开源的纯H5直播流播放器
https://jessibuca.com
GNU General Public License v3.0
2.19k stars 410 forks source link

使用了最新的版本多屏播放,只有一路能够正常播放,其他的页面打开后就卡着不会动,过一会会消失。 #225

Closed yu1183688986 closed 2 years ago

yu1183688986 commented 2 years ago

而且将视频组件关闭后再重新打开画面也是卡着不动,必须将页面重新加载一次后,第一次打开的才正常播放,后面打开的也是卡着不动。 一下是我的配置

var jessibucaConfig = {
    videoBuffer : 1, // 最大缓冲时长,单位秒
    isResize : true,
    decoder : "/v2c/statics/plugins/jessibuca/decoder.js",
    timeout : 60,
    // text: "WVP-PRO",
    // background: "bg.jpg",
    loadingText : "加载中",
    hasAudio : true, //typeof (this.hasAudio) =="undefined"? true: this.hasAudio,
    debug : true,
    supportDblclickFullscreen : true, // 是否支持屏幕的双击事件,触发全屏,取消全屏事件。
    showBandwidth: true,//显示网速
    operateBtns : {
        fullscreen : true,
        screenshot : true,
        play : false,
        audio : true,
    },
    isFlv: true,
    //record : "record",
    //vod : true,
    forceNoOffscreen : true,
    isNotMute : false,
};
for(var j=0;j<4;j++){
    var _jessibuca = new Jessibuca($.extend(jessibucaConfig,{
        container:document.getElementById("myVideodiv"+j)
    }));
    //_jessibuca.clearView();
    //禁止画面拉伸
    _jessibuca.setScaleMode(1);
    jessibucaObj[j] = _jessibuca;
}

现象如下: msedge_EiffVCa329

bosscheng commented 2 years ago

看下控制台有没有异常信息。

yu1183688986 commented 2 years ago

看下控制台有没有异常信息。

控制台没有报啥错,警告提示和正常播放的是一样。 image

bosscheng commented 2 years ago

http://jessibuca.monibuca.com/2x2-demo.html 把你的播放地址,在这个上面测试看下呢

yu1183688986 commented 2 years ago

http://jessibuca.monibuca.com/2x2-demo.html 把你的播放地址,在这个上面测试看下呢

这个demo走官网播放有跨域问题,我自己拉到本地放了放是可以的,就是有一个2k h265编码的视频比较卡顿,四屏都能播放出来;另外这个demo有个bug,就是四屏的url在定时器中获取url参数往往都是获取的是最后一个,所以每次url四屏都是播放的第四个取流地址,我给修改了一下,建议作者更新一下:

$player.addEventListener('click', function () {
        for (let i = 0; i < 4; i++) {
            var id = i + 1;
            var $playHref = document.getElementById('playUrl' + id);
            let player = playList[i];
            if ($playHref.value) {
                setTimeout((url) => {
                    player && player.play(url).then(() => {

                    }).catch((e) => {
                        console.error(e);
                    });
                }, 0,$playHref.value)
            }
        }

        $player.style.display = 'none';
        $pause.style.display = 'inline-block';
        $destroy.style.display = 'inline-block';
    }, false)

如下是效果,其中第三路是2k+h265 msedge_ELvONjy98O 我对比了一下我项目代码唯一有区域的就是这个jessibuca的引入方式,以及配置里面我自己给的decoder路径没有走默认加载;

var jessibucaConfig = {
    videoBuffer : 1, // 最大缓冲时长,单位秒
    isResize : true,
    decoder : "/v2c/statics/plugins/jessibuca/decoder.js",
    timeout : 60,
    // text: "WVP-PRO",
    // background: "bg.jpg",
    loadingText : "加载中",
    hasAudio : true, //typeof (this.hasAudio) =="undefined"? true: this.hasAudio,
    debug : false,
    supportDblclickFullscreen : true, // 是否支持屏幕的双击事件,触发全屏,取消全屏事件。
    showBandwidth: true,//显示网速
    operateBtns : {
        fullscreen : true,
        screenshot : true,
        play : false,
        audio : true,
    },
    isFlv: true,
    //record : "record",
    //vod : true,
    forceNoOffscreen : true,
    isNotMute : false,
};

看看是不是这块问题呢?

bosscheng commented 2 years ago

for(var j=0;j<4;j++){ var _jessibuca = new Jessibuca($.extend(jessibucaConfig,{ container:document.getElementById("myVideodiv"+j) })); //_jessibuca.clearView(); //禁止画面拉伸 _jessibuca.setScaleMode(1); jessibucaObj[j] = _jessibuca; } 用settimeout包裹下。