//视频 var conf1 = { videoid:'h5sVideo1', protocol: window.location.protocol, //http: or https: host: '47.104.11.54:7081', //localhost:8080 rootpath:'/', // '/' or window.location.pathname token:'token1', hlsver:'v1', //v1 is for ts, v2 is for fmp4 session:'c1782caf-b670-42d8-ba90-2244d0b0ee83' //session got from login }; var conf2 = { videoid:'h5sVideo2', protocol: window.location.protocol, //http: or https: host: '47.104.11.54:7081', //localhost:8080 rootpath:'/', // '/' or window.location.pathname token:'token52', hlsver:'v1', //v1 is for ts, v2 is for fmp4 session:'c1782caf-b670-42d8-ba90-2244d0b0ee83' //session got from login }; var conf3 = { videoid:'h5sVideo3', protocol: window.location.protocol, //http: or https: host: '47.104.11.54:7081', //localhost:8080 rootpath:'/', // '/' or window.location.pathname token:'token53', hlsver:'v1', //v1 is for ts, v2 is for fmp4 session:'c1782caf-b670-42d8-ba90-2244d0b0ee83' //session got from login }; var conf4 = { videoid:'h5sVideo4', protocol: window.location.protocol, //http: or https: host: '47.104.11.54:7081', //localhost:8080 rootpath:'/', // '/' or window.location.pathname token:'token54', hlsver:'v1', //v1 is for ts, v2 is for fmp4 session:'c1782caf-b670-42d8-ba90-2244d0b0ee83' //session got from login }; var conf5 = { videoid:'h5sVideo5', protocol: window.location.protocol, //http: or https: host: '47.104.11.54:7081', //localhost:8080 rootpath:'/', // '/' or window.location.pathname token:'token5', hlsver:'v1', //v1 is for ts, v2 is for fmp4 session:'c1782caf-b670-42d8-ba90-2244d0b0ee83' //session got from login }; var conf6 = { videoid:'h5sVideo6', protocol: window.location.protocol, //http: or https: host: '47.104.11.54:7081', //localhost:8080 rootpath:'/', // '/' or window.location.pathname token:'token47', hlsver:'v1', //v1 is for ts, v2 is for fmp4 session:'c1782caf-b670-42d8-ba90-2244d0b0ee83' //session got from login }; var conf7 = { videoid:'h5sVideo7', protocol: window.location.protocol, //http: or https: host: '47.104.11.54:7081', //localhost:8080 rootpath:'/', // '/' or window.location.pathname token:'token7', hlsver:'v1', //v1 is for ts, v2 is for fmp4 session:'c1782caf-b670-42d8-ba90-2244d0b0ee83' //session got from login }; var conf8 = { videoid:'h5sVideo8', protocol: window.location.protocol, //http: or https: host: '47.104.11.54:7081', //localhost:8080 rootpath:'/', // '/' or window.location.pathname token:'token8', hlsver:'v1', //v1 is for ts, v2 is for fmp4 session:'c1782caf-b670-42d8-ba90-2244d0b0ee83' //session got from login }; var v1 = H5sPlayerCreate(conf1); var v2 = H5sPlayerCreate(conf2); var v3 = H5sPlayerCreate(conf3); var v4 = H5sPlayerCreate(conf4); var v5 = H5sPlayerCreate(conf5); var v6 = H5sPlayerCreate(conf6); var v7 = H5sPlayerCreate(conf7); var v8 = H5sPlayerCreate(conf8); var boolstate=false; //var interval=setInterval(h5setInterval,30000); h5setInterval(); function h5setInterval() { if(boolstate==false){ conf1.token="token1"; conf2.token="token52"; conf3.token="token53"; conf4.token="token54"; conf5.token="token5"; conf6.token="token47"; conf7.token="token7"; conf8.token="token8"; boolstate=true; }else { conf1.token="token7"; conf2.token="token8"; conf3.token="token9"; conf4.token="token10"; conf5.token="token11"; conf6.token="token12"; conf7.token="token47"; conf8.token="token52"; boolstate=false; } v1 = H5sPlayerCreate(conf1); v2 = H5sPlayerCreate(conf2); v3 = H5sPlayerCreate(conf3); v4 = H5sPlayerCreate(conf4); v5 = H5sPlayerCreate(conf5); v6 = H5sPlayerCreate(conf6); v7 = H5sPlayerCreate(conf7); v8 = H5sPlayerCreate(conf8); $("#h5sVideo1").attr("src",""); $("#h5sVideo2").attr("src",""); $("#h5sVideo3").attr("src",""); $("#h5sVideo4").attr("src",""); $("#h5sVideo5").attr("src",""); $("#h5sVideo6").attr("src",""); $("#h5sVideo7").attr("src",""); $("#h5sVideo8").attr("src",""); } function FullScreen(ele) {//进入全屏 if (ele .requestFullscreen) { ele .requestFullscreen(); fullscreenchange(); } else if (ele .mozRequestFullScreen) { ele .mozRequestFullScreen(); clearInterval(interval) } else if (ele .webkitRequestFullScreen) { ele .webkitRequestFullScreen(); clearInterval(interval) } } function aaa(){ if (document.fullscreenElement != null) { console.log("清除定时"); clearInterval(interval);//全屏状态,清除定时事件 XGTYlayers.visible = false; } else {//激活 console.log("恢复定时"); if(v1 != null){ v1.disconnect(); delete v1; v1 = null; $("#h5sVideo1").get(0).pause(); $("#h5sVideo1").parent().children(".playpause").fadeIn(); } if(v2 != null){ v2.disconnect(); delete v2; v2 = null; $("#h5sVideo2").get(0).pause(); $("#h5sVideo2").parent().children(".playpause").fadeIn(); } if(v3 != null){ v3.disconnect(); delete v3; v3 = null; $("#h5sVideo3").get(0).pause(); $("#h5sVideo3").parent().children(".playpause").fadeIn(); } if(v4 != null){ v4.disconnect(); delete v4; v4 = null; $("#h5sVideo4").get(0).pause(); $("#h5sVideo4").parent().children(".playpause").fadeIn(); } if(v5 != null){ v5.disconnect(); delete v5; v5 = null; $("#h5sVideo5").get(0).pause(); $("#h5sVideo5").parent().children(".playpause").fadeIn(); } if(v6 != null){ v6.disconnect(); delete v6; v6 = null; $("#h5sVideo6").get(0).pause(); $("#h5sVideo6").parent().children(".playpause").fadeIn(); } if(v7 != null){ v7.disconnect(); delete v7; v7 = null; $("#h5sVideo7").get(0).pause(); $("#h5sVideo7").parent().children(".playpause").fadeIn(); } if(v8 != null){ v8.disconnect(); delete v8; v8 = null; $("#h5sVideo8").get(0).pause(); $("#h5sVideo8").parent().children(".playpause").fadeIn(); } // interval=setInterval(h5setInterval,30000); XGTYlayers.visible = true; } } function fullscreenchange() {//监听全屏事件 document.removeEventListener("fullscreenchange",aaa); document.addEventListener("fullscreenchange", aaa); } function exitFullscreen(de) {//退出全屏 if (de.exitFullscreen) { de.exitFullscreen(); } else if (de.mozCancelFullScreen) { de.mozCancelFullScreen(); } else if (de.webkitCancelFullScreen) { de.webkitCancelFullScreen(); } else if (de.cancelFullScreen) { de.cancelFullScreen(); } } function isFullScreen () { return document.isFullScreen || document.mozIsFullScreen || document.webkitIsFullScreen } $('#h5sVideo1').parent().click(function () { if($(this).children(".h5video").get(0).paused){ FullScreen($(this)[0]); $(this).children(".h5video").get(0).play(); if(v1 != null) { v1.disconnect(); delete v1; v1 = null; } v1 = H5sPlayerCreate(conf1); v1.connect(); $(this).children(".playpause").fadeOut(); } }); $('#h5sVideo2').parent().click(function () { if($(this).children(".h5video").get(0).paused){ FullScreen($(this)[0]) $(this).children(".h5video").get(0).play(); if(v2 != null) { v2.disconnect(); delete v2; v2 = null; } v2 = H5sPlayerCreate(conf2); v2.connect(); $(this).children(".playpause").fadeOut(); } }); $('#h5sVideo3').parent().click(function () { if($(this).children(".h5video").get(0).paused){ FullScreen($(this)[0]) $(this).children(".h5video").get(0).play(); if(v3 != null) { v3.disconnect(); delete v3; v3 = null; } v3 = H5sPlayerCreate(conf3); v3.connect(); $(this).children(".playpause").fadeOut(); } }); $('#h5sVideo4').parent().click(function () { if($(this).children(".h5video").get(0).paused){ FullScreen($(this)[0]) $(this).children(".h5video").get(0).play(); if(v4 != null) { v4.disconnect(); delete v4; v4 = null; } v4 = H5sPlayerCreate(conf4); v4.connect(); $(this).children(".playpause").fadeOut(); } }); $('#h5sVideo5').parent().click(function () { if($(this).children(".h5video").get(0).paused){ FullScreen($(this)[0]) $(this).children(".h5video").get(0).play(); if(v5 != null) { v5.disconnect(); delete v5; v5 = null; } v5 = H5sPlayerCreate(conf5); v5.connect(); $(this).children(".playpause").fadeOut(); } }); $('#h5sVideo6').parent().click(function () { if($(this).children(".h5video").get(0).paused){ FullScreen($(this)[0]) $(this).children(".h5video").get(0).play(); if(v6 != null) { v6.disconnect(); delete v6; v6 = null; } v6 = H5sPlayerCreate(conf6); v6.connect(); $(this).children(".playpause").fadeOut(); } }); $('#h5sVideo7').parent().click(function () { if($(this).children(".h5video").get(0).paused){ FullScreen($(this)[0]) $(this).children(".h5video").get(0).play(); if(v7 != null) { v7.disconnect(); delete v7; v7 = null; } v7 = H5sPlayerCreate(conf7); v7.connect(); $(this).children(".playpause").fadeOut(); } }); $('#h5sVideo8').parent().click(function () { if($(this).children(".h5video").get(0).paused){ FullScreen($(this)[0]) $(this).children(".h5video").get(0).play(); if(v8 != null) { v8.disconnect(); delete v8; v8 = null; } v8 = H5sPlayerCreate(conf8); v8.connect(); $(this).children(".playpause").fadeOut(); } });