video-legacy.9cec2776.js 8.8 KB

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