import{D as t}from"./chunk-C2rd06Pa.js";import{H as e}from"./chunk-CiYjHJ2H.js";import{C as o}from"./souav-I_ihqEhP.js";class i{static initPlayer(r,a){let s;const l={theme:"#f21c11",loop:!1,lang:"zh-cn",screenshot:!1,hotkey:!0,preload:"auto",volume:.7,mutex:!0,container:document.getElementById(r),autoplay:!1,video:{url:a,type:"hls"}};s=new t(l);const n=s.video;try{const t=!!window.MediaSource;if(e.isSupported()&&t||o.isQQBrowser()||o.isSogouBrowser()){const t=new e({maxBufferLength:60,maxMaxRetry:5,maxRetry:3,retryDelay:1e3,maxRetryDelay:5e3,backoff:"exponential"});t.loadSource(a),t.attachMedia(n)}else n.canPlayType("application/vnd.apple.mpegurl")&&(n.src=a);i.updateVideoControls(n)}catch(d){n.canPlayType("application/vnd.apple.mpegurl")&&(n.src=a,i.updateVideoControls(n))}return s}static updateVideoControls(t){i.setVideoAttrs(t),i.hideVideoControls(".dplayer-notice-list"),i.hideVideoControls(".dplayer-comment"),i.hideVideoControls(".dplayer-setting-danunlimit"),i.hideVideoControls(".dplayer-setting-showdan"),i.hideVideoControls(".dplayer-setting-danmaku")}static setVideoAttrs(t){t.muted=!0,t.setAttribute("raw-controls",""),t.setAttribute("preload",""),t.setAttribute("webkit-playsinline",""),t.setAttribute("playsinline",""),t.setAttribute("x5-playsinline",""),t.setAttribute("x5-video-player-fullscreen",""),t.setAttribute("x5-video-player-type","h5-page"),t.setAttribute("x5-video-player-orientation","portrait"),t.setAttribute("t7-video-player-type","inline"),t.setAttribute("disablepictureinpicture",""),t.setAttribute("controlslist","nodownload"),t.setAttribute("x-webkit-airplay","allow"),t.setAttribute("preload","metadata"),t.setAttribute("controls360","no")}static hideVideoControls(t){let e=document.querySelector(t);e&&(e.style.display="none")}static showVideoControls(t){let e=document.querySelector(t);e&&(e.style.display="block")}}export{i as D};
