video-legacy.3b2e0a1e.js 6.9 KB

1
  1. System.register(["./index-legacy.eb062188.js","./video.module-legacy.3e55d07e.js","./plyr.min-legacy.1dfa7bde.js","./plyr-legacy.2bfabaee.js","./index-legacy.219fe128.js"],(function(e){"use strict";var o,t,a,n,i,s,r,l,d,c,p,u,v,y,g,m,h,f,w,I;return{setters:[function(e){o=e.d,t=e.ah,a=e.ag,n=e.b0,i=e.r,s=e.R,r=e.Z,l=e.$,d=e.m,c=e.b7,p=e.c,u=e.L,v=e.q,y=e.B,g=e.f,m=e.bi},function(e){h=e.s},function(e){f=e.P},function(){},function(e){w=e.u,I=e.b}],execute:function(){e("default",o({name:"pre-register",setup(){const e=t(),o=a(),B=n(),T=sessionStorage.getItem("active-open-id"),N=w(1e3,{controls:!0});N.pause();const b=i({coverImg:"",introductionVideo:"",introductionVideoTime:0,videoBrowsePoint:0,saveId:e.query.saveId,orchestraId:e.query.id,openId:e.query.openId||T,loading:!1,player:null,playerSpeed:1,intervalFnRef:null,videoDetails:[],pointVideo:{},pointVideoTime:0,videoSelectId:null,isPageHide:!1}),P=w(1e3,{controls:!0});P.pause();const V=e=>{const o=[];e.sort(((e,o)=>e[0]-o[0]));let t=e[0];for(let a=1;a<e.length;a++){const n=e[a];t[1]>=n[0]?t[1]=Math.max(n[1],t[1]):(o.push(t),t=n)}return o.push(t),E(o)},E=e=>{const o=[],t=b.pointVideo.startNode,a=b.pointVideo.endNode;return e.forEach((e=>{e[0]>=t&&e[1]<=a&&o.push(e),e[0]>=t&&e[1]<=a&&e[1]>=a&&o.push([e[0],a]),e[0]<t&&e[1]>t&&e[1]<a&&o.push(t,e[1])})),o},S=e=>{b.videoDetails.forEach((o=>{o.startNode<=e&&e<=o.endNode&&(b.videoSelectId=o.id)}))},k=s([]);let C=[];const D=w(1e3,{controls:!0});r((()=>P.isActive.value),(e=>{R(e)}));const R=e=>{if(e?C[0]=Math.floor(b.player.currentTime):C[1]=Math.floor(b.player.currentTime),C.length>=2){const e=C[1]-C[0]-D.counter.value*b.playerSpeed>2;C[1]>=C[0]&&!e&&k.value.push(C),C=[],D.counter.value=0}};r(B,(e=>{console.log("watch",e),"hidden"==e&&b.player.pause()}));const A=async(e=10)=>{try{const o=k.value.length>0?V(k.value):[],t=o.length>0?(e=>{const o=V(e);console.log(o,"afterIntervals");let t=0;return o.forEach((e=>{t+=e[1]-e[0]})),t})(o):0,a=Math.floor(t/Math.floor(b.pointVideoTime)*100);await d.post("/api-student/open/studentBrowseRecord/updateStat",{data:{id:b.saveId,pageBrowseTime:e,videoBrowseData:JSON.stringify(o),videoBrowseDataTime:t||0,videoBrowsePercentage:a||0,videoBrowseTime:null==P?void 0:P.counter.value,videoBrowsePoint:Math.floor(b.player.currentTime||0)}})}catch{}},F=async()=>{try{var e;b.player.pause(),null===(e=b.intervalFnRef)||void 0===e||e.pause(),D.pause(),P.pause(),N.pause(),R(P.isActive.value),await A(),window.location.href=window.location.origin+window.location.pathname+"/project/preRegister.html?"+m.stringify({orchestraId:b.orchestraId,openId:b.openId})}catch(t){var o;console.log(t,"e"),null===(o=b.intervalFnRef)||void 0===o||o.resume(),N.resume(),D.resume()}};l((async()=>{try{const{data:e}=await d.get("/api-student/open/studentBrowseRecord/query",{params:{openId:b.openId,orchestraId:b.orchestraId}});b.videoBrowsePoint=e.videoBrowsePoint||0,b.player&&(b.player.currentTime=e.videoBrowsePoint||0),b.introductionVideo=e.introductionVideo,b.introductionVideoTime=e.introductionVideoTime,b.coverImg=e.coverImg,k.value=e.videoBrowseData?JSON.parse(e.videoBrowseData):[],(e.videoDetails||[]).forEach((e=>{b.videoDetails.push({startNode:e.startNode,endNode:e.endNode,desc:e.desc,id:e.id}),e.pointFlag&&(b.pointVideo=e,b.pointVideoTime=e.endNode-e.startNode)})),(()=>{const e={controls:["play-large","play","progress","captions","current-time","duration","settings","fullscreen"],settings:["speed"],speed:{selected:1,options:[.5,1,1.5,2]},i18n:{speed:"速度",normal:"默认"},autoplay:!1,invertTime:!1};g().iPhone&&(e.fullscreen={enabled:!0,fallback:"force",iosNative:!0});const o=[];b.videoDetails.forEach((e=>{o.push({time:e.startNode,label:e.desc})})),e.markers={enabled:!0,points:o},b.player=new f("#register-video",e),b.player.on("ready",(e=>{console.log("ready",e)})),b.player.on("loadedmetadata",(()=>{console.log("loadedmetadata"),b.loading=!1,b.player.currentTime=b.videoBrowsePoint,S(b.player.currentTime)})),b.player.on("ratechange",(()=>{b.playerSpeed=b.playerSpeed<b.player.speed?b.player.speed:b.playerSpeed})),b.player.on("seeking",(()=>{console.log("seeking"),P.isActive.value&&P.pause()})),b.player.on("seeked",(()=>{console.log("seeked"),P.isActive.value&&P.pause()})),b.player.on("waiting",(()=>{P.isActive.value&&P.pause()})),b.player.on("timeupdate",(()=>{console.log("timeupdate",b.player.currentTime),S(b.player.currentTime),!P.isActive.value&&b.player.currentTime>0&&b.player.playing&&P.resume()})),b.player.on("ended",(()=>{b.player.pause()})),b.player.on("play",(()=>{console.log("play"),P.resume()})),b.player.on("pause",(()=>{console.log("pause",P.isActive.value),P.pause()})),b.player.on("enterfullscreen",(()=>{console.log("fullscreen");const e=document.createElement("i");e.id="fullscreen-back",e.className="van-icon van-icon-arrow-left video-back",e.addEventListener("click",(()=>{b.player.fullscreen.exit()})),console.log(document.getElementsByClassName("plyr")),document.getElementsByClassName("plyr")[0].appendChild(e)})),b.player.on("exitfullscreen",(()=>{console.log("exitfullscreen");const e=document.getElementById("fullscreen-back");e&&e.remove()})),S(0)})(),b.intervalFnRef=I((async()=>{N.counter.value=0,N.resume(),await A(),P.counter.value=0}),1e4)}catch{}})),c((()=>{var e;null===(e=b.intervalFnRef)||void 0===e||e.pause(),D.pause(),N.pause()})),b.openId||o.replace({path:"/pre-register-video",query:{id:b.orchestraId}});const j=()=>{console.log(b.isPageHide,"showInfo"),b.isPageHide&&window.location.reload()};window.addEventListener("pageshow",j);const x=()=>{console.log(b.isPageHide,"showInfo"),b.isPageHide=!0};return window.addEventListener("pagehide",x),c((()=>{window.removeEventListener("pageshow",j),window.removeEventListener("pagehide",x)})),()=>p("div",{class:h["pre-register-video"]},[p("div",{class:h.videoContainer},[p("div",{class:h["video-content"]},[p("video",{id:"register-video",class:h.video,src:b.introductionVideo,playsinline:!0,poster:b.coverImg,preload:"auto"},null),b.loading&&p("div",{class:h.loadingVideo},[p(u,{size:36,color:"#FF8057",vertical:!0,style:{height:"100%",justifyContent:"center"}},{default:()=>[v("加载中...")]})])])]),p("div",{class:h.videoCount},[p("div",{class:h.videoCountContent},[b.videoDetails.map((e=>p("span",{class:[e.id===b.videoSelectId?h.active:""],onClick:()=>{b.player.currentTime=e.startNode,b.player.play(),b.videoBrowsePoint=e.startNode,S(b.player.currentTime)}},[e.desc])))])]),p("div",{class:h.messageContainer},[p("div",{class:h.messageContent},[p("p",null,[v("注意事项")]),p("p",{class:h.c1},[v("1、 请家长们认真观看家长会视频,了解乐团事项;")]),p("p",{class:h.c1},[v("2、报名截止时间为后天21:00前,因编制有限,以报名先后顺序为原则确定席位;")]),p("p",{class:h.c1},[v("3、入团需准备自用乐器和乐团AI学练工具,家长自愿选择准备方式;")]),p("p",{class:h.c1},[v("4、乐团报名需点击乐团报名或扫码,完成提交视为报名成功。")])]),p(y,{class:h.submitBtn,onClick:F},null)])])}}))}}}));