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/45812.9ab454ae.async.js

1 line
16 KiB

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[45812],{45812:function(e,t,n){n.d(t,{Z:function(){return g}});var r=n(79800),c=n.n(r),o=n(7557),u=n.n(o),i=n(41498),s=n.n(i),a=n(59301),l=n(8591),d=n(38854),v=n(30335),m=n(24830),p=n(74505),h=n(56102),f=n(26653),y={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"},x=n(37712);function b(e){if(isNaN(e))return{minutes:"00",seconds:"00"};var t=new Date(1e3*e).toISOString().substr(11,8);return{hour:t.substr(0,2),minutes:t.substr(3,2),seconds:t.substr(6,2)}}function _(e,t){return e-t}function k(e){e.sort(_);for(var t=0,n=0;n<e.length-1;n++){var r=Math.abs(e[n+1]-e[n]);r<21&&(t+=r)}return t}Object.defineProperty(HTMLMediaElement.prototype,"playing",{get:function(){return!!(this.currentTime>0&&!this.paused&&!this.ended&&this.readyState>2)}});var w=/(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i,g=(0,a.forwardRef)((function(e,t){var n,r,o=e.allow_skip,i=e.src,_=e.toLog,g=e.videoId,j=e.logWatchHistory,E=e.courseId,M=void 0===E?null:E,z=e.startTime,T=e.handlePause,L=void 0===T?function(){}:T,N=e.handlePlay,R=void 0===N?function(){}:N,q=e.handlePlayEnded,C=void 0===q?function(){}:q,S=e.autoPlay,P=void 0!==S&&S,F=e.onPlayEnded,A=void 0===F?function(){}:F,B=e.isShowWaterMark,D=void 0===B||B,Z="flv"===(null===(r=i=null===(n=i)||void 0===n?void 0:n.replace("http://","https://"))||void 0===r||null===(r=r.split("."))||void 0===r?void 0:r.pop()),I=(0,a.useRef)(),H=(0,a.useRef)(),O=(0,a.useRef)(),W=(0,a.useRef)(),U=(0,a.useRef)(),X=(0,a.useRef)(),G=(0,a.useRef)(),Y=(0,a.useRef)(),V=(0,a.useRef)(),J=(0,a.useRef)(),K=(0,a.useRef)(),Q=(0,a.useRef)(),$=(0,a.useRef)(),ee=(0,a.useRef)(),te=navigator.userAgent.toLowerCase().match(w),ne=te?te[0]:"pc",re=(0,a.useRef)(!1),ce=(0,p.eY)(),oe=0,ue=0,ie=0,se=null,ae=!1,le=20,de=1,ve=!1,me=!1,pe=[];(0,a.useImperativeHandle)(t,(function(){return{getLastUpdatedTime:function(){return I.current.currentTime},getDuration:function(){return I.current.duration}}})),l.ZP.config({maxCount:1,getContainer:function(){return O.current}});var he=(0,a.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={point:I.current.currentTime};function r(){return c.apply(this,arguments)}function c(){return(c=s()(u()().mark((function t(){var r;return u()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ve=!0,t.next=3,null==j?void 0:j(n);case 3:r=t.sent,se=r,ve=!1,e&&e();case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}se?(n.log_id=se,n.watch_duration=k(pe),n.total_duration=ue):(M?(n.video_id=parseInt(g,10),n.course_id=M):n.video_id=g,n.duration=oe,n.device=ne),t&&(n.ed="1"),r()}),[g,M]);function fe(){I.current.paused?(W.current.style.display="none",U.current.style.display="block"):(W.current.style.display="block",U.current.style.display="none")}function ye(){K.current.style.display="none",$.current.style.display="none",Q.current.style.display="none",I.current.muted||0===I.current.volume?K.current.style.display="block":I.current.volume>0&&I.current.volume<=.5?$.current.style.display="block":Q.current.style.display="block"}(0,a.useEffect)((function(){var e;I.current&&(W.current.style.display="none",U.current.style.display="block"),l.ZP.destroy();var t=null;return v.Z.isSupported&&Z&&i&&(null===(e=i)||void 0===e?void 0:e.indexOf(".m3u8"))<0?(t=v.Z.createPlayer({type:"flv",volume:.8,cors:!0,url:i,muted:!1}),I.current&&(t.attachMediaElement(I.current),t.load())):I.current.setAttribute("src",i),ye(),function(){t&&(t.unload(),t.pause(),t.destroy(),t=null)}}),[I,Z,i]),(0,a.useEffect)((function(){document.getElementById("play"),document.querySelectorAll(".playback-icons use");function e(){R(),z&&!re.current&&(I.current.currentTime=z),re.current=!0,pe.push(I.current.currentTime),ae||(ae=!0,_&&he())}function t(){return n.apply(this,arguments)}function n(){return(n=s()(u()().mark((function e(){return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:fe(),pe.push(I.current.currentTime),_&&he((function(){se=null,ie=0,ae=!1,ve=!1,me=!1,pe=[],ue=0,de=1}),!0),A();case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function r(){X.current.value=Math.round(I.current.currentTime),G.current.value=Math.round(I.current.currentTime)}function c(){var e=Math.round(I.current.duration);X.current.setAttribute("max",e),G.current.setAttribute("max",e);var t=b(e);Y.current.innerText="".concat(t.hour>0?t.hour+":":"").concat(t.minutes,":").concat(t.seconds),Y.current.setAttribute("datetime","".concat(t.hour>0?" "+t.hour+" ":"").concat(t.minutes,"m ").concat(t.seconds,"s"))}function i(){try{var e=Math.round(I.current.duration);X.current.setAttribute("max",e),G.current.setAttribute("max",e);var t=b(e);Y.current.innerText="".concat(t.hour>0?t.hour+":":"").concat(t.minutes,":").concat(t.seconds),Y.current.setAttribute("datetime","".concat(t.hour>0?" "+t.hour+" ":"").concat(t.minutes,"m ").concat(t.seconds,"s")),r(),function(){var e=b(Math.round(I.current.currentTime));V.current.innerText="".concat(e.hour>0?e.hour+":":"").concat(e.minutes,":").concat(e.seconds),V.current.setAttribute("datetime","".concat(e.hour>0?" "+e.hour+" ":"").concat(e.minutes,"m ").concat(e.seconds,"s"))}();var n=H.current.getBoundingClientRect(),c=n.width,o=(n.height,n.x),u=n.y;if(o<0||u<0||!c)return;if(!me){var i=I.current.currentTime,s=i-ie;Math.abs(s)<10?(ue+=Math.abs(s),ie=i,ve||ue-de*le>=0&&(de++,pe.push(ie),_&&he())):(ie=i,_&&he())}}catch(e){console.log(e)}}function a(){me=!0}function d(){I.current.playing&&pe.push(I.current.currentTime,ie),ie=I.current.currentTime,me=!1}function v(){(oe=I.current.duration)<=20&&(le=oe/3),I.current.addEventListener("play",e)}function m(){L()}function p(e){if(o){var t=e.target.dataset.seek?e.target.dataset.seek:e.target.value;I.current.currentTime=t,G.current.value=t,X.current.value=t}else l.ZP.warning("该视频禁止快进/后退播放")}function h(e){var t=Math.round(e.offsetX/e.target.clientWidth*parseInt(e.target.getAttribute("max"),10));X.current.setAttribute("data-seek",t);var n=b(t);J.current.textContent="".concat(n.hour>0?n.hour+":":"").concat(n.minutes,":").concat(n.seconds);var r=I.current.getBoundingClientRect();J.current.style.left="".concat(e.pageX-r.left,"px")}function y(e){switch(e.code){case"Space":e.preventDefault(),ke();break;case"ArrowRight":if(e.preventDefault(),!o){l.ZP.warning("该视频禁止快进/后退播放");break}if(I.current.currentTime>=I.current.duration)break;I.current.currentTime=parseInt(I.current.currentTime)+5,r();break;case"ArrowLeft":if(e.preventDefault(),!o){l.ZP.warning("该视频禁止快进/后退播放");break}if(0===I.current.currentTime)break;I.current.currentTime=parseInt(I.current.currentTime)-5,r();break;case"ArrowUp":e.preventDefault(),I.current.volume<1&&(I.current.volume=(parseInt(10*I.current.volume)+1)/10);break;case"ArrowDown":e.preventDefault(),I.current.volume>0&&(I.current.volume=(parseInt(10*I.current.volume)-1)/10)}}return O.current.addEventListener((0,f.gH)(),(function(e){e.preventDefault(),(0,f.vp)()?(I.current.style.width="100%",I.current.style.height="100%"):I.current.style.cssText=""})),I.current.addEventListener("canplay",v),I.current.addEventListener("ended",t),I.current.addEventListener("seeking",a),I.current.addEventListener("seeked",d),I.current.addEventListener("loadedmetadata",c),X.current.addEventListener("mousemove",h),X.current.addEventListener("input",p),I.current.addEventListener("timeupdate",i),I.current.addEventListener("pause",m),I.current.addEventListener("volumechange",ye),document.addEventListener("keydown",y),function(){var n,r,o,u,s,l,f,x,b,k,w,g;null===(n=I.current)||void 0===n||n.removeEventListener("canplay",v),null===(r=I.current)||void 0===r||r.removeEventListener("play",e),null===(o=I.current)||void 0===o||o.removeEventListener("ended",t),null===(u=I.current)||void 0===u||u.removeEventListener("seeking",a),null===(s=I.current)||void 0===s||s.removeEventListener("seeked",d),null===(l=X.current)||void 0===l||l.removeEventListener("mousemove",h),null===(f=X.current)||void 0===f||f.removeEventListener("input",p),null===(x=I.current)||void 0===x||x.removeEventListener("timeupdate",i),null===(b=I.current)||void 0===b||b.removeEventListener("pause",m),null===(k=I.current)||void 0===k||k.removeEventListener("loadedmetadata",c),null===(w=I.current)||void 0===w||w.removeEventListener("volumechange",ye),document.removeEventListener("keydown",y),null!==(g=I.current)&&void 0!==g&&g.playing&&(pe.push(ie,I.current.currentTime),_&&he())}}),[I,i]),(0,a.useEffect)((function(){var e;if(I.current.onended=function(){C(I)},I.current.oncontextmenu=function(){return!1},(null===(e=i)||void 0===e?void 0:e.indexOf(".m3u8"))>-1)if(I.current.canPlayType("application/vnd.apple.mpegurl"))I.current.src=i;else if(m.ZP.isSupported()){var t=new m.ZP;t.loadSource(i),t.attachMedia(I.current)}}),[i]);var xe=(0,a.useState)(1),be=c()(xe,2),_e=(be[0],be[1]),ke=function(){I.current.paused||I.current.ended?I.current.play():I.current.pause(),fe()};return(0,x.jsxs)("div",{style:{position:"relative"},ref:O,children:[(0,x.jsx)("div",{ref:H,className:"".concat(y.watermark," animated_alternate animate__animated_10s animate__infinite animate__stepstart ").concat(y.animate__loop),children:D&&ce?ce.login:" "}),(0,x.jsx)("div",{className:y.container,children:(0,x.jsxs)("div",{className:y["video-container"],id:"video-container",children:[(0,x.jsx)("div",{className:y["playback-animation"],id:"playback-animation",children:(0,x.jsxs)("svg",{className:y["playback-icons"],children:[(0,x.jsx)("use",{className:"hidden",href:"#play-icon"}),(0,x.jsx)("use",{href:"#pause"})]})}),(0,x.jsx)("video",{className:y.video,id:"video",preload:"auto",disablePictureInPicture:!0,ref:I,autoPlay:P}),(0,x.jsxs)("div",{className:"".concat(y["video-controls"]," "),id:"video-controls",children:[(0,x.jsxs)("div",{className:y["bottom-controls"],children:[(0,x.jsxs)("div",{className:y["left-controls"],children:[(0,x.jsx)("button",{"data-title":"播放/暂停",id:"play",onClick:ke,children:(0,x.jsxs)("svg",{className:y["playback-icons"],children:[(0,x.jsx)("use",{ref:U,href:"#play-icon"}),(0,x.jsx)("use",{ref:W,style:{display:"none"},href:"#pause"})]})}),(0,x.jsxs)("div",{className:y.time,children:[(0,x.jsx)("time",{id:"time-elapsed",ref:V,children:"00:00"}),(0,x.jsx)("span",{children:" / "}),(0,x.jsx)("time",{id:"duration",ref:Y,children:"00:00"})]})]}),(0,x.jsxs)("div",{className:y["right-controls"],children:[o&&(0,x.jsx)(d.Z,{placement:"top",overlayClassName:y.rateOverlay,getPopupContainer:function(e){return e.parentNode},menu:{items:[{key:"1",label:(0,x.jsx)("span",{onClick:function(){_e(1),I.current.playbackRate=1},children:"1.0x"})},{key:"2",label:(0,x.jsx)("span",{onClick:function(){_e(1.5),I.current.playbackRate=1.5},children:"1.5x"})},{key:"3",label:(0,x.jsx)("span",{onClick:function(){_e(2),I.current.playbackRate=2},children:"2.0x"})}]},children:(0,x.jsx)("div",{className:"".concat(y.controlText," mr5"),children:"倍速"})}),(0,x.jsx)(h.CopyToClipboard,{text:i,onCopy:function(){return l.ZP.success("复制成功")},children:(0,x.jsx)("button",{"data-title":"复制链接",children:(0,x.jsx)("i",{className:"icon-lianjie2 iconfont",style:{fontSize:"12px",color:"white"}})})}),(0,x.jsxs)("div",{className:y["volume-controls"],children:[(0,x.jsxs)("button",{"data-title":"开启/关闭声音",className:y["volume-button"],id:"volume-button",onClick:function(){I.current.muted=!I.current.muted,I.current.muted?(ee.current.setAttribute("data-volume",volume.value),ee.current.value=0):ee.current.value=ee.current.dataset.volume},children:[(0,x.jsx)("i",{ref:K,className:"icon-a-bianzu8 iconfont",style:{fontSize:"14px",color:"white"}}),(0,x.jsx)("i",{ref:$,className:"icon-shengyinkaibeifen iconfont",style:{fontSize:"14px",color:"white"}}),(0,x.jsx)("i",{ref:Q,className:"icon-shengyinkai iconfont",style:{fontSize:"14px",color:"white"}})]}),(0,x.jsx)("input",{className:y.volume,id:"volume",value:"1","data-mute":"0.5",type:"range",max:"1",min:"0",step:"0.01",ref:ee,style:{display:"none"},onClick:ye})]}),(0,x.jsx)("button",{"data-title":"全屏/退出全屏",className:y["fullscreen-button"],onClick:function(){(0,f.vp)()?(0,f.BU)():(0,f.Dj)(O.current)},children:(0,x.jsx)("i",{className:"icon-fangda1 iconfont",style:{fontSize:"12px",color:"white"}})})]})]}),(0,x.jsxs)("div",{className:y["video-progress"],children:[(0,x.jsx)("progress",{ref:G,value:"0",min:"0"}),(0,x.jsx)("input",{className:y.seek,ref:X,value:"0",min:"0",type:"range",step:"1"}),(0,x.jsx)("div",{className:y["seek-tooltip"],ref:J,id:"seek-tooltip",children:"00:00"})]})]})]})}),(0,x.jsx)("svg",{style:{display:"none"},children:(0,x.jsxs)("defs",{children:[(0,x.jsx)("symbol",{id:"pause",viewBox:"0 0 24 24",children:(0,x.jsx)("path",{d:"M14.016 5.016h3.984v13.969h-3.984v-13.969zM6 18.984v-13.969h3.984v13.969h-3.984z"})}),(0,x.jsx)("symbol",{id:"play-icon",viewBox:"0 0 24 24",children:(0,x.jsx)("path",{d:"M8.016 5.016l10.969 6.984-10.969 6.984v-13.969z"})}),(0,x.jsx)("symbol",{id:"volume-high",viewBox:"0 0 24 24",children:(0,x.jsx)("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"})}),(0,x.jsx)("symbol",{id:"volume-low",viewBox:"0 0 24 24",children:(0,x.jsx)("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"})}),(0,x.jsx)("symbol",{id:"volume-mute",viewBox:"0 0 24 24",children:(0,x.jsx)("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"})}),(0,x.jsx)("symbol",{id:"fullscreen",viewBox:"0 0 24 24",children:(0,x.jsx)("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"})}),(0,x.jsx)("symbol",{id:"fullscreen-exit",viewBox:"0 0 24 24",children:(0,x.jsx)("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"})}),(0,x.jsx)("symbol",{id:"pip",viewBox:"0 0 24 24",children:(0,x.jsx)("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"})})]})})]})}))},26653:function(e,t,n){function r(e){try{e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullScreen&&e.webkitRequestFullScreen()}catch(e){console.log(e,":e")}}function c(){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()}n.d(t,{BU:function(){return c},Dj:function(){return r},gH:function(){return o},vp:function(){return u}});var o=function(){return document.webkitExitFullscreen?"webkitfullscreenchange":document.exitFullscreen?"fullscreenchange":document.msExitFullscreen?"msfullscreenchange":document.mozCancelFullScreen?"mozfullscreenchange":void 0};function u(){var e=window.top.document.fullscreenElement||window.top.document.mozFullscreenElement||window.top.document.webkitFullscreenElement;document.fullscreenEnabled||document.mozFullscreenEnabled||document.webkitFullscreenEnabled;return console.log("fullscreenElement",e),null!=e}}}]);