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.
NewEduCoderBuild/509.711670de.async.js

2 lines
15 KiB

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[509],{90509:function(Ie,Me,v){v.d(Me,{Z:function(){return De}});var t=v(59301),T=v(8591),we=v(38854),ee=v(9082),te=v(24830),Ne=v(2992),Be=v(56102),M=v(45992),u={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"},ne=(o,r,i)=>new Promise((y,w)=>{var N=f=>{try{B(i.next(f))}catch(z){w(z)}},R=f=>{try{B(i.throw(f))}catch(z){w(z)}},B=f=>f.done?y(f.value):Promise.resolve(f.value).then(N,R);B((i=i.apply(o,r)).next())});function P(o){if(isNaN(o))return{minutes:"00",seconds:"00"};const r=new Date(o*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 ze(o,r){return o-r}function Le(o){o.sort(ze);let r=0;for(let i=0;i<o.length-1;i++){let y=Math.abs(o[i+1]-o[i]);y<21&&(r+=y)}return r}const Ce=/(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i;var De=(0,t.forwardRef)(({allow_skip:o,src:r,toLog:i,videoId:y,logWatchHistory:w,courseId:N=null,startTime:R,handlePause:B=()=>{},handlePlay:f=()=>{},handlePlayEnded:z=()=>{},autoPlay:Pe=!1,onPlayEnded:Re=()=>{},isShowWaterMark:$e=!0},Ae)=>{var re;r=r==null?void 0:r.replace("http://","https://");const ue=((re=r==null?void 0:r.split("."))==null?void 0:re.pop())==="flv",e=(0,t.useRef)(),le=(0,t.useRef)(),$=(0,t.useRef)(),A=(0,t.useRef)(),S=(0,t.useRef)(),m=(0,t.useRef)(),L=(0,t.useRef)(),x=(0,t.useRef)(),U=(0,t.useRef)(),X=(0,t.useRef)(),j=(0,t.useRef)(),G=(0,t.useRef)(),Y=(0,t.useRef)(),C=(0,t.useRef)(),ae=navigator.userAgent.toLowerCase().match(Ce),Se=ae?ae[0]:"pc",oe=(0,t.useRef)(!1),ie=(0,Ne.eY)();let F=0,q=0,b=0,Z=null,K=!1,ce=20,J=1,I=!1,O=!1,_=[];(0,t.useImperativeHandle)(Ae,()=>({getLastUpdatedTime:()=>e.current.currentTime,getDuration:()=>e.current.duration})),T.ZP.config({maxCount:1,getContainer:()=>$.current});const D=(0,t.useCallback)((a,me=!1)=>{let c={point:e.current.currentTime};Z?(c.log_id=Z,c.watch_duration=Le(_),c.total_duration=q):(N?(c.video_id=parseInt(y,10),c.course_id=N):c.video_id=y,c.duration=F,c.device=Se),me&&(c.ed="1");function H(){return ne(this,null,function*(){I=!0,Z=yield w==null?void 0:w(c),I=!1,a&&a()})}H()},[y,N]);(0,t.useEffect)(()=>{e.current&&(A.current.style.display="none",S.current.style.display="block"),T.ZP.destroy();let a=null;return ee.Z.isSupported&&ue&&r&&(r==null?void 0:r.indexOf(".m3u8"))<0?(a=ee.Z.createPlayer({type:"flv",volume:.8,cors:!0,url:r,muted:!1}),e.current&&(a.attachMediaElement(e.current),a.load())):e.current.setAttribute("src",r),V(),()=>{a&&(a.unload(),a.pause(),a.destroy(),a=null)}},[e,ue,r]);function se(){e.current.paused?(A.current.style.display="none",S.current.style.display="block"):(A.current.style.display="block",S.current.style.display="none")}function V(){j.current.style.display="none",Y.current.style.display="none",G.current.style.display="none",e.current.muted||e.current.volume===0?j.current.style.display="block":e.current.volume>0&&e.current.volume<=.5?Y.current.style.display="block":G.current.style.display="block"}(0,t.useEffect)(()=>{const a=document.getElementById("play"),me=document.querySelectorAll(".playback-icons use");function c(){f(),R&&!oe.current&&(e.current.currentTime=R),oe.current=!0,_.push(e.current.currentTime),K||(K=!0,i&&D())}function H(){return ne(this,null,function*(){se(),_.push(e.current.currentTime),i&&D(()=>{Z=null,b=0,K=!1,I=!1,O=!1,_=[],q=0,J=1},!0),Re()})}function W(){m.current.value=Math.round(e.current.currentTime),L.current.value=Math.round(e.current.currentTime)}function qe(){const n=P(Math.round(e.current.currentTime));U.current.innerText=`${n.hour>0?n.hour+":":""}${n.minutes}:${n.seconds}`,U.current.setAttribute("datetime",`${n.hour>0?" "+n.hour+" ":""}${n.minutes}m ${n.seconds}s`)}function ve(){var n,l,s,p,g,k,h;const E=Math.round((n=e.current)==null?void 0:n.duration);(s=(l=m.current)==null?void 0:l.setAttribute)==null||s.call(l,"max",E),(g=(p=L.current)==null?void 0:p.setAttribute)==null||g.call(p,"max",E);const d=P(E);x.current&&(x.current.innerText=`${d.hour>0?d.hour+":":""}${d.minutes}:${d.seconds}`,(h=(k=x.current).setAttribute)==null||h.call(k,"datetime",`${d.hour>0?" "+d.hour+" ":""}${d.minutes}m ${d.seconds}s`))}function fe(){try{const n=Math.round(e.current.duration);m.current.setAttribute("max",n),L.current.setAttribute("max",n);const l=P(n);x.current.innerText=`${l.hour>0?l.hour+":":""}${l.minutes}:${l.seconds}`,x.current.setAttribute("datetime",`${l.hour>0?" "+l.hour+" ":""}${l.minutes}m ${l.seconds}s`),W(),qe();const{width:s,height:p,x:g,y:k}=le.current.getBoundingClientRect();if(g<0||k<0||!s)return;if(!O){let h=e.current.currentTime,E=h-b;Math.abs(E)<10?(q+=Math.abs(E),b=h,I||q-J*ce>=0&&(J++,_.push(b),i&&D())):(b=h,i&&D())}}catch(n){console.log(n)}}function pe(){O=!0}function he(){e.current.playing&&_.push(e.current.currentTime,b),b=e.current.currentTime,O=!1}function Ee(){F=e.current.duration,F<=20&&(ce=F/3),e.current.addEventListener("play",c)}function Ze(n){n.preventDefault(),(0,M.vp)()?(e.current.style.width="100%",e.current.style.height="100%"):e.current.style.cssText=""}function ye(){B()}function be(n){if(!o){T.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");return}const l=n.target.dataset.seek?n.target.dataset.seek:n.target.value;e.current.currentTime=l,L.current.value=l,m.current.value=l}function _e(n){const l=Math.round(n.offsetX/n.target.clientWidth*parseInt(n.target.getAttribute("max"),10));m.current.setAttribute("data-seek",l);const s=P(l);X.current.textContent=`${s.hour>0?s.hour+":":""}${s.minutes}:${s.seconds}`;const p=e.current.getBoundingClientRect();X.current.style.left=`${n.pageX-p.left}px`}function ge(n){switch(n.code){case"Space":n.preventDefault(),de();break;case"ArrowRight":if(n.preventDefault(),!o){T.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");break}if(e.current.currentTime>=e.current.duration)break;e.current.currentTime=parseInt(e.current.currentTime)+5,W();break;case"ArrowLeft":if(n.preventDefault(),!o){T.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");break}if(e.current.currentTime===0)break;e.current.currentTime=parseInt(e.current.currentTime)-5,W();break;case"ArrowUp":n.preventDefault(),e.current.volume<1&&(e.current.volume=(parseInt(e.current.volume*10)+1)/10);break;case"ArrowDown":n.preventDefault(),e.current.volume>0&&(e.current.volume=(parseInt(e.current.volume*10)-1)/10);break}}return $.current.addEventListener((0,M.gH)(),Ze),e.current.addEventListener("canplay",Ee),e.current.addEventListener("ended",H),e.current.addEventListener("seeking",pe),e.current.addEventListener("seeked",he),e.current.addEventListener("loadedmetadata",ve),m.current.addEventListener("mousemove",_e),m.current.addEventListener("input",be),e.current.addEventListener("timeupdate",fe),e.current.addEventListener("pause",ye),e.current.addEventListener("volumechange",V),document.addEventListener("keydown",ge),()=>{var n,l,s,p,g,k,h,E,d,ke,Te,xe;(n=e.current)==null||n.removeEventListener("canplay",Ee),(l=e.current)==null||l.removeEventListener("play",c),(s=e.current)==null||s.removeEventListener("ended",H),(p=e.current)==null||p.removeEventListener("seeking",pe),(g=e.current)==null||g.removeEventListener("seeked",he),(k=m.current)==null||k.removeEventListener("mousemove",_e),(h=m.current)==null||h.removeEventListener("input",be),(E=e.current)==null||E.removeEventListener("timeupdate",fe),(d=e.current)==null||d.removeEventListener("pause",ye),(ke=e.current)==null||ke.removeEventListener("loadedmetadata",ve),(Te=e.current)==null||Te.removeEventListener("volumechange",V),document.removeEventListener("keydown",ge),(xe=e.current)!=null&&xe.playing&&(_.push(b,e.current.currentTime),i&&D())}},[e,r]),(0,t.useEffect)(()=>{if(e.current.onended=()=>{z(e)},e.current.oncontextmenu=()=>!1,(r==null?void 0:r.indexOf(".m3u8"))>-1){if(e.current.canPlayType("application/vnd.apple.mpegurl"))e.current.src=r;else if(te.ZP.isSupported()){var a=new te.ZP;a.loadSource(r),a.attachMedia(e.current)}}},[r]);const[Ve,Q]=(0,t.useState)(1),de=()=>{e.current.paused||e.current.ended?e.current.play():e.current.pause(),se()};function Fe(){e.current.muted=!e.current.muted,e.current.muted?(C.current.setAttribute("data-volume",volume.value),C.current.value=0):C.current.value=C.current.dataset.volume}return t.createElement("div",{style:{position:"relative"},ref:$},t.createElement("div",{ref:le,className:`${u.watermark} animated_alternate animate__animated_10s animate__infinite animate__stepstart ${u.animate__loop}`},$e&&ie?ie.login:" "),t.createElement("div",{className:u.container},t.createElement("div",{className:u["video-container"],id:"video-container"},t.createElement("div",{className:u["playback-animation"],id:"playback-animation"},t.createElement("svg",{className:u["playback-icons"]},t.createElement("use",{className:"hidden",href:"#play-icon"}),t.createElement("use",{href:"#pause"}))),t.createElement("video",{className:u.video,id:"video",preload:"auto",disablePictureInPicture:!0,ref:e,autoPlay:Pe}),t.createElement("div",{className:`${u["video-controls"]} `,id:"video-controls"},t.createElement("div",{className:u["bottom-controls"]},t.createElement("div",{className:u["left-controls"]},t.createElement("button",{"data-title":"\u64AD\u653E/\u6682\u505C",id:"play",onClick:de},t.createElement("svg",{className:u["playback-icons"]},t.createElement("use",{ref:S,href:"#play-icon"}),t.createElement("use",{ref:A,style:{display:"none"},href:"#pause"}))),t.createElement("div",{className:u.time},t.createElement("time",{id:"time-elapsed",ref:U},"00:00"),t.createElement("span",null," / "),t.createElement("time",{id:"duration",ref:x},"00:00"))),t.createElement("div",{className:u["right-controls"]},o&&t.createElement(we.Z,{placement:"top",overlayClassName:u.rateOverlay,getPopupContainer:a=>a.parentNode,menu:{items:[{key:"1",label:t.createElement("span",{onClick:()=>{Q(1),e.current.playbackRate=1}},"1.0x")},{key:"2",label:t.createElement("span",{onClick:()=>{Q(1.5),e.current.playbackRate=1.5}},"1.5x")},{key:"3",label:t.createElement("span",{onClick:()=>{Q(2),e.current.playbackRate=2}},"2.0x")}]}},t.createElement("div",{className:`${u.controlText} mr5`},"\u500D\u901F")),t.createElement(Be.CopyToClipboard,{text:r,onCopy:()=>T.ZP.success("\u590D\u5236\u6210\u529F")},t.createElement("button",{"data-title":"\u590D\u5236\u94FE\u63A5"},t.createElement("i",{className:"icon-lianjie2 iconfont",style:{fontSize:"12px",color:"white"}}))),t.createElement("div",{className:u["volume-controls"]},t.createElement("button",{"data-title":"\u5F00\u542F/\u5173\u95ED\u58F0\u97F3",className:u["volume-button"],id:"volume-button",onClick:Fe},t.createElement("i",{ref:j,className:"icon-a-bianzu8 iconfont",style:{fontSize:"14px",color:"white"}}),t.createElement("i",{ref:Y,className:"icon-shengyinkaibeifen iconfont",style:{fontSize:"14px",color:"white"}}),t.createElement("i",{ref:G,className:"icon-shengyinkai iconfont",style:{fontSize:"14px",color:"white"}})),t.createElement("input",{className:u.volume,id:"volume",value:"1","data-mute":"0.5",type:"range",max:"1",min:"0",step:"0.01",ref:C,style:{display:"none"},onClick:V})),t.createElement("button",{"data-title":"\u5168\u5C4F/\u9000\u51FA\u5168\u5C4F",className:u["fullscreen-button"],onClick:()=>{(0,M.vp)()?(0,M.BU)():(0,M.Dj)($.current)}},t.createElement("i",{className:"icon-fangda1 iconfont",style:{fontSize:"12px",color:"white"}})))),t.createElement("div",{className:u["video-progress"]},t.createElement("progress",{ref:L,value:"0",min:"0"}),t.createElement("input",{className:u.seek,ref:m,value:"0",min:"0",type:"range",step:"1"}),t.createElement("div",{className:u["seek-tooltip"],ref:X,id:"seek-tooltip"},"00:00"))))),t.createElement("svg",{style:{display:"none"}},t.createElement("defs",null,t.createElement("symbol",{id:"pause",viewBox:"0 0 24 24"},t.createElement("path",{d:"M14.016 5.016h3.984v13.969h-3.984v-13.969zM6 18.984v-13.969h3.984v13.969h-3.984z"})),t.createElement("symbol",{id:"play-icon",viewBox:"0 0 24 24"},t.createElement("path",{d:"M8.016 5.016l10.969 6.984-10.969 6.984v-13.969z"})),t.createElement("symbol",{id:"volume-high",viewBox:"0 0 24 24"},t.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"})),t.createElement("symbol",{id:"volume-low",viewBox:"0 0 24 24"},t.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"})),t.createElement("symbol",{id:"volume-mute",viewBox:"0 0 24 24"},t.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"})),t.createElement("symbol",{id:"fullscreen",viewBox:"0 0 24 24"},t.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"})),t.createElement("symbol",{id:"fullscreen-exit",viewBox:"0 0 24 24"},t.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"})),t.createElement("symbol",{id:"pip",viewBox:"0 0 24 24"},t.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"})))))})}}]);