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
15 KiB
1 line
15 KiB
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[14469],{14469:function(e,t,n){n.d(t,{Z:function(){return j}});var r=n(79800),i=n.n(r),o=n(7557),c=n.n(o),u=n(41498),a=n.n(u),s=n(59301),l=n(8591),d=n(38854),v=n(61257),m=n(24830),h=n(96107),p=n(56102),f=n(43229),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 _(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 b(e,t){return e-t}function k(e){e.sort(b);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,s.forwardRef)((function(e,t){var n,r,o=e.allow_skip,u=e.src,b=e.toLog,j=e.videoId,w=e.logWatchHistory,M=e.courseId,E=void 0===M?null:M,T=e.startTime,L=e.handlePause,N=void 0===L?function(){}:L,z=e.handlePlay,R=void 0===z?function(){}:z,q=e.handlePlayEnded,P=void 0===q?function(){}:q,C=e.autoPlay,A=void 0!==C&&C,B=e.onPlayEnded,S=void 0===B?function(){}:B,Z=e.isShowWaterMark,D=void 0===Z||Z,I="flv"===(null===(r=u=null===(n=u)||void 0===n?void 0:n.replace("http://","https://"))||void 0===r||null===(r=r.split("."))||void 0===r?void 0:r.pop()),O=(0,s.useRef)(),H=(0,s.useRef)(),W=(0,s.useRef)(),X=(0,s.useRef)(),U=(0,s.useRef)(),G=(0,s.useRef)(),Y=(0,s.useRef)(),V=(0,s.useRef)(),F=(0,s.useRef)(),J=(0,s.useRef)(),K=(0,s.useRef)(),Q=(0,s.useRef)(),$=(0,s.useRef)(),ee=(0,s.useRef)(),te=navigator.userAgent.toLowerCase().match(g),ne=te?te[0]:"pc",re=(0,s.useRef)(!1),ie=(0,h.eY)(),oe=0,ce=0,ue=0,ae=null,se=!1,le=20,de=1,ve=!1,me=!1,he=[];(0,s.useImperativeHandle)(t,(function(){return{getLastUpdatedTime:function(){return O.current.currentTime},getDuration:function(){return O.current.duration}}})),l.ZP.config({maxCount:1,getContainer:function(){return W.current}});var pe=(0,s.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={point:O.current.currentTime};function r(){return i.apply(this,arguments)}function i(){return(i=a()(c()().mark((function t(){var r;return c()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ve=!0,t.next=3,null==w?void 0:w(n);case 3:r=t.sent,ae=r,ve=!1,e&&e();case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}ae?(n.log_id=ae,n.watch_duration=k(he),n.total_duration=ce):(E?(n.video_id=parseInt(j,10),n.course_id=E):n.video_id=j,n.duration=oe,n.device=ne),t&&(n.ed="1"),r()}),[j,E]);function fe(){O.current.paused?(X.current.style.display="none",U.current.style.display="block"):(X.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",O.current.muted||0===O.current.volume?K.current.style.display="block":O.current.volume>0&&O.current.volume<=.5?$.current.style.display="block":Q.current.style.display="block"}(0,s.useEffect)((function(){var e;O.current&&(X.current.style.display="none",U.current.style.display="block"),l.ZP.destroy();var t=null;return v.Z.isSupported&&I&&u&&(null===(e=u)||void 0===e?void 0:e.indexOf(".m3u8"))<0?(t=v.Z.createPlayer({type:"flv",volume:.8,cors:!0,url:u,muted:!1}),O.current&&(t.attachMediaElement(O.current),t.load())):O.current.setAttribute("src",u),ye(),function(){t&&(t.unload(),t.pause(),t.destroy(),t=null)}}),[O,I,u]),(0,s.useEffect)((function(){document.getElementById("play"),document.querySelectorAll(".playback-icons use");function e(){R(),T&&!re.current&&(O.current.currentTime=T),re.current=!0,he.push(O.current.currentTime),se||(se=!0,b&&pe())}function t(){return n.apply(this,arguments)}function n(){return(n=a()(c()().mark((function e(){return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:fe(),he.push(O.current.currentTime),b&&pe((function(){ae=null,ue=0,se=!1,ve=!1,me=!1,he=[],ce=0,de=1}),!0),S();case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function r(){G.current.value=Math.round(O.current.currentTime),Y.current.value=Math.round(O.current.currentTime)}function i(){var e=Math.round(O.current.duration);G.current.setAttribute("max",e),Y.current.setAttribute("max",e);var t=_(e);V.current.innerText="".concat(t.hour>0?t.hour+":":"").concat(t.minutes,":").concat(t.seconds),V.current.setAttribute("datetime","".concat(t.hour>0?" "+t.hour+" ":"").concat(t.minutes,"m ").concat(t.seconds,"s"))}function u(){try{var e=Math.round(O.current.duration);G.current.setAttribute("max",e),Y.current.setAttribute("max",e);var t=_(e);V.current.innerText="".concat(t.hour>0?t.hour+":":"").concat(t.minutes,":").concat(t.seconds),V.current.setAttribute("datetime","".concat(t.hour>0?" "+t.hour+" ":"").concat(t.minutes,"m ").concat(t.seconds,"s")),r(),function(){var e=_(Math.round(O.current.currentTime));F.current.innerText="".concat(e.hour>0?e.hour+":":"").concat(e.minutes,":").concat(e.seconds),F.current.setAttribute("datetime","".concat(e.hour>0?" "+e.hour+" ":"").concat(e.minutes,"m ").concat(e.seconds,"s"))}();var n=H.current.getBoundingClientRect(),i=n.width,o=(n.height,n.x),c=n.y;if(o<0||c<0||!i)return;if(!me){var u=O.current.currentTime,a=u-ue;Math.abs(a)<10?(ce+=Math.abs(a),ue=u,ve||ce-de*le>=0&&(de++,he.push(ue),b&&pe())):(ue=u,b&&pe())}}catch(e){console.log(e)}}function s(){me=!0}function d(){O.current.playing&&he.push(O.current.currentTime,ue),ue=O.current.currentTime,me=!1}function v(){(oe=O.current.duration)<=20&&(le=oe/3),O.current.addEventListener("play",e)}function m(){N()}function h(e){if(o){var t=e.target.dataset.seek?e.target.dataset.seek:e.target.value;O.current.currentTime=t,Y.current.value=t,G.current.value=t}else l.ZP.warning("该视频禁止快进/后退播放")}function p(e){var t=Math.round(e.offsetX/e.target.clientWidth*parseInt(e.target.getAttribute("max"),10));G.current.setAttribute("data-seek",t);var n=_(t);J.current.textContent="".concat(n.hour>0?n.hour+":":"").concat(n.minutes,":").concat(n.seconds);var r=O.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(O.current.currentTime>=O.current.duration)break;O.current.currentTime=parseInt(O.current.currentTime)+5,r();break;case"ArrowLeft":if(e.preventDefault(),!o){l.ZP.warning("该视频禁止快进/后退播放");break}if(0===O.current.currentTime)break;O.current.currentTime=parseInt(O.current.currentTime)-5,r();break;case"ArrowUp":e.preventDefault(),O.current.volume<1&&(O.current.volume=(parseInt(10*O.current.volume)+1)/10);break;case"ArrowDown":e.preventDefault(),O.current.volume>0&&(O.current.volume=(parseInt(10*O.current.volume)-1)/10)}}return W.current.addEventListener((0,f.gH)(),(function(e){e.preventDefault(),(0,f.vp)()?(O.current.style.width="100%",O.current.style.height="100%"):O.current.style.cssText=""})),O.current.addEventListener("canplay",v),O.current.addEventListener("ended",t),O.current.addEventListener("seeking",s),O.current.addEventListener("seeked",d),O.current.addEventListener("loadedmetadata",i),G.current.addEventListener("mousemove",p),G.current.addEventListener("input",h),O.current.addEventListener("timeupdate",u),O.current.addEventListener("pause",m),O.current.addEventListener("volumechange",ye),document.addEventListener("keydown",y),function(){var n,r,o,c,a,l,f,x,_,k,g,j;null===(n=O.current)||void 0===n||n.removeEventListener("canplay",v),null===(r=O.current)||void 0===r||r.removeEventListener("play",e),null===(o=O.current)||void 0===o||o.removeEventListener("ended",t),null===(c=O.current)||void 0===c||c.removeEventListener("seeking",s),null===(a=O.current)||void 0===a||a.removeEventListener("seeked",d),null===(l=G.current)||void 0===l||l.removeEventListener("mousemove",p),null===(f=G.current)||void 0===f||f.removeEventListener("input",h),null===(x=O.current)||void 0===x||x.removeEventListener("timeupdate",u),null===(_=O.current)||void 0===_||_.removeEventListener("pause",m),null===(k=O.current)||void 0===k||k.removeEventListener("loadedmetadata",i),null===(g=O.current)||void 0===g||g.removeEventListener("volumechange",ye),document.removeEventListener("keydown",y),null!==(j=O.current)&&void 0!==j&&j.playing&&(he.push(ue,O.current.currentTime),b&&pe())}}),[O,u]),(0,s.useEffect)((function(){var e;if(O.current.onended=function(){P(O)},O.current.oncontextmenu=function(){return!1},(null===(e=u)||void 0===e?void 0:e.indexOf(".m3u8"))>-1)if(O.current.canPlayType("application/vnd.apple.mpegurl"))O.current.src=u;else if(m.ZP.isSupported()){var t=new m.ZP;t.loadSource(u),t.attachMedia(O.current)}}),[u]);var xe=(0,s.useState)(1),_e=i()(xe,2),be=(_e[0],_e[1]),ke=function(){O.current.paused||O.current.ended?O.current.play():O.current.pause(),fe()};return(0,x.jsxs)("div",{style:{position:"relative"},ref:W,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&&ie?ie.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:O,autoPlay:A}),(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:X,style:{display:"none"},href:"#pause"})]})}),(0,x.jsxs)("div",{className:y.time,children:[(0,x.jsx)("time",{id:"time-elapsed",ref:F,children:"00:00"}),(0,x.jsx)("span",{children:" / "}),(0,x.jsx)("time",{id:"duration",ref:V,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(){be(1),O.current.playbackRate=1},children:"1.0x"})},{key:"2",label:(0,x.jsx)("span",{onClick:function(){be(1.5),O.current.playbackRate=1.5},children:"1.5x"})},{key:"3",label:(0,x.jsx)("span",{onClick:function(){be(2),O.current.playbackRate=2},children:"2.0x"})}]},children:(0,x.jsx)("div",{className:"".concat(y.controlText," mr5"),children:"倍速"})}),(0,x.jsx)(p.CopyToClipboard,{text:u,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(){O.current.muted=!O.current.muted,O.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)(W.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:Y,value:"0",min:"0"}),(0,x.jsx)("input",{className:y.seek,ref:G,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"})})]})})]})}))}}]); |