video-legacy.ed8210a1.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.90c82f08.js","./video.module-legacy.b14e5f1c.js","./plyr.min-legacy.a0adaba2.js","./plyr-legacy.2bfabaee.js","./deep-clone-legacy.b234d76d.js","./index-legacy.c4f76e6e.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"),x=I(1e3,{controls:!0});x.pause();var b=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=b.pointVideo.startNode,r=b.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){b.videoDetails.forEach((function(n){n.startNode<=e&&e<=n.endNode&&(b.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=[];b.videoDetails.forEach((function(e){n.push({time:e.startNode,label:e.desc})})),e.markers={enabled:!0,points:n},b.player=new w("#register-video",e),b.player.on("ready",(function(e){})),b.player.on("loadedmetadata",(function(){console.log("loadedmetadata"),b.loading=!1,b.player.currentTime=b.videoBrowsePoint,V(b.player.currentTime)})),b.player.on("ratechange",(function(){b.playerSpeed=b.playerSpeed<b.player.speed?b.player.speed:b.playerSpeed})),b.player.on("seeking",(function(){console.log("seeking"),k.isActive.value&&k.pause()})),b.player.on("seeked",(function(){console.log("seeked"),k.isActive.value&&k.pause()})),b.player.on("waiting",(function(){k.isActive.value&&k.pause()})),b.player.on("timeupdate",(function(){V(b.player.currentTime),!k.isActive.value&&b.player.currentTime>0&&b.player.playing&&k.resume()})),b.player.on("ended",(function(){b.player.pause(),console.log(k.isActive.value,"ended")})),b.player.on("play",(function(){console.log("play"),k.resume()})),b.player.on("pause",(function(){console.log("pause",k.isActive.value),k.pause()})),b.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(){b.player.fullscreen.exit()})),document.getElementsByClassName("plyr")[0].appendChild(e)})),b.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(b.player.currentTime)):e?A[0]=Math.floor(b.player.currentTime):A[1]=Math.floor(b.player.currentTime),A.length>=2){var r=A[1]-A[0]-F.counter.value*b.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&&b.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(b.pointVideoTime)*100),e.next=7,u.post("/api-student/open/studentBrowseRecord/updateStat",{data:{id:b.saveId,pageBrowseTime:n,videoBrowseData:JSON.stringify(t),videoBrowseDataTime:r||0,videoBrowsePercentage:o||0,videoBrowseTime:null==k?void 0:k.counter.value,videoBrowsePoint:Math.floor(b.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,b.player.pause(),null===(n=b.intervalFnRef)||void 0===n||n.pause(),F.pause(),k.pause(),x.pause(),j(k.isActive.value),e.next=9,M();case 9:console.log(b.orchestraRegisterType),"PARENT_CONFERENCES"===b.orchestraRegisterType?window.location.href=window.location.origin+window.location.pathname+"/#/preApply?id=".concat(b.orchestraId):"GROUP_BUY"===b.orchestraRegisterType?window.location.href=window.location.origin+window.location.pathname+"/#/preGoodsApply?id=".concat(b.orchestraId):window.location.href=window.location.origin+window.location.pathname+"/project/preRegister.html?"+m.stringify({orchestraId:b.orchestraId,openId:b.openId}),e.next=19;break;case 13:e.prev=13,e.t0=e.catch(0),console.log(e.t0,"e"),null===(t=b.intervalFnRef)||void 0===t||t.resume(),x.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:b.openId,orchestraId:b.orchestraId}});case 3:t=e.sent,r=t.data,b.videoBrowsePoint=r.videoBrowsePoint||0,b.player&&(b.player.currentTime=r.videoBrowsePoint||0),b.introductionVideo=r.introductionVideo,b.introductionVideoTime=r.introductionVideoTime,b.coverImg=r.coverImg,S.value=r.videoBrowseData?JSON.parse(r.videoBrowseData):[],b.parentConferencesNotes=r.parentConferencesNotes,b.orchestraRegisterType=r.orchestraRegisterType,b.registerDisplay=r.registerDisplay,(r.videoDetails||[]).forEach((function(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)})),D(),b.intervalFnRef=R(n(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return x.counter.value=0,x.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=b.player)||void 0===e||e.fullscreen.exit(),null===(n=b.intervalFnRef)||void 0===n||n.pause(),F.pause(),x.pause()})),b.openId||t.replace({path:"/pre-register-video",query:{id:b.orchestraId}});var q=function(){b.isPageHide&&window.location.reload()};window.addEventListener("pageshow",q);var H=function(){b.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:b.introductionVideo,playsinline:!0,poster:b.coverImg,preload:"auto"},null),b.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},[b.videoDetails.map((function(e){return p("span",{class:[e.id===b.videoSelectId?h.active:""],onClick:function(){b.player.currentTime=e.startNode,b.player.play(),b.videoBrowsePoint=e.startNode,V(b.player.currentTime)}},[e.desc])}))])]),p("div",{class:h.messageContainer},[p("div",{class:h.messageContent},[p("div",{innerHTML:b.parentConferencesNotes},null),b.registerDisplay&&p(g,{class:h.submitBtn,onClick:L},null)])])])}}}))}}}))}();