config.js 3.64 KB
const operateBtns = {
  fullscreen: true,
  screenshot: false,
  play: true,
  audio: true,
  ptz: true, // 云台
  zoom: true,// 电子放大
  performance: true, // 视频流信息展示
  record: true, // 录制
  scale: true, // 显示模式:拉伸、缩放、正常
  quality: false, // 视频清晰度
};

const extendOperateBtns = [];

export function getPlayerConfig () {
  return {
    decoder: '/jessibuca-pro/decoder-pro.js',
    text: '', // TODO: 功能暂不清楚
    keepScreenOn: true, // 屏幕常亮
    isResize: false,
    isNotMute: false,
    debug: false, // 是否开启控制台调试打印

    // 播放相关
    videoBuffer: 0.1, // 缓存时长
    videoBufferDelay: 0.2, // 缓存延迟(延迟超过会触发丢帧)
    // TODO: 是否通过浏览器API判断是否支持后,再赋值true或false
    // useMSE: false,
    // useWCS: checkSupportWCSHevc(),
    // useWCS: false,
    // useSIMD: checkSupportSIMD(),
    // wcsUseVideoRender: checkSupportWCSHevc(),
    useWebFullScreen: false, // ios可能不支持系统级别全屏,可能要使用此配置
    timeout: 10, // 在连接成功之前(loading)和播放中途(heart),如果超过设定时长无数据返回,则回调timeout事件

    // 按钮和界面
    loadingText: '加载中...',
    controlAutoHide: true,
    supportDblclickFullscreen: false,
    showBandwidth: true, // 显示网速
    // angle fontSize fontFamily
    fullscreenWatermarkConfig: {
      opacity: 0.3,
      text: '',
    },
    operateBtns,
    extendOperateBtns: [],
    showPerformance: false, // 显示性能
    qualityConfig: ['标清', '高清'],


    // 云台控制
    ptzClickType: 'mouseDownAndUp', // click mouseDownAndUp
    ptzZoomShow: true,
    ptzMoreArrowShow: true,
    // ptzApertureShow: true, // 光圈
    ptzFocusShow: true,
  }
}

export function getRotateConfig() {
  return {
    name: 'rotate',
    index: 1,
    icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMi40ODQzOCIgeT0iNi40ODQzOCIgd2lkdGg9IjEyLjAzMTIiIGhlaWdodD0iOC4wMzEyNSIgcng9IjAuODA3MjkyIiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjAuOTY4NzUiLz4KPHBhdGggZD0iTTcuMzQ4NDMgMi42OTcwN0w0LjgzNTM0IDQuMTE3NTNMNC44NjE3MyAxLjIzMDlMNy4zNDg0MyAyLjY5NzA3WiIgZmlsbD0id2hpdGUiLz4KPHBhdGggZD0iTTQuOTk2MjYgMi4xOTMzOEMzLjc5MTU2IDIuMjQwMDEgMi42NDQyNyAyLjcyMDM1IDEuNzY1NyAzLjU0NTkzQzAuODg3MTI2IDQuMzcxNTEgMC4zMzY0MzQgNS40ODY3NCAwLjIxNTA0OCA2LjY4NjIxTDEuNDA4OTUgNi44MDcwM0MxLjUwMTIgNS44OTU0MyAxLjkxOTczIDUuMDQ3ODYgMi41ODc0NCA0LjQyMDQyQzMuMjU1MTYgMy43OTI5OCA0LjEyNzEgMy40Mjc5MiA1LjA0MjY3IDMuMzkyNDhMNC45OTYyNiAyLjE5MzM4WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',
    iconTitle: '旋转',
    click: this.rotate,
  }
}

export function getMirrorRotate() {
  return {
    name: 'mirrorRotate',
    index: 2,
    icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAuNTIwOTcgMTQuNjY2N0w1LjY2NjY3IDMuNTE3NjZWMTQuNjY2N0gwLjUyMDk3WiIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIwLjY2NjY2NyIvPgo8cGF0aCBkPSJNMTUuNDc5IDE0LjY2NjdMMTAuMzMzMyAzLjUxNzY2VjE0LjY2NjdIMTUuNDc5WiIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIwLjY2NjY2NyIvPgo8cGF0aCBkPSJNOCAxVjE1IiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjAuNTMzMzMzIi8+Cjwvc3ZnPgo=',
    iconTitle: '镜像',
    click: this.mirrorRotate,
  }
}

export function getPlaybackConfig() {
  return {
    controlType: 'simple',
    showRateBtn: true,
    rateConfig: [
      { label: '0.5x', value: 0.5 },
      { label: '1x', value: 1 },
      { label: '2x', value: 2 },
      { label: '4x', value: 4 },
    ],
  }
}