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