export function fullScreen(isFullScreen) {
    if (!isFullScreen) {
      // 退出全屏
      if (document.exitFullScreen) {
        document.exitFullScreen();
      } else if (document.mozCancelFullScreen) {
        document.mozCancelFullScreen();
      } else if (document.webkitExitFullscreen) {
        document.webkitExitFullscreen();
      } else if (document.msExitFullscreen) {
        document.msExitFullscreen();
      }
    } else {
      // 全屏
      var el = document.documentElement;
      var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen;
      if (typeof rfs != "undefined" && rfs) {
        rfs.call(el);
      }
    }
  }


  /**
 * @description: 全屏函数
 * @param { String } videoDom - 节点
 * @param { Boolean } isFullScreen - 当前状态
 */
export function eleFullScreen(videoDom, isFullScreen) {
    videoDom = videoDom || document.documentElement
    if (!videoDom) {
      throw new Error(`请配置 fullScreenNode 属性`)
    }
    if (isFullScreen) {
      if (videoDom.requestFullscreen) {
        videoDom.requestFullscreen()
      } else if (videoDom.webkitRequestFullScreen) {
        videoDom.webkitRequestFullScreen()
      } else if (videoDom.mozRequestFullScreen) {
        videoDom.mozRequestFullScreen()
      } else {
        videoDom.msRequestFullscreen()
      }
    } else {
      if (document.exitFullscreen) {
        document.exitFullscreen()
      } else if (document.mozCancelFullScreen) {
        document.mozCancelFullScreen()
      } else if (document.msExitFullscreen) {
        document.msExiFullscreen()
      } else if (document.webkitCancelFullScreen) {
        document.webkitCancelFullScreen()
      }
    }
  }
  
  // 检查全屏状态
  export function checkFull() {
    var isFull =
      document.mozFullScreen ||
      document.fullScreen ||
      document.webkitIsFullScreen ||
      document.webkitRequestFullScreen ||
      document.mozRequestFullScreen ||
      document.msFullscreenEnabled
    if (isFull === undefined) {
      isFull = false
    }
    return isFull
  }