From b5b76fad8b247803acf52cf5ee9520b93df7c97d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=9A=E9=A3=8E=E6=8B=82=E6=9F=B3=E9=A2=9C?= <434857005@qq.com> Date: Fri, 2 Jun 2023 14:35:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=B8=A4=E5=A5=97=E9=80=9A=E7=94=A8=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 3 + base/rules.db | Bin 155648 -> 155648 bytes controllers/web.py | 9 + doc/更新日志.md | 3 + js/drpy.txt | 2 +- js/version.txt | 2 +- static/css/admin.css | 12 +- templates/admin.html | 1 + templates/player/mui/js/setting.js | 21 +- .../player/p2p-media-loader/DPlayer.min.css | 22 + .../player/p2p-media-loader/DPlayer.min.js | 2 + .../player/p2p-media-loader/class.main.js | 384 ++++++++++++++++++ templates/player/p2p-media-loader/hls.js | 2 + .../player/p2p-media-loader/images/line.png | Bin 0 -> 282 bytes .../player/p2p-media-loader/images/list.png | Bin 0 -> 167 bytes .../p2p-media-loader/images/loading_pc.jpg | Bin 0 -> 129805 bytes .../p2p-media-loader/images/loading_wap.gif | Bin 0 -> 12041 bytes .../p2p-media-loader/images/loading_wapx.gif | Bin 0 -> 42792 bytes .../player/p2p-media-loader/images/logo.png | Bin 0 -> 1564 bytes .../player/p2p-media-loader/images/next.png | Bin 0 -> 502 bytes .../player/p2p-media-loader/images/pront.png | Bin 0 -> 512 bytes .../player/p2p-media-loader/jquery.min.js | 2 + .../p2p-media-loader-core.min.js | 1 + .../p2p-media-loader-hlsjs.min.js | 1 + .../player/p2p-media-loader/p2pm3u8.html | 274 +++++++++++++ 25 files changed, 728 insertions(+), 13 deletions(-) create mode 100644 templates/player/p2p-media-loader/DPlayer.min.css create mode 100644 templates/player/p2p-media-loader/DPlayer.min.js create mode 100644 templates/player/p2p-media-loader/class.main.js create mode 100644 templates/player/p2p-media-loader/hls.js create mode 100644 templates/player/p2p-media-loader/images/line.png create mode 100644 templates/player/p2p-media-loader/images/list.png create mode 100644 templates/player/p2p-media-loader/images/loading_pc.jpg create mode 100644 templates/player/p2p-media-loader/images/loading_wap.gif create mode 100644 templates/player/p2p-media-loader/images/loading_wapx.gif create mode 100644 templates/player/p2p-media-loader/images/logo.png create mode 100644 templates/player/p2p-media-loader/images/next.png create mode 100644 templates/player/p2p-media-loader/images/pront.png create mode 100644 templates/player/p2p-media-loader/jquery.min.js create mode 100644 templates/player/p2p-media-loader/p2p-media-loader-core.min.js create mode 100644 templates/player/p2p-media-loader/p2p-media-loader-hlsjs.min.js create mode 100644 templates/player/p2p-media-loader/p2pm3u8.html diff --git a/.idea/misc.xml b/.idea/misc.xml index e8b403f..38af2c2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,7 @@ + + \ No newline at end of file diff --git a/base/rules.db b/base/rules.db index fea9491e278fb6b4736c6132be3dc578fc443e5f..22ca49d3befdec300a87d36256fd731e2046dbe7 100644 GIT binary patch delta 1652 zcmZ`(ZA@Eb6u#%)mV0SgU;0Hs2)$iOH(4n6vv996S7geP;R=~ya}MwW2a(xM85`Pv;do)R9GXWfo`vT5uFFHrD-HiI88_)qdRaD zTI8a?ZZQ`VRgjzLT%<4FF;gPrV_629T$s~!LA$CihD+!R{iph%zE*czH>Zp0LfTR> zOz3d^Ew$AS@2mUlP^PWeq0&H%LxV=r;0DW8n1oYs7#g4hc4DcchU;NiNz9flUYq`} zK>K++>>$bH_mhysEDYQ$GSbxVRGgZk!c>>`fPo-6#Mdxl4a?DtBnzC(v)-gQ$;U&9 zlknpl!)0)mX6t0GUKTkompT&IH^dpA*H`cJ@f_IJ;yzj6Wk&Lf630k9STpz&t3OBv zurkkhIYyKi7A#8=&^W!8MwEp*nPI(LJ?9e{Fl)P>f*ZC{5jV{m9~fPR1&HAxV$4v1 zoJC;}waNfEz#KgNv;lMNDaQ)^e!PBpL{o;ouU6)6km_(J6ssd0K$hiK$_ZXhka)qj z4Qa7fa2s*ctJ?y)m@DuPaoP|>C{OIUT%X^U$1LkPwQ=OsG0+iP4^x-p0_r4i#2@dpj zd-e}_UK;c?9rYaR?SCcfh;@$H961`XXPZx@3RC_pb}P5PGd!Q)@~pYCRO@Wl7qJ;I zXJ(F6wkOK9>sy<7kFYK;YsbxzQxR)Y+-t6M{i(Jlo#8&@Nu2vC-NBjrvtP0v&XZ*K zaAGb^zMnTo`XZJb$vpqK_{MDU`Nm(vl(Q12^$~N5swJ&8Ib-FD!>#m{(|LvGFGwz1 zKB5H`7%PIHs-J=%P55Q}L;UrE$%5a=2I?1WWeR#>hZCkeP3maSoZG|R{gC$C+| z{60M1>&@4CZGOHgFt6gOL4pCTX$B4w>z;x1Ym^-?*i`d0l&W_mK%4C`b|n)tas&$0 t@)&I0m@{iau&3j-<1u&+)Vm~Dm0dS=Re~f4*s8{j-_A@X`V9VF`X4mOq5A*; delta 671 zcmXX@Uq};i9KY}V+1+lsbEIwNn70xp4Bg%Bbi4U)D-%i|W)K>MnNcdHx6&a*cjz*%V&kapX#KuEDUu^j5czm=zHl$DJ z<33plO1^+1`Pv3<#Ba68lF>esr(9OiV3XdQn*3gxN*~FIbKh*78Vsm%ka)7ZNcTf8 zV#?r!u*$q<9x^)PqrcFLbP}(W!Bd(vb)oJGxPxpNsKh%J;NqziY+zP|8nFL`O?U@$ za2NWZmG}>K3SDu-Gh=JPkz3FFFyZxD@Uk|GNK67ja9doSOLGaXA8`_FlZt|OCD2); zuu!=dIfi=NFp60XDoJs#P*fyEsgtETB`C^LNNEiD<$AS2QUWqj#Nj6RRPM-<)&Sm&rUb<_W+_!oVcme)5*R{E8opXXk`ii= z>l-xHFZl_)lZIiSP0xwA@!`GmV084L9GV|%kihLP;Q~dPHueuWir#2YOR_Bogwte6 zQ5%WEe!_uf2El}?vT&T_ZXfDFO$zvB;@5$W<5}ncXhWHkP+?Y8O;w4X<{q@gLb(zC ROf#~q_#KB<;T8N|`3JP@#9IIW diff --git a/controllers/web.py b/controllers/web.py index 8edef9d..3775b07 100644 --- a/controllers/web.py +++ b/controllers/web.py @@ -46,6 +46,15 @@ def custom_static_player(filename): # print(filename) return send_from_directory('templates/player', filename) +@web.route('/player1') +def custom_player1(): + ctx = getParmas() + return render_template('player/mui/index.html', ctx=ctx) + +@web.route('/player2') +def custom_player2(): + ctx = getParmas() + return render_template('player/p2p-media-loader/p2pm3u8.html', ctx=ctx) @web.route('//') def web_index(web_name, theme): diff --git a/doc/更新日志.md b/doc/更新日志.md index 33b5ee0..57d01ee 100644 --- a/doc/更新日志.md +++ b/doc/更新日志.md @@ -1,3 +1,6 @@ +###### 2023/06/02 +- [X] 3.9.42beta22 后台管理增加两套通用在线播放器地址 + ###### 2023/05/12 - [X] 3.9.42beta1 后端代理解决302跨域问题,支持部分源的网页播放功能,由于无法解决嗅探跨域问题,网页版项目终结 diff --git a/js/drpy.txt b/js/drpy.txt index 117d359..f1301a4 100644 --- a/js/drpy.txt +++ b/js/drpy.txt @@ -1 +1 @@ -{"showTime":89200000,"txt":"drpy 3.9.42beta1 -道长"} \ No newline at end of file +{"showTime":89200000,"txt":"drpy 3.9.42beta22 -道长"} \ No newline at end of file diff --git a/js/version.txt b/js/version.txt index c633f81..570215a 100644 --- a/js/version.txt +++ b/js/version.txt @@ -1 +1 @@ -3.9.42beta21 \ No newline at end of file +3.9.42beta22 \ No newline at end of file diff --git a/static/css/admin.css b/static/css/admin.css index f8eca8d..cc71da0 100644 --- a/static/css/admin.css +++ b/static/css/admin.css @@ -124,7 +124,17 @@ body { font-size: 15px; padding-left: 5px } - +.btn-player{ + border-radius: 25px; + font-size: 15px; + padding-left: 5px; + padding-right: 5px; + text-align: center; + border: #1e98d4; + color: #FFFFFF; + text-decoration: none; + background-image: linear-gradient(to right, rgb(71, 74, 252), rgb(252, 70, 243)); +} .ver { font-size: 16px; margin-left: 5px; diff --git a/templates/admin.html b/templates/admin.html index a7f1513..b38e272 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -214,6 +214,7 @@
欢迎使用DR-PY管理界面
当前版本: {{ ver }}框架开发:道长框架美化:蓝莓
+ MUI播放器 P2P播放器 \n '),a+='\n
\n
\n
\n
\n
\n \n ',r.danmaku&&(a+='\n ',a+=s(l("Danmaku is loading")),a+="\n "),a+='\n ',a+=c.loading,a+='\n
\n\n
\n
\n
\n \n
\n
\n
',a+=s(l("Set danmaku color")),a+='
\n \n \n \n \n \n \n
\n
\n
',a+=s(l("Set danmaku type")),a+='
\n \n \n \n
\n
\n \n ',a+=c.send,a+='\n \n
\n
\n \n \n
\n \n
\n
\n
\n \n
\n
\n
\n
\n \n 0:00 /\n 0:00\n \n ',r.live&&(a+='\n ',a+=s(l("Live")),a+="\n "),a+='\n
\n
\n ',r.video.quality&&(a+='\n
\n \n
\n
\n ',d(r.video.quality,function(e,t){a+='\n
',a+=s(e.name),a+="
\n "}),a+="\n
\n
\n
\n "),a+="\n ",r.screenshot&&(a+='\n
\n
\n "),a+='\n
\n \n
\n ",r.subtitle&&(a+='\n
\n \n
\n "),a+='\n \n
\n \n
\n
\n
\n ',a+=s(l("Speed")),a+='\n
',a+=c.right,a+='
\n
\n
\n ',a+=s(l("Loop")),a+='\n
\n \n \n
\n
\n
\n ',a+=s(l("Show danmaku")),a+='\n
\n \n \n
\n
\n
\n ',a+=s(l("Unlimited danmaku")),a+='\n
\n \n \n
\n
\n
\n ',a+=s(l("Opacity for danmaku")),a+='\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n 0.5\n
\n
\n 0.75\n
\n
\n ',a+=s(l("Normal")),a+='\n
\n
\n 1.25\n
\n
\n 1.5\n
\n
\n 2\n
\n
\n
\n
\n
\n \n \n
\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
[x]
\n
\n Player version\n \n
\n
\n Player FPS\n \n
\n
\n Video type\n \n
\n
\n Video url\n \n
\n
\n Video resolution\n \n
\n
\n Video duration\n \n
\n ',r.danmaku&&(a+='\n
\n Danamku id\n \n
\n
\n Danamku api\n \n
\n
\n Danamku amount\n \n
\n '),a+='\n
\n
\n ',d(r.contextmenu,function(e,t){a+='\n
\n ',a+=s(l(e.text)),a+="\n
\n "}),a+='\n
\n
'}},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n>8-s%1*8)){if((n=o.charCodeAt(s+=.75))>255)throw new a;t=t<<8|n}return r}},function(e,t,n){"use strict";var i=n(0);e.exports=i.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function a(e){var i=e;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=a(window.location.href),function(t){var n=i.isString(t)?a(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var i=n(0),a=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,o,r={};return e?(i.forEach(e.split("\n"),function(e){if(o=e.indexOf(":"),t=i.trim(e.substr(0,o)).toLowerCase(),n=i.trim(e.substr(o+1)),t){if(r[t]&&a.indexOf(t)>=0)return;r[t]="set-cookie"===t?(r[t]?r[t]:[]).concat([n]):r[t]?r[t]+", "+n:n}}),r):r}},function(e,t,n){"use strict";var i=n(0);function a(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(i.isURLSearchParams(t))o=t.toString();else{var r=[];i.forEach(t,function(e,t){null!==e&&void 0!==e&&(i.isArray(e)?t+="[]":e=[e],i.forEach(e,function(e){i.isDate(e)?e=e.toISOString():i.isObject(e)&&(e=JSON.stringify(e)),r.push(a(t)+"="+a(e))}))}),o=r.join("&")}return o&&(e+=(-1===e.indexOf("?")?"?":"&")+o),e}},function(e,t,n){"use strict";e.exports=function(e,t,n,i,a){return e.config=t,n&&(e.code=n),e.request=i,e.response=a,e}},function(e,t,n){"use strict";var i=n(9);e.exports=function(e,t,n){var a=n.config.validateStatus;n.status&&a&&!a(n.status)?t(i("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var i=n(0);e.exports=function(e,t){i.forEach(e,function(n,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[i])})}},function(e,t,n){"use strict";var i=n(3),a=n(0),o=n(55),r=n(54);function s(e){this.defaults=e,this.interceptors={request:new o,response:new o}}s.prototype.request=function(e){"string"==typeof e&&(e=a.merge({url:arguments[0]},arguments[1])),(e=a.merge(i,{method:"get"},this.defaults,e)).method=e.method.toLowerCase();var t=[r,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},a.forEach(["delete","get","head","options"],function(e){s.prototype[e]=function(t,n){return this.request(a.merge(n||{},{method:e,url:t}))}}),a.forEach(["post","put","patch"],function(e){s.prototype[e]=function(t,n,i){return this.request(a.merge(i||{},{method:e,url:t,data:n}))}}),e.exports=s},function(e,t,n){"use strict";function i(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(i(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&i(e.slice(0,0))}(e)||!!e._isBuffer)}},function(e,t,n){"use strict";var i=n(0),a=n(11),o=n(64),r=n(3);function s(e){var t=new o(e),n=a(o.prototype.request,t);return i.extend(n,o.prototype,t),i.extend(n,t),n}var l=s(r);l.Axios=o,l.create=function(e){return s(i.merge(r,e))},l.Cancel=n(7),l.CancelToken=n(50),l.isCancel=n(8),l.all=function(e){return Promise.all(e)},l.spread=n(49),e.exports=l,e.exports.default=l},function(e,t,n){"use strict";e.exports=n(66)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,a=n(67),o=(i=a)&&i.__esModule?i:{default:i};t.default={send:function(e){o.default.post(e.url,e.data).then(function(t){var n=t.data;n&&0===n.code?e.success&&e.success(n):e.error&&e.error(n&&n.msg)}).catch(function(t){console.error(t),e.error&&e.error()})},read:function(e){o.default.get(e.url).then(function(t){var n=t.data;n&&0===n.code?e.success&&e.success(n.data.map(function(e){return{time:e[0],type:e[1],color:e[2],author:e[3],text:e[4]}})):e.error&&e.error(n&&n.msg)}).catch(function(t){console.error(t),e.error&&e.error()})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(68),r=(i=o)&&i.__esModule?i:{default:i};t.default=function(e){var t={container:e.element||document.getElementsByClassName("dplayer")[0],live:!1,autoplay:!1,theme:"#b7daff",loop:!1,lang:(navigator.language||navigator.browserLanguage).toLowerCase(),screenshot:!1,hotkey:!0,preload:"metadata",volume:.7,apiBackend:r.default,video:{},contextmenu:[],mutex:!0};for(var n in t)t.hasOwnProperty(n)&&!e.hasOwnProperty(n)&&(e[n]=t[n]);return e.video&&!e.video.type&&(e.video.type="auto"),"object"===a(e.danmaku)&&e.danmaku&&!e.danmaku.user&&(e.danmaku.user="DIYgod"),e.subtitle&&(!e.subtitle.type&&(e.subtitle.type="webvtt"),!e.subtitle.fontSize&&(e.subtitle.fontSize="20px"),!e.subtitle.bottom&&(e.subtitle.bottom="40px"),!e.subtitle.color&&(e.subtitle.color="#fff")),e.video.quality&&(e.video.url=e.video.quality[e.video.defaultQuality].url),e.lang&&(e.lang=e.lang.toLowerCase()),e.contextmenu=e.contextmenu.concat([]),e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){return t.reject(n)})})}},function(e,t,n){"use strict";(function(e,t){!function(e,n){if(!e.setImmediate){var i,a,o,r,s,l=1,c={},u=!1,d=e.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(e);p=p&&p.setTimeout?p:e,"[object process]"==={}.toString.call(e.process)?i=function(e){t.nextTick(function(){f(e)})}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((o=new MessageChannel).port1.onmessage=function(e){f(e.data)},i=function(e){o.port2.postMessage(e)}):d&&"onreadystatechange"in d.createElement("script")?(a=d.documentElement,i=function(e){var t=d.createElement("script");t.onreadystatechange=function(){f(e),t.onreadystatechange=null,a.removeChild(t),t=null},a.appendChild(t)}):i=function(e){setTimeout(f,0,e)}:(r="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(r)&&f(+t.data.slice(r.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),i=function(t){e.postMessage(r+t,"*")}),p.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(71),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(70),r=(i=o)&&i.__esModule?i:{default:i};var s=setTimeout;function l(){}function c(e){if(!(this instanceof c))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],f(e,this)}function u(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,c._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var i;try{i=n(e._value)}catch(e){return void p(t.promise,e)}d(t.promise,i)}else(1===e._state?d:p)(t.promise,e._value)})):e._deferreds.push(t)}function d(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"===(void 0===t?"undefined":a(t))||"function"==typeof t)){var n=t.then;if(t instanceof c)return e._state=3,e._value=t,void h(e);if("function"==typeof n)return void f((i=n,o=t,function(){i.apply(o,arguments)}),e)}e._state=1,e._value=t,h(e)}catch(t){p(e,t)}var i,o}function p(e,t){e._state=2,e._value=t,h(e)}function h(e){2===e._state&&0===e._deferreds.length&&c._immediateFn(function(){e._handled||c._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;te&&this.notice(this.tran("REW")+" "+(this.video.currentTime-e).toFixed(0)+" "+this.tran("s")),this.video.currentTime=e,this.danmaku&&this.danmaku.seek(),this.bar.set("played",e/this.video.duration,"width"),this.template.ptime.innerHTML=o.default.secondToTime(e)}},{key:"play",value:function(){var e=this;if(this.paused=!1,this.video.paused&&this.bezel.switch(c.default.play),this.template.playButton.innerHTML=c.default.pause,a.default.resolve(this.video.play()).catch(function(){e.pause()}).then(function(){}),this.timer.enable("loading"),this.container.classList.remove("dplayer-paused"),this.container.classList.add("dplayer-playing"),this.danmaku&&this.danmaku.play(),this.options.mutex)for(var t=0;t=.95?this.template.volumeIcon.innerHTML=c.default.volumeUp:this.volume()>0?this.template.volumeIcon.innerHTML=c.default.volumeDown:this.template.volumeIcon.innerHTML=c.default.volumeOff}},{key:"volume",value:function(e,t,n){if(e=parseFloat(e),!isNaN(e)){e=Math.max(e,0),e=Math.min(e,1),this.bar.set("volume",e,"width");var i=(100*e).toFixed(0)+"%";this.template.volumeBarWrapWrap.dataset.balloon=i,t||this.user.set("volume",e),n||this.notice(this.tran("Volume")+" "+(100*e).toFixed(0)+"%"),this.video.volume=e,this.video.muted&&(this.video.muted=!1),this.switchVolumeIcon()}return this.video.volume}},{key:"toggle",value:function(){this.video.paused?this.play():this.pause()}},{key:"on",value:function(e,t){this.events.on(e,t)}},{key:"switchVideo",value:function(e,t){this.pause(),this.video.poster=e.pic?e.pic:"",this.video.src=e.url,this.initMSE(this.video,e.type||"auto"),t&&(this.template.danmakuLoading.style.display="block",this.bar.set("played",0,"width"),this.bar.set("loaded",0,"width"),this.template.ptime.innerHTML="00:00",this.template.danmaku.innerHTML="",this.danmaku&&this.danmaku.reload({id:t.id,address:t.api,token:t.token,maximum:t.maximum,addition:t.addition,user:t.user}))}},{key:"initMSE",value:function(e,t){var n=this;if(this.type=t,this.options.video.customType&&this.options.video.customType[t])"[object Function]"===Object.prototype.toString.call(this.options.video.customType[t])?this.options.video.customType[t](this.video,this):console.error("Illegal customType: "+t);else switch("auto"===this.type&&(/m3u8(#|\?|$)/i.exec(e.src)?this.type="hls":/.flv(#|\?|$)/i.exec(e.src)?this.type="flv":/.mpd(#|\?|$)/i.exec(e.src)?this.type="dash":this.type="normal"),"hls"===this.type&&(e.canPlayType("application/x-mpegURL")||e.canPlayType("application/vnd.apple.mpegURL"))&&(this.type="normal"),this.type){case"hls":if(Hls)if(Hls.isSupported()){var i=new Hls;i.loadSource(e.src),i.attachMedia(e)}else this.notice("Error: Hls is not supported.");else this.notice("Error: Can't find Hls.");break;case"flv":if(flvjs&&flvjs.isSupported())if(flvjs.isSupported()){var a=flvjs.createPlayer({type:"flv",url:e.src});a.attachMediaElement(e),a.load()}else this.notice("Error: flvjs is not supported.");else this.notice("Error: Can't find flvjs.");break;case"dash":dashjs?dashjs.MediaPlayer().create().initialize(e,e.src,!1):this.notice("Error: Can't find dashjs.");break;case"webtorrent":if(WebTorrent)if(WebTorrent.WEBRTC_SUPPORT){this.container.classList.add("dplayer-loading");var o=new WebTorrent,r=e.src;o.add(r,function(e){e.files.find(function(e){return e.name.endsWith(".mp4")}).renderTo(n.video,{autoplay:n.options.autoplay},function(){n.container.classList.remove("dplayer-loading")})})}else this.notice("Error: Webtorrent is not supported.");else this.notice("Error: Can't find Webtorrent.")}}},{key:"initVideo",value:function(e,t){var n=this;this.initMSE(e,t),this.on("durationchange",function(){1!==e.duration&&e.duration!==1/0&&(n.template.dtime.innerHTML=o.default.secondToTime(e.duration))}),this.on("progress",function(){var t=e.buffered.length?e.buffered.end(e.buffered.length-1)/e.duration:0;n.bar.set("loaded",t,"width")}),this.on("error",function(){n.video.error&&n.tran&&n.notice&&(n.type,n.notice(n.tran("Video load failed"),-1))}),this.on("ended",function(){n.bar.set("played",1,"width"),n.setting.loop?(n.seek(0),n.play()):n.pause(),n.danmaku&&(n.danmaku.danIndex=0)}),this.on("play",function(){n.paused&&n.play()}),this.on("pause",function(){n.paused||n.pause()}),this.on("timeupdate",function(){n.bar.set("played",n.video.currentTime/n.video.duration,"width");var e=o.default.secondToTime(n.video.currentTime);n.template.ptime.innerHTML!==e&&(n.template.ptime.innerHTML=e)});for(var i=function(t){e.addEventListener(n.events.videoEvents[t],function(){n.events.trigger(n.events.videoEvents[t])})},a=0;a1&&void 0!==arguments[1]?arguments[1]:2e3,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.template.notice.innerHTML=e,this.template.notice.style.opacity=i,this.noticeTime&&clearTimeout(this.noticeTime),this.events.trigger("notice_show",e),n>0&&(this.noticeTime=setTimeout(function(){t.template.notice.style.opacity=0,t.events.trigger("notice_hide")},n))}},{key:"resize",value:function(){this.danmaku&&this.danmaku.resize(),this.events.trigger("resize")}},{key:"speed",value:function(e){this.video.playbackRate=e}},{key:"destroy",value:function(){M.splice(M.indexOf(this),1),this.pause(),this.controller.destroy(),this.timer.destroy(),this.video.src="",this.container.innerHTML="",this.events.trigger("destroy")}}],[{key:"version",get:function(){return"1.25.0"}}]),e}();t.default=_},,,function(e,t,n){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(77);var i,a=n(74),o=(i=a)&&i.__esModule?i:{default:i};"",t.default=o.default}]).default}); +//# sourceMappingURL=DPlayer.min.js.map \ No newline at end of file diff --git a/templates/player/p2p-media-loader/class.main.js b/templates/player/p2p-media-loader/class.main.js new file mode 100644 index 0000000..0c8845c --- /dev/null +++ b/templates/player/p2p-media-loader/class.main.js @@ -0,0 +1,384 @@ +/*########################################### +# xypaly 智能视频解析整合接口 by nohacks.cn# +# 官方网站: http://nohacks.cn"); # +# 源码获取:http://nohacks.taobao.com"); # +##########################################*/ +/* global define, Base64, opera, java */ + + +//base64加密 解密 + +/* //1.加密 +var result = Base64.encode('125中文'); //--> "MTI15Lit5paH" + +//2.解密 +var result2 = Base64.decode(result); //--> '125中文' +*/ + +~(function(root, factory) { + if (typeof define === "function" && define.amd) { + define([], factory); + } else if (typeof module === "object" && module.exports) { + module.exports = factory(); + } else { + root.Base64 = factory(); + } +}(this, function() { + 'use strict'; //严格模式 + function Base64() { + // private property + this._keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + } + //public method for encoding + Base64.prototype.encode = function (input) { + var output = "", chr1, chr2, chr3, enc1, enc2, enc3, enc4, i = 0; + input = this._utf8_encode(input); + while (i < input.length) { + chr1 = input.charCodeAt(i++); + chr2 = input.charCodeAt(i++); + chr3 = input.charCodeAt(i++); + enc1 = chr1 >> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + if (isNaN(chr2)) { + enc3 = enc4 = 64; + } else if (isNaN(chr3)) { + enc4 = 64; + } + output = output + + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); + } + return output; + }; + + // public method for decoding + Base64.prototype.decode = function (input) { + var output = "", chr1, chr2, chr3, enc1, enc2, enc3, enc4, i = 0; + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + while (i < input.length) { + enc1 = this._keyStr.indexOf(input.charAt(i++)); + enc2 = this._keyStr.indexOf(input.charAt(i++)); + enc3 = this._keyStr.indexOf(input.charAt(i++)); + enc4 = this._keyStr.indexOf(input.charAt(i++)); + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + output = output + String.fromCharCode(chr1); + if (enc3 !== 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 !== 64) { + output = output + String.fromCharCode(chr3); + } + } + output = this._utf8_decode(output); + return output; + }; + + // private method for UTF-8 encoding + Base64.prototype._utf8_encode = function (string) { + string = string.replace(/\r\n/g,"\n"); + var utftext = ""; + for (var n = 0; n < string.length; n++) { + var c = string.charCodeAt(n); + if (c < 128) { + utftext += String.fromCharCode(c); + } else if((c > 127) && (c < 2048)) { + utftext += String.fromCharCode((c >> 6) | 192); + utftext += String.fromCharCode((c & 63) | 128); + } else { + utftext += String.fromCharCode((c >> 12) | 224); + utftext += String.fromCharCode(((c >> 6) & 63) | 128); + utftext += String.fromCharCode((c & 63) | 128); + } + + } + return utftext; + }; + + // private method for UTF-8 decoding + Base64.prototype._utf8_decode = function (utftext) { + var string = "", i = 0, c = 0, c1 = 0, c2 = 0, c3 = 0; + while ( i < utftext.length ) { + c = utftext.charCodeAt(i); + if (c < 128) { + string += String.fromCharCode(c); + i++; + } else if((c > 191) && (c < 224)) { + c2 = utftext.charCodeAt(i+1); + string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); + i += 2; + } else { + c2 = utftext.charCodeAt(i+1); + c3 = utftext.charCodeAt(i+2); + string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); + i += 3; + } + } + return string; + }; + + var Base64 = new Base64(); + + return Base64; +})); + + +/* 代码加密 */ + function encode(code){ + 'use strict'; //严格模式 + var c= String.fromCharCode(code.charCodeAt(0)+code.length); + for(var i=1;i]+>/g,"");} + return str; + }; + +//搜索有分割符的字符串否在指定文本中存在,成功返回真,失败返回假。 +//参数:搜索字符串,待搜索文本,分隔符,默认"|" +function isurl(flag, word,split) { + if (!flag || !word) { + return false; + } + var strs = new Array(); + spli=!split ? "|":split; + strs = flag.split(split); + for (var i = 0; i < strs.length; i++) { + if (word.indexOf(strs[i]) > -1) { + return true; + } + } + return false; +}; + + + +//设置浏览器缓存项值,参数:项名,值,有效时间(小时) +function setCookie(c_name, value, expireHours) { + var exdate = new Date(); + exdate.setHours(exdate.getHours() + expireHours); + document.cookie = c_name + "=" + escape(value) + ((expireHours === null) ? "" : ";expires=" + exdate.toGMTString()); +} +//获取浏览器缓存项值,参数:项名 +function getCookie(c_name) { + if (document.cookie.length > 0) { + c_start = document.cookie.indexOf(c_name + "="); + if (c_start !== -1) { + c_start = c_start + c_name.length + 1; + c_end = document.cookie.indexOf(";", c_start); + if (c_end === -1) { + c_end = document.cookie.length; + }; + return unescape(document.cookie.substring(c_start, c_end)); + } + } + return ''; +} + +//判断设备类型 +function is_mobile() { + var regex_match = /(nokia|iphone|android|motorola|micromessenger|^mot-|softbank|foma|docomo|kddi|up.browser|up.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte-|longcos|pantech|gionee|^sie-|portalmmm|jigs browser|hiptop|^benq|haier|^lct|operas*mobi|opera*mini|320x320|240x320|176x220)/i; + var u = navigator.userAgent; + if (null === u) { + return true; + } + var result = regex_match.exec(u); + if (null === result) { + return false; + } else { + return true; + } +}; + +//时间文本到微妙时间 +function is_time(time){ + if("undefined" !==typeof time && time!==null){ + var r = (/^(\d+)(.*?)$/i).exec(time); + if(!r|| r.length < 2){return 0;} + switch(r[2]){ + case "d": + return r[1]*24*60*60*1000; + case "h": + return r[1]*60*60*1000; + case "m": + return r[1]*60*1000; + case "s": + return r[1]*1000; + case "ms": + return r[1]; + default: + return r[1]*1000; + } + + }else{ + return -1; + } + + } +//取随机数 +function random(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min + 1)) + min; + } + +//取随机颜色 + function random_rgb(min,max){ + min=min||0; + max=max||256; + var r=random(min,max); + var g=random(min,max); + var b=random(min,max); + return "rgb("+r+','+g+','+b+")"; + } +//调试输出兼容代码 +function log(message,off) { + + if (typeof console === 'object') { + console.log(message); + } else if (typeof opera === 'object') { + opera.postError(message); + } else if (typeof java === 'object' && typeof java.lang === 'object') { + java.lang.System.out.println(message); + } +} + + +function open_without_referrer(link){ +document.body.appendChild(document.createElement('iframe')).src='javascript:" + + + + + + + + + + + +
+
+

+ +
+ + + + + +