video-legacy.2284a8a4.js 8.4 KB

1
  1. !function(){function e(e,n,o,t,r,a,i){try{var s=e[a](i),c=s.value}catch(l){return void o(l)}s.done?n(c):Promise.resolve(c).then(t,r)}function n(n){return function(){var o=this,t=arguments;return new Promise((function(r,a){var i=n.apply(o,t);function s(n){e(i,r,a,s,c,"next",n)}function c(n){e(i,r,a,s,c,"throw",n)}s(void 0)}))}}System.register(["./video.module-legacy.eed29620.js","./index-legacy.47bc1690.js","./plyr.min-legacy.a0adaba2.js","./plyr-legacy.2bfabaee.js","./index-legacy.318f6df0.js"],(function(e){"use strict";var o,t,r,a,i,s,c,l,u,d,p,v,f,g,m,y,h,w,I,T;return{setters:[function(e){o=e.s},function(e){t=e.d,r=e.ah,a=e.ag,i=e.aY,s=e.r,c=e.R,l=e.Z,u=e.$,d=e.m,p=e.b3,v=e.c,f=e.L,g=e.q,m=e.B,y=e.f,h=e.be},function(e){w=e.P},function(){},function(e){I=e.u,T=e.b}],execute:function(){e("default",t({name:"pre-register",setup:function(){var e=r(),t=a(),N=i(),R=sessionStorage.getItem("active-open-id"),B=I(1e3,{controls:!0});B.pause();var k=s({coverImg:"",introductionVideo:"",introductionVideoTime:0,videoBrowsePoint:0,saveId:e.query.saveId,orchestraId:e.query.id,openId:e.query.openId||R,loading:!1,player:null,playerSpeed:1,intervalFnRef:null,videoDetails:[],pointVideo:{},pointVideoTime:0,videoSelectId:null,isPageHide:!1,parentConferencesNotes:"",orchestraRegisterType:"",status:""}),x=I(1e3,{controls:!0});x.pause();var b=function(e){var n=[];e.sort((function(e,n){return e[0]-n[0]}));for(var o=e[0],t=1;t<e.length;t++){var r=e[t];o[1]>=r[0]?o[1]=Math.max(r[1],o[1]):(n.push(o),o=r)}return n.push(o),C(n)},C=function(e){var n=[],o=k.pointVideo.startNode,t=k.pointVideo.endNode;return e.forEach((function(e){e[0]>=o&&e[1]<=t&&n.push(e),e[0]>=o&&e[1]<=t&&e[1]>=t&&n.push([e[0],t]),e[0]<o&&e[1]>o&&e[1]<t&&n.push(o,e[1])})),n},E=function(e){var n=b(e);console.log(n,"afterIntervals");var o=0;return n.forEach((function(e){o+=e[1]-e[0]})),o},P=function(e){k.videoDetails.forEach((function(n){n.startNode<=e&&e<=n.endNode&&(k.videoSelectId=n.id)}))},V=function(){var 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};y().iPhone&&(e.fullscreen={enabled:!0,fallback:"force",iosNative:!0});var n=[];k.videoDetails.forEach((function(e){n.push({time:e.startNode,label:e.desc})})),e.markers={enabled:!0,points:n},k.player=new w("#register-video",e),k.player.on("ready",(function(e){console.log("ready",e)})),k.player.on("loadedmetadata",(function(){console.log("loadedmetadata"),k.loading=!1,k.player.currentTime=k.videoBrowsePoint,P(k.player.currentTime)})),k.player.on("ratechange",(function(){k.playerSpeed=k.playerSpeed<k.player.speed?k.player.speed:k.playerSpeed})),k.player.on("seeking",(function(){console.log("seeking"),x.isActive.value&&x.pause()})),k.player.on("seeked",(function(){console.log("seeked"),x.isActive.value&&x.pause()})),k.player.on("waiting",(function(){x.isActive.value&&x.pause()})),k.player.on("timeupdate",(function(){console.log("timeupdate",k.player.currentTime),P(k.player.currentTime),!x.isActive.value&&k.player.currentTime>0&&k.player.playing&&x.resume()})),k.player.on("ended",(function(){k.player.pause()})),k.player.on("play",(function(){console.log("play"),x.resume()})),k.player.on("pause",(function(){console.log("pause",x.isActive.value),x.pause()})),k.player.on("enterfullscreen",(function(){console.log("fullscreen");var e=document.createElement("i");e.id="fullscreen-back",e.className="van-icon van-icon-arrow-left video-back",e.addEventListener("click",(function(){k.player.fullscreen.exit()})),console.log(document.getElementsByClassName("plyr")),document.getElementsByClassName("plyr")[0].appendChild(e)})),k.player.on("exitfullscreen",(function(){console.log("exitfullscreen");var e=document.getElementById("fullscreen-back");e&&e.remove()})),P(0)},S=c([]),D=[],A=I(1e3,{controls:!0});l((function(){return x.isActive.value}),(function(e){F(e)}));var F=function(e){if(e?D[0]=Math.floor(k.player.currentTime):D[1]=Math.floor(k.player.currentTime),D.length>=2){var n=D[1]-D[0]-A.counter.value*k.playerSpeed>2;D[1]>=D[0]&&!n&&S.value.push(D),D=[],A.counter.value=0}};l(N,(function(e){console.log("watch",e),"hidden"==e&&k.player.pause()}));var j=function(){var e=n(regeneratorRuntime.mark((function e(){var n,o,t,r,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>0&&void 0!==a[0]?a[0]:10,e.prev=1,o=S.value.length>0?b(S.value):[],t=o.length>0?E(o):0,r=Math.floor(t/Math.floor(k.pointVideoTime)*100),e.next=7,d.post("/api-student/open/studentBrowseRecord/updateStat",{data:{id:k.saveId,pageBrowseTime:n,videoBrowseData:JSON.stringify(o),videoBrowseDataTime:t||0,videoBrowsePercentage:r||0,videoBrowseTime:null==x?void 0:x.counter.value,videoBrowsePoint:Math.floor(k.player.currentTime||0)}});case 7:e.next=11;break;case 9:e.prev=9,e.t0=e.catch(1);case 11:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(){return e.apply(this,arguments)}}(),L=function(){var e=n(regeneratorRuntime.mark((function e(){var n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,k.player.pause(),null===(n=k.intervalFnRef)||void 0===n||n.pause(),A.pause(),x.pause(),B.pause(),F(x.isActive.value),e.next=9,j();case 9:console.log(k.orchestraRegisterType),"PARENT_CONFERENCES"===k.orchestraRegisterType?window.location.href=window.location.origin+window.location.pathname+"/#/preApply?id=".concat(k.orchestraId):window.location.href=window.location.origin+window.location.pathname+"/project/preRegister.html?"+h.stringify({orchestraId:k.orchestraId,openId:k.openId}),e.next=19;break;case 13:e.prev=13,e.t0=e.catch(0),console.log(e.t0,"e"),null===(o=k.intervalFnRef)||void 0===o||o.resume(),B.resume(),A.resume();case 19:case"end":return e.stop()}}),e,null,[[0,13]])})));return function(){return e.apply(this,arguments)}}();u(n(regeneratorRuntime.mark((function e(){var o,t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,d.get("/api-student/open/studentBrowseRecord/query",{params:{openId:k.openId,orchestraId:k.orchestraId}});case 3:o=e.sent,t=o.data,k.videoBrowsePoint=t.videoBrowsePoint||0,k.player&&(k.player.currentTime=t.videoBrowsePoint||0),k.introductionVideo=t.introductionVideo,k.introductionVideoTime=t.introductionVideoTime,k.coverImg=t.coverImg,S.value=t.videoBrowseData?JSON.parse(t.videoBrowseData):[],k.parentConferencesNotes=t.parentConferencesNotes,k.orchestraRegisterType=t.orchestraRegisterType,(t.videoDetails||[]).forEach((function(e){k.videoDetails.push({startNode:e.startNode,endNode:e.endNode,desc:e.desc,id:e.id}),e.pointFlag&&(k.pointVideo=e,k.pointVideoTime=e.endNode-e.startNode)})),V(),k.intervalFnRef=T(n(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return B.counter.value=0,B.resume(),e.next=4,j();case 4:x.counter.value=0;case 5:case"end":return e.stop()}}),e)}))),1e4),e.next=21;break;case 19:e.prev=19,e.t0=e.catch(0);case 21:case"end":return e.stop()}}),e,null,[[0,19]])})))),p((function(){var e;null===(e=k.intervalFnRef)||void 0===e||e.pause(),A.pause(),B.pause()})),k.openId||t.replace({path:"/pre-register-video",query:{id:k.orchestraId}});var M=function(){console.log(k.isPageHide,"showInfo"),k.isPageHide&&window.location.reload()};window.addEventListener("pageshow",M);var q=function(){console.log(k.isPageHide,"showInfo"),k.isPageHide=!0};return window.addEventListener("pagehide",q),p((function(){window.removeEventListener("pageshow",M),window.removeEventListener("pagehide",q)})),function(){return v("div",{class:o["pre-register-video"]},[v("div",{class:o.videoContainer},[v("div",{class:o["video-content"]},[v("video",{id:"register-video",class:o.video,src:k.introductionVideo,playsinline:!0,poster:k.coverImg,preload:"auto"},null),k.loading&&v("div",{class:o.loadingVideo},[v(f,{size:36,color:"#FF8057",vertical:!0,style:{height:"100%",justifyContent:"center"}},{default:function(){return[g("加载中...")]}})])])]),v("div",{class:o.videoCount},[v("div",{class:o.videoCountContent},[k.videoDetails.map((function(e){return v("span",{class:[e.id===k.videoSelectId?o.active:""],onClick:function(){k.player.currentTime=e.startNode,k.player.play(),k.videoBrowsePoint=e.startNode,P(k.player.currentTime)}},[e.desc])}))])]),v("div",{class:o.messageContainer},[v("div",{class:o.messageContent},[v("div",{innerHTML:k.parentConferencesNotes},null),v(m,{class:o.submitBtn,onClick:L},null)])])])}}}))}}}))}();