console.log('android video js load');
var vi = document.getElementsByTagName('video');

document.addEventListener('fullscreenchange',wrappedFscrFunc,false)
document.addEventListener('webkitfullscreenchange',wrappedFscrFunc,false)


function wrappedFscrFunc(e){
      var fullElement = isFullscreen()
      if(fullElement){
        console.log('test: has full');
        console.log(fullElement.nodeName)
        var isVideo = fullElement.nodeName == "VIDEO"
        if(isVideo){
        //正常来说，都是走这边，element为video
            console.log(fullElement.videoWidth);
            console.log(fullElement.videoHeight);
            QFH5.fullVideoSize(fullElement.videoWidth,fullElement.videoHeight);
        }else{
        //特殊情况，如德乡仪陇的首页短视频栏目，element是DIV
            findVideoElement(fullElement)
        }
      }else{
          console.log('test: not full');
      }
};

function findVideoElement(parent){
  // 获取 NodeIterator 对象
  let t = document.createNodeIterator(parent, NodeFilter.SHOW_ELEMENT, null, false)
  // 循环遍历对象的下一个节点
  let currNode = null
  while((currNode = t.nextNode()) !== null) {
    // 节点不为空，就一直循环遍历下去；直到为 null，才中断循环
    console.log(currNode)
    if(currNode.nodeName == "VIDEO"){
        QFH5.fullVideoSize(currNode.videoWidth,currNode.videoHeight)
        return
    }
  }
}


//获取当前全屏的Element
function isFullscreen(){
 return document.fullscreenElement ||
  document.msFullscreenElement  ||
  document.mozFullScreenElement ||
  document.webkitFullscreenElement || false;
}

