You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
16 KiB
2 lines
16 KiB
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5401],{45401:function(ze,X,s){s.d(X,{Z:function(){return Le}});var e=s(59301),p=s(8591),G=s(38854),B=s(27660),d=s(63824),D=s(35099),Ce=s(56102),g=s(49457),l={watermark:"watermark___hNYlv",videovideo:"videovideo___ovOkV",animate__loop:"animate__loop___mvL6s",upDown:"upDown___SlgHv",container:"container___g1WYG","video-container":"video-container___XPkWR","video-controls":"video-controls___to0Zq",hide:"hide___NA3DV","video-progress":"video-progress___gqHsd",seek:"seek___iZHBm","seek-tooltip":"seek-tooltip___uWyXx","bottom-controls":"bottom-controls___uoIBm","left-controls":"left-controls___mBEx4","right-controls":"right-controls___e9L6r",rateOverlay:"rateOverlay___HHBWe",controlText:"controlText___M_BWR","volume-controls":"volume-controls___fa3mE","fullscreen-button":"fullscreen-button___ur0es","fullscreen-button1":"fullscreen-button1___rfaXm","pip-button":"pip-button___GFO8W","playback-animation":"playback-animation___ndURq",volume:"volume___OTmpP",hidden:"hidden___o7GkT"},ue=(a,r,i)=>new Promise((h,k)=>{var _=v=>{try{w(i.next(v))}catch(x){k(x)}},R=v=>{try{w(i.throw(v))}catch(x){k(x)}},w=v=>v.done?h(v.value):Promise.resolve(v.value).then(_,R);w((i=i.apply(a,r)).next())});function L(a){if(isNaN(a))return{minutes:"00",seconds:"00"};const r=new Date(a*1e3).toISOString().substr(11,8);return{hour:r.substr(0,2),minutes:r.substr(3,2),seconds:r.substr(6,2)}}Object.defineProperty(HTMLMediaElement.prototype,"playing",{get:function(){return this.currentTime>0&&!this.paused&&!this.ended&&this.readyState>2}});function Ne(a,r){return a-r}function Be(a){a.sort(Ne);let r=0;for(let i=0;i<a.length-1;i++){let h=Math.abs(a[i+1]-a[i]);h<21&&(r+=h)}return r}const De=/(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i;var Le=(0,e.forwardRef)(({allow_skip:a,src:r,toLog:i,videoId:h,logWatchHistory:k,courseId:_=null,startTime:R,handlePause:w=()=>{},handlePlay:v=()=>{},handlePlayEnded:x=()=>{},autoPlay:Re=!1,onPlayEnded:Se=()=>{}},Pe)=>{var le;r=r==null?void 0:r.replace("http://","https://");const oe=((le=r==null?void 0:r.split("."))==null?void 0:le.pop())==="flv",t=(0,e.useRef)(),ae=(0,e.useRef)(),S=(0,e.useRef)(),P=(0,e.useRef)(),$=(0,e.useRef)(),m=(0,e.useRef)(),T=(0,e.useRef)(),F=(0,e.useRef)(),Y=(0,e.useRef)(),K=(0,e.useRef)(),J=(0,e.useRef)(),Q=(0,e.useRef)(),ee=(0,e.useRef)(),M=(0,e.useRef)(),ie=navigator.userAgent.toLowerCase().match(De),$e=ie?ie[0]:"pc",ce=(0,e.useRef)(!1),se=(0,D.eY)();let A=0,q=0,E=0,I=null,te=!1,de=20,ne=1,Z=!1,O=!1,y=[];(0,e.useImperativeHandle)(Pe,()=>({getLastUpdatedTime:()=>t.current.currentTime,getDuration:()=>t.current.duration})),p.ZP.config({maxCount:1,getContainer:()=>S.current});const z=(0,e.useCallback)((o,fe=!1)=>{let c={point:t.current.currentTime};I?(c.log_id=I,c.watch_duration=Be(y),c.total_duration=q):(_?(c.video_id=parseInt(h,10),c.course_id=_):c.video_id=h,c.duration=A,c.device=$e),fe&&(c.ed="1");function V(){return ue(this,null,function*(){Z=!0,I=yield k==null?void 0:k(c),Z=!1,o&&o()})}V()},[h,_]);(0,e.useEffect)(()=>{t.current&&(P.current.style.display="none",$.current.style.display="block"),p.ZP.destroy();let o=null;return B.Z.isSupported&&oe&&r&&(r==null?void 0:r.indexOf(".m3u8"))<0?(o=B.Z.createPlayer({type:"flv",volume:.8,cors:!0,url:r,muted:!1}),t.current&&(o.attachMediaElement(t.current),o.load())):t.current.setAttribute("src",r),H(),()=>{o&&(o.unload(),o.pause(),o.destroy(),o=null)}},[t,oe,r]);function me(){t.current.paused?(P.current.style.display="none",$.current.style.display="block"):(P.current.style.display="block",$.current.style.display="none")}function H(){J.current.style.display="none",ee.current.style.display="none",Q.current.style.display="none",t.current.muted||t.current.volume===0?J.current.style.display="block":t.current.volume>0&&t.current.volume<=.5?ee.current.style.display="block":Q.current.style.display="block"}(0,e.useEffect)(()=>{const o=document.getElementById("play"),fe=document.querySelectorAll(".playback-icons use");function c(){v(),R&&!ce.current&&(t.current.currentTime=R),ce.current=!0,y.push(t.current.currentTime),te||(te=!0,i&&z())}function V(){return ue(this,null,function*(){me(),y.push(t.current.currentTime),i&&z(()=>{I=null,E=0,te=!1,Z=!1,O=!1,y=[],q=0,ne=1},!0),Se()})}function U(){m.current.value=Math.round(t.current.currentTime),T.current.value=Math.round(t.current.currentTime)}function qe(){const n=L(Math.round(t.current.currentTime));Y.current.innerText=`${n.hour>0?n.hour+":":""}${n.minutes}:${n.seconds}`,Y.current.setAttribute("datetime",`${n.hour>0?" "+n.hour+" ":""}${n.minutes}m ${n.seconds}s`)}function pe(){const n=Math.round(t.current.duration);m.current.setAttribute("max",n),T.current.setAttribute("max",n);const u=L(n);F.current.innerText=`${u.hour>0?u.hour+":":""}${u.minutes}:${u.seconds}`,F.current.setAttribute("datetime",`${u.hour>0?" "+u.hour+" ":""}${u.minutes}m ${u.seconds}s`)}function he(){try{const n=Math.round(t.current.duration);m.current.setAttribute("max",n),T.current.setAttribute("max",n);const u=L(n);F.current.innerText=`${u.hour>0?u.hour+":":""}${u.minutes}:${u.seconds}`,F.current.setAttribute("datetime",`${u.hour>0?" "+u.hour+" ":""}${u.minutes}m ${u.seconds}s`),U(),qe();const{width:f,height:C,x:W,y:j}=ae.current.getBoundingClientRect();if(W<0||j<0||!f)return;if(!O){let b=t.current.currentTime,N=b-E;Math.abs(N)<10?(q+=Math.abs(N),E=b,Z||q-ne*de>=0&&(ne++,y.push(E),i&&z())):(E=b,i&&z())}}catch(n){console.log(n)}}function Ee(){O=!0}function ye(){t.current.playing&&y.push(t.current.currentTime,E),E=t.current.currentTime,O=!1}function be(){A=t.current.duration,A<=20&&(de=A/3),t.current.addEventListener("play",c)}function Ie(n){n.preventDefault(),(0,g.vp)()?(t.current.style.width="100%",t.current.style.height="100%"):t.current.style.cssText=""}function ge(){w()}function ke(n){if(!a){p.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");return}const u=n.target.dataset.seek?n.target.dataset.seek:n.target.value;t.current.currentTime=u,T.current.value=u,m.current.value=u}function _e(n){const u=Math.round(n.offsetX/n.target.clientWidth*parseInt(n.target.getAttribute("max"),10));m.current.setAttribute("data-seek",u);const f=L(u);K.current.textContent=`${f.hour>0?f.hour+":":""}${f.minutes}:${f.seconds}`;const C=t.current.getBoundingClientRect();K.current.style.left=`${n.pageX-C.left}px`}function we(n){switch(n.code){case"Space":n.preventDefault(),ve();break;case"ArrowRight":if(n.preventDefault(),!a){p.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");break}if(t.current.currentTime>=t.current.duration)break;t.current.currentTime=parseInt(t.current.currentTime)+5,U();break;case"ArrowLeft":if(n.preventDefault(),!a){p.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");break}if(t.current.currentTime===0)break;t.current.currentTime=parseInt(t.current.currentTime)-5,U();break;case"ArrowUp":n.preventDefault(),t.current.volume<1&&(t.current.volume=(parseInt(t.current.volume*10)+1)/10);break;case"ArrowDown":n.preventDefault(),t.current.volume>0&&(t.current.volume=(parseInt(t.current.volume*10)-1)/10);break}}return S.current.addEventListener((0,g.gH)(),Ie),t.current.addEventListener("canplay",be),t.current.addEventListener("ended",V),t.current.addEventListener("seeking",Ee),t.current.addEventListener("seeked",ye),t.current.addEventListener("loadedmetadata",pe),m.current.addEventListener("mousemove",_e),m.current.addEventListener("input",ke),t.current.addEventListener("timeupdate",he),t.current.addEventListener("pause",ge),t.current.addEventListener("volumechange",H),document.addEventListener("keydown",we),()=>{var n,u,f,C,W,j,b,N,xe,Te,Fe,Me;(n=t.current)==null||n.removeEventListener("canplay",be),(u=t.current)==null||u.removeEventListener("play",c),(f=t.current)==null||f.removeEventListener("ended",V),(C=t.current)==null||C.removeEventListener("seeking",Ee),(W=t.current)==null||W.removeEventListener("seeked",ye),(j=m.current)==null||j.removeEventListener("mousemove",_e),(b=m.current)==null||b.removeEventListener("input",ke),(N=t.current)==null||N.removeEventListener("timeupdate",he),(xe=t.current)==null||xe.removeEventListener("pause",ge),(Te=t.current)==null||Te.removeEventListener("loadedmetadata",pe),(Fe=t.current)==null||Fe.removeEventListener("volumechange",H),document.removeEventListener("keydown",we),(Me=t.current)!=null&&Me.playing&&(y.push(E,t.current.currentTime),i&&z())}},[t,r]),(0,e.useEffect)(()=>{if(t.current.onended=()=>{x(t)},t.current.oncontextmenu=()=>!1,(r==null?void 0:r.indexOf(".m3u8"))>-1){if(t.current.canPlayType("application/vnd.apple.mpegurl"))t.current.src=r;else if(d.ZP.isSupported()){var o=new d.ZP;o.loadSource(r),o.attachMedia(t.current)}}},[r]);const[Oe,re]=(0,e.useState)(1),ve=()=>{t.current.paused||t.current.ended?t.current.play():t.current.pause(),me()};function Ae(){t.current.muted=!t.current.muted,t.current.muted?(M.current.setAttribute("data-volume",volume.value),M.current.value=0):M.current.value=M.current.dataset.volume}return e.createElement("div",{style:{position:"relative"},ref:S},e.createElement("div",{ref:ae,className:`${l.watermark} animated_alternate animate__animated_10s animate__infinite animate__stepstart ${l.animate__loop}`},se?se.login:" "),e.createElement("div",{className:l.container},e.createElement("div",{className:l["video-container"],id:"video-container"},e.createElement("div",{className:l["playback-animation"],id:"playback-animation"},e.createElement("svg",{className:l["playback-icons"]},e.createElement("use",{className:"hidden",href:"#play-icon"}),e.createElement("use",{href:"#pause"}))),e.createElement("video",{className:l.video,id:"video",preload:"auto",disablePictureInPicture:!0,ref:t,autoPlay:Re}),e.createElement("div",{className:`${l["video-controls"]} `,id:"video-controls"},e.createElement("div",{className:l["bottom-controls"]},e.createElement("div",{className:l["left-controls"]},e.createElement("button",{"data-title":"\u64AD\u653E/\u6682\u505C",id:"play",onClick:ve},e.createElement("svg",{className:l["playback-icons"]},e.createElement("use",{ref:$,href:"#play-icon"}),e.createElement("use",{ref:P,style:{display:"none"},href:"#pause"}))),e.createElement("div",{className:l.time},e.createElement("time",{id:"time-elapsed",ref:Y},"00:00"),e.createElement("span",null," / "),e.createElement("time",{id:"duration",ref:F},"00:00"))),e.createElement("div",{className:l["right-controls"]},a&&e.createElement(G.Z,{placement:"top",overlayClassName:l.rateOverlay,getPopupContainer:o=>o.parentNode,menu:{items:[{key:"1",label:e.createElement("span",{onClick:()=>{re(1),t.current.playbackRate=1}},"1.0x")},{key:"2",label:e.createElement("span",{onClick:()=>{re(1.5),t.current.playbackRate=1.5}},"1.5x")},{key:"3",label:e.createElement("span",{onClick:()=>{re(2),t.current.playbackRate=2}},"2.0x")}]}},e.createElement("div",{className:`${l.controlText} mr5`},"\u500D\u901F")),e.createElement(Ce.CopyToClipboard,{text:r,onCopy:()=>p.ZP.success("\u590D\u5236\u6210\u529F")},e.createElement("button",{"data-title":"\u590D\u5236\u94FE\u63A5"},e.createElement("i",{className:"icon-lianjie2 iconfont",style:{fontSize:"12px",color:"white"}}))),e.createElement("div",{className:l["volume-controls"]},e.createElement("button",{"data-title":"\u5F00\u542F/\u5173\u95ED\u58F0\u97F3",className:l["volume-button"],id:"volume-button",onClick:Ae},e.createElement("i",{ref:J,className:"icon-a-bianzu8 iconfont",style:{fontSize:"14px",color:"white"}}),e.createElement("i",{ref:ee,className:"icon-shengyinkaibeifen iconfont",style:{fontSize:"14px",color:"white"}}),e.createElement("i",{ref:Q,className:"icon-shengyinkai iconfont",style:{fontSize:"14px",color:"white"}})),e.createElement("input",{className:l.volume,id:"volume",value:"1","data-mute":"0.5",type:"range",max:"1",min:"0",step:"0.01",ref:M,style:{display:"none"},onClick:H})),e.createElement("button",{"data-title":"\u5168\u5C4F/\u9000\u51FA\u5168\u5C4F",className:l["fullscreen-button"],onClick:()=>{(0,g.vp)()?(0,g.BU)():(0,g.Dj)(S.current)}},e.createElement("i",{className:"icon-fangda1 iconfont",style:{fontSize:"12px",color:"white"}})))),e.createElement("div",{className:l["video-progress"]},e.createElement("progress",{ref:T,value:"0",min:"0"}),e.createElement("input",{className:l.seek,ref:m,value:"0",min:"0",type:"range",step:"1"}),e.createElement("div",{className:l["seek-tooltip"],ref:K,id:"seek-tooltip"},"00:00"))))),e.createElement("svg",{style:{display:"none"}},e.createElement("defs",null,e.createElement("symbol",{id:"pause",viewBox:"0 0 24 24"},e.createElement("path",{d:"M14.016 5.016h3.984v13.969h-3.984v-13.969zM6 18.984v-13.969h3.984v13.969h-3.984z"})),e.createElement("symbol",{id:"play-icon",viewBox:"0 0 24 24"},e.createElement("path",{d:"M8.016 5.016l10.969 6.984-10.969 6.984v-13.969z"})),e.createElement("symbol",{id:"volume-high",viewBox:"0 0 24 24"},e.createElement("path",{d:"M14.016 3.234q3.047 0.656 5.016 3.117t1.969 5.648-1.969 5.648-5.016 3.117v-2.063q2.203-0.656 3.586-2.484t1.383-4.219-1.383-4.219-3.586-2.484v-2.063zM16.5 12q0 2.813-2.484 4.031v-8.063q1.031 0.516 1.758 1.688t0.727 2.344zM3 9h3.984l5.016-5.016v16.031l-5.016-5.016h-3.984v-6z"})),e.createElement("symbol",{id:"volume-low",viewBox:"0 0 24 24"},e.createElement("path",{d:"M5.016 9h3.984l5.016-5.016v16.031l-5.016-5.016h-3.984v-6zM18.516 12q0 2.766-2.531 4.031v-8.063q1.031 0.516 1.781 1.711t0.75 2.32z"})),e.createElement("symbol",{id:"volume-mute",viewBox:"0 0 24 24"},e.createElement("path",{d:"M12 3.984v4.219l-2.109-2.109zM4.266 3l16.734 16.734-1.266 1.266-2.063-2.063q-1.547 1.313-3.656 1.828v-2.063q1.172-0.328 2.25-1.172l-4.266-4.266v6.75l-5.016-5.016h-3.984v-6h4.734l-4.734-4.734zM18.984 12q0-2.391-1.383-4.219t-3.586-2.484v-2.063q3.047 0.656 5.016 3.117t1.969 5.648q0 2.203-1.031 4.172l-1.5-1.547q0.516-1.266 0.516-2.625zM16.5 12q0 0.422-0.047 0.609l-2.438-2.438v-2.203q1.031 0.516 1.758 1.688t0.727 2.344z"})),e.createElement("symbol",{id:"fullscreen",viewBox:"0 0 24 24"},e.createElement("path",{d:"M14.016 5.016h4.969v4.969h-1.969v-3h-3v-1.969zM17.016 17.016v-3h1.969v4.969h-4.969v-1.969h3zM5.016 9.984v-4.969h4.969v1.969h-3v3h-1.969zM6.984 14.016v3h3v1.969h-4.969v-4.969h1.969z"})),e.createElement("symbol",{id:"fullscreen-exit",viewBox:"0 0 24 24"},e.createElement("path",{d:"M15.984 8.016h3v1.969h-4.969v-4.969h1.969v3zM14.016 18.984v-4.969h4.969v1.969h-3v3h-1.969zM8.016 8.016v-3h1.969v4.969h-4.969v-1.969h3zM5.016 15.984v-1.969h4.969v4.969h-1.969v-3h-3z"})),e.createElement("symbol",{id:"pip",viewBox:"0 0 24 24"},e.createElement("path",{d:"M21 19.031v-14.063h-18v14.063h18zM23.016 18.984q0 0.797-0.609 1.406t-1.406 0.609h-18q-0.797 0-1.406-0.609t-0.609-1.406v-14.016q0-0.797 0.609-1.383t1.406-0.586h18q0.797 0 1.406 0.586t0.609 1.383v14.016zM18.984 11.016v6h-7.969v-6h7.969z"})))))})},49457:function(ze,X,s){s.d(X,{BU:function(){return p},Dj:function(){return e},gH:function(){return G},vp:function(){return B}});function e(d){try{d.mozRequestFullScreen?d.mozRequestFullScreen():d.webkitRequestFullScreen&&d.webkitRequestFullScreen()}catch(D){console.log(D,":e")}}function p(){window.top.document.webkitExitFullscreen?window.top.document.webkitExitFullscreen():document.exitFullscreen?window.top.document.exitFullscreen():document.msExitFullscreen?window.top.document.msExitFullscreen():document.mozCancelFullScreen&&window.top.document.mozCancelFullScreen()}const G=()=>{if(document.webkitExitFullscreen)return"webkitfullscreenchange";if(document.exitFullscreen)return"fullscreenchange";if(document.msExitFullscreen)return"msfullscreenchange";if(document.mozCancelFullScreen)return"mozfullscreenchange"};function B(){var d=window.top.document.fullscreenElement||window.top.document.mozFullscreenElement||window.top.document.webkitFullscreenElement,D=document.fullscreenEnabled||document.mozFullscreenEnabled||document.webkitFullscreenEnabled;return console.log("fullscreenElement",d),d!=null}}}]);
|