dplayer_ku1001.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">
  5. <style>body{margin:0;padding:0}video{width:100%;height:100%}.dplayer-setting-loop,.dplayer-full-in-icon,.dplayer-mobile-play,.dplayer-bezel{display:none!important}.dplayer-info-panel{width:472px!important}.dplayer-info-panel-item-data{width:358px!important}.dplayer-info-panel-item-url .dplayer-info-panel-item-data{white-space:normal!important;word-break:break-all!important}.dplayer-menu,.dplayer-info-panel,.dplayer-setting-box,.dplayer-notice,.dplayer-quality-list,.dplayer-subtitles-box{border-radius:8px!important}.dplayer-play-icon,.dplayer-icons-left{display:inline-block!important}</style>
  6. </head>
  7. <body>
  8. <div id="dplayer"></div>
  9. <script src="https://fastly.jsdelivr.net/npm/dplayer/dist/DPlayer.min.js"></script>
  10. <script>
  11. let sc=location.search.substring(3);
  12. var source=/(^.*?)&(title|poster|next)=/.test(sc)?RegExp.$1:sc;
  13. if(/(http.+?\b(m3u8|mp4|flv|mpd))(&|@|\||#)/.test(source))source=RegExp.$1;
  14. try{document.title=decodeURIComponent(/&title=([^&]+)/.test(sc)?RegExp.$1:(/([^\/&=]+(?<!index)\.(mp4|ogg|webm|m3u8|flv|mkv|mpd))\b/.test(source)?RegExp.$1:source.replace(/^https?:\/\//,'')))}catch(e){};
  15. var doption={container:document.getElementById("dplayer"),autoplay:true,video:{url:source},airplay:false,hotkey:false,screenshot:false,preload:"auto"};
  16. var dp;
  17. if(/&poster=(http.+)(&title=|&next=|$)/.test(sc)){doption.video.pic=RegExp.$1};
  18. var insertjs=(jsrc,jfn)=>{let tjs=document.createElement('script');tjs.src=jsrc;tjs.type='text/javascript';let dha=document.getElementsByTagName("head")[0];dha.appendChild(tjs);tjs.onload=jfn};
  19. if(/m3u8|gdtv\.php/.test(source)){
  20. let vid=document.createElement("video");
  21. let vcan=vid.canPlayType("application/x-mpegURL")||vid.canPlayType("application/vnd.apple.mpegURL");
  22. if(vcan!="probably"){
  23. insertjs("https://fastly.jsdelivr.net/npm/hls.js/dist/hls.min.js",()=>{
  24. if(window.Hls&&Hls.isSupported()){
  25. doption.video.type="customHls";
  26. var hls=new Hls();
  27. hls.loadSource(source);
  28. hls.on(Hls.Events.MANIFEST_LOADED,function(event,data){
  29. if(hls.levels[0].details&&hls.levels[0].details.live){doption.live=true};
  30. if(doption.autoplay)doption.autoplay=false;
  31. dp=new DPlayer(doption);
  32. hls.attachMedia(dp.video);
  33. dp.play()
  34. });
  35. window.hls=hls
  36. }else{
  37. dp=new DPlayer(doption);
  38. }
  39. })
  40. }else{dp=new DPlayer(doption);}
  41. }else{
  42. let dtype,tjs;
  43. var initPlyrFn=()=>{
  44. doption.video.type=dtype;
  45. dp=new DPlayer(doption);
  46. };
  47. if(/.flv(#|\?|$)/i.exec(source)){dtype="flv";tjs="https://cdn.jsdelivr.net/npm/flv.js/dist/flv.min.js";insertjs(tjs,initPlyrFn)}
  48. else if(/.mpd(#|\?|$)/i.exec(source)){dtype="shakaDash";tjs="https://cdn.jsdelivr.net/npm/shaka-player/dist/shaka-player.compiled.min.js";doption.video.customType={shakaDash: function(video,player){var src=video.src;var playerShaka=new shaka.Player(video);playerShaka.load(src)}};insertjs(tjs,initPlyrFn)}
  49. else{dtype="normal";initPlyrFn()}
  50. }
  51. </script>
  52. </body>
  53. </html>