let flvPlayerRef1 = document.getElementById("largeVideo");//获取创建dom
let flvPlayerObjM1 = flvjs.createPlayer(
  {

    type: "flv",
    isLive: true, //是否直播
    url: vm.flvStr, //地址
    hasAudio: true,
    hasVideo: true,
  },
  {

    cors: true, // 是否跨域
    stashInitialSize: 384, // 缓存大小(kb) 默认384kb
    enableStashBuffer: true, // 是否启用缓存
    autoCleanupMaxBackwardDuration: 3 * 60,//自动清除缓存时间
    enableWorker: false, // 是否多线程工作
    autoCleanupSourceBuffer: true, // 是否自动清理缓存
    fixAudioTimestampGap: true,//音视频同步
  })
flvPlayerObjM1.load(); //加载
flvPlayerObjM1.play(); //播放

// flvjs.Events.STATISTICS_INFO 信息出错销毁直播流
flvPlayerRef1.on(flvjs.Events.STATISTICS_INFO, function (res) {

  flvPlayerObjM1.pause();
  flvPlayerObjM1.unload();
  flvPlayerObjM1.detachMediaElement();
  flvPlayerObjM1.destroy();
  flvPlayerObjM1 = null;
});
// flvjs.Events.ERROR 断流报错销毁
flvPlayerRef1.on(
  flvjs.Events.ERROR,
  (errorType, errorDetail, errorInfo) => {

    console.log("errorType:", errorType);
    console.log("errorDetail:", errorDetail);
    console.log("errorInfo:", errorInfo);
    flvPlayerObjM1.pause();
    flvPlayerObjM1.unload();
    flvPlayerObjM1.detachMediaElement();
    flvPlayerObjM1.destroy();
    flvPlayerObjM1 = null;
  }
);
// flvjs.Events.VIDEO_FROZEN视频卡顿监听
flvPlayerRef1.on(
  flvjs.Events.VIDEO_FROZEN,
  (errorType, errorDetail, errorInfo) => {

    console.log("errorType:", errorType);
    console.log("errorDetail:", errorDetail);
    console.log("errorInfo:", errorInfo);
    flvPlayerObjM1.pause();
    flvPlayerObjM1.unload();
    flvPlayerObjM1.detachMediaElement();
    flvPlayerObjM1.destroy();
    flvPlayerObjM1 = null;
  }
);