mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
Refactor code structure for improved readability and maintainability
This commit is contained in:
1 parent
4a0fbda3c4
commit
0bb4e1acdb
214 files changed
+462
-415
No files matched your search
@@ -2,7 +2,7 @@
|
||||
/*!
|
||||
* artplayer-plugin-dash-control.js v1.0.0
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2025 Harvey Zack
|
||||
* (c) 2017-2026 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,o,r,i,u,l){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof a[o]&&a[o],f=d.i||{},s=d.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!s[t]){if(!e[t]){if(r[t])return r[t];var i="function"==typeof a[o]&&a[o];if(!n&&i)return i(t,!0);if(d)return d(t,!0);if(c&&"string"==typeof t)return c(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}f.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},f.cache={};var l=s[t]=new p.Module(t);e[t][0].call(l.exports,f,l,l.exports,a)}return s[t].exports;function f(e){var t=f.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var n={__esModule:!0};return t.forEach(function(e){var t=e[0],o=e[1],r=e[2]||e[0],i=p(o);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===r?Object.defineProperty(n,t,{enumerable:!0,value:i}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===r?i.__esModule?i.default:i:i[r]}})}),n}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=c,this.exports={}},p.modules=e,p.cache=s,p.parent=d,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=f,p.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return a[o]}}),a[o]=p;for(var h=0;h<t.length;h++)p(t[h]);if(n){var g=p(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({"2mXm2":[function(e,t,n,o){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n),r.export(n,"default",()=>f);var i=e("bundle-text:./audio.svg"),u=r.interopDefault(i),l=e("bundle-text:./quality.svg"),a=r.interopDefault(l);function d(e,t){let n=new Map;return e.filter(e=>{let o=e[t];return void 0===o||!n.has(o)&&n.set(o,1)})}function f(e={}){return t=>{let{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function r(){o(t.dash.getVideoElement()===n,'Cannot find instance of DASH from "art.dash"'),function(n){let o=n.getBitrateInfoListFor("video");if(!o||!o.length)return;let r=e.quality||{},i=r.auto||"Auto",u=r.title||"Quality",l=r.getName||(e=>`${e.height}p`),f=n.getQualityFor("video"),s=n.getSettings().streaming.abr.autoSwitchBitrate.video,c=s?i:l(o[f]),p=d(o.map(e=>({html:l(e),value:e.qualityIndex,default:f===e.qualityIndex&&!s})),"html").sort((e,t)=>t.value-e.value);p.push({html:i,value:"auto",default:s});let h=e=>("auto"===e.value?n.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}}):(n.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),n.setQualityFor("video",e.value)),t.notice.show=`${u}: ${e.html}`,r.control&&t.controls.check(e),r.setting&&t.setting.check(e),e.html);r.control&&t.controls.update({name:"dash-quality",position:"right",html:c,style:{padding:"0 10px"},selector:p,onSelect:h}),r.setting&&t.setting.update({name:"dash-quality",tooltip:c,html:u,icon:a.default,width:200,selector:p,onSelect:h})}(t.dash),function(n){let o=n.getTracksFor("audio");if(!o||!o.length)return;let r=e.audio||{},i=r.auto||"Auto",l=r.title||"Audio",a=r.getName||(e=>e.lang||e.id),f=n.getCurrentTrackFor("audio")||o[0],s=f?a(f):i,c=d(o.map(e=>({html:a(e),value:e,default:f===e})),"html"),p=e=>(n.setCurrentTrack(e.value),t.notice.show=`${l}: ${e.html}`,r.control&&t.controls.check(e),r.setting&&t.setting.check(e),e.html);r.control&&t.controls.update({name:"dash-audio",position:"right",html:s,style:{padding:"0 10px"},selector:c,onSelect:p}),r.setting&&t.setting.update({name:"dash-audio",tooltip:s,html:l,icon:u.default,width:200,selector:c,onSelect:p})}(t.dash)}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginDashControl",update:r}}}"undefined"!=typeof window&&(window.artplayerPluginDashControl=f)},{"bundle-text:./audio.svg":"8JwGn","bundle-text:./quality.svg":"gADLz","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"8JwGn":[function(e,t,n,o){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6 26.5 0 48 21.5 48 48v128c0 26.5-21.5 48-48 48-44.2 0-80-35.8-80-80V288C0 146.6 114.6 32 256 32s256 114.6 256 256v112c0 44.2-35.8 80-80 80-26.5 0-48-21.5-48-48V304c0-26.5 21.5-48 48-48 10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80"/></svg>'},{}],gADLz:[function(e,t,n,o){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M0 96c0-35.3 28.7-64 64-64h384c35.3 0 64 28.7 64 64v320c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64Zm323.8 106.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6-26.5-33.1c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-Line truncated
|
||||
!function(e,t,o,r,n,i,u,l){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof a[r]&&a[r],c=s.i||{},d=s.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,o){if(!d[t]){if(!e[t]){if(n[t])return n[t];var i="function"==typeof a[r]&&a[r];if(!o&&i)return i(t,!0);if(s)return s(t,!0);if(f&&"string"==typeof t)return f(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}c.resolve=function(o){var r=e[t][1][o];return null!=r?r:o},c.cache={};var l=d[t]=new p.Module(t);e[t][0].call(l.exports,c,l,l.exports,a)}return d[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var o={__esModule:!0};return t.forEach(function(e){var t=e[0],r=e[1],n=e[2]||e[0],i=p(r);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(o,e)||Object.defineProperty(o,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===n?Object.defineProperty(o,t,{enumerable:!0,value:i}):Object.defineProperty(o,t,{enumerable:!0,get:function(){return"default"===n?i.__esModule?i.default:i:i[n]}})}),o}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=f,this.exports={}},p.modules=e,p.cache=d,p.parent=s,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=c,p.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(p,"root",{get:function(){return a[r]}}),a[r]=p;for(var h=0;h<t.length;h++)p(t[h]);if(o){var g=p(o);"object"==typeof exports&&"u">typeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({"2mXm2":[function(e,t,o,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(o),n.export(o,"default",()=>c);var i=e("bundle-text:./audio.svg"),u=n.interopDefault(i),l=e("bundle-text:./quality.svg"),a=n.interopDefault(l);function s(e,t){let o=new Map;return e.filter(e=>{let r=e[t];return void 0===r||!o.has(r)&&o.set(r,1)})}function c(e={}){return t=>{let{$video:o}=t.template,{errorHandle:r}=t.constructor.utils;function n(){r(t.dash.getVideoElement()===o,'Cannot find instance of DASH from "art.dash"'),function(o){let r=o.getBitrateInfoListFor("video");if(!r||!r.length)return;let n=e.quality||{},i=n.auto||"Auto",u=n.title||"Quality",l=n.getName||(e=>`${e.height}p`),c=o.getQualityFor("video"),d=o.getSettings().streaming.abr.autoSwitchBitrate.video,f=d?i:l(r[c]),p=s(r.map(e=>({html:l(e),value:e.qualityIndex,default:c===e.qualityIndex&&!d})),"html").sort((e,t)=>t.value-e.value);p.push({html:i,value:"auto",default:d});let h=e=>("auto"===e.value?o.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}}):(o.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),o.setQualityFor("video",e.value)),t.notice.show=`${u}: ${e.html}`,n.control&&t.controls.check(e),n.setting&&t.setting.check(e),e.html);n.control&&t.controls.update({name:"dash-quality",position:"right",html:f,style:{padding:"0 10px"},selector:p,onSelect:h}),n.setting&&t.setting.update({name:"dash-quality",tooltip:f,html:u,icon:a.default,width:200,selector:p,onSelect:h})}(t.dash),function(o){let r=o.getTracksFor("audio");if(!r||!r.length)return;let n=e.audio||{},i=n.auto||"Auto",l=n.title||"Audio",a=n.getName||(e=>e.lang||e.id),c=o.getCurrentTrackFor("audio")||r[0],d=c?a(c):i,f=s(r.map(e=>({html:a(e),value:e,default:c===e})),"html"),p=e=>(o.setCurrentTrack(e.value),t.notice.show=`${l}: ${e.html}`,n.control&&t.controls.check(e),n.setting&&t.setting.check(e),e.html);n.control&&t.controls.update({name:"dash-audio",position:"right",html:d,style:{padding:"0 10px"},selector:f,onSelect:p}),n.setting&&t.setting.update({name:"dash-audio",tooltip:d,html:l,icon:u.default,width:200,selector:f,onSelect:p})}(t.dash)}return t.on("ready",n),t.on("restart",n),{name:"artplayerPluginDashControl",update:n}}}"u">typeof window&&(window.artplayerPluginDashControl=c)},{"bundle-text:./audio.svg":"8JwGn","bundle-text:./quality.svg":"gADLz","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"8JwGn":[function(e,t,o,r){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6 26.5 0 48 21.5 48 48v128c0 26.5-21.5 48-48 48-44.2 0-80-35.8-80-80V288C0 146.6 114.6 32 256 32s256 114.6 256 256v112c0 44.2-35.8 80-80 80-26.5 0-48-21.5-48-48V304c0-26.5 21.5-48 48-48 10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80"/></svg>'},{}],gADLz:[function(e,t,o,r){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M0 96c0-35.3 28.7-64 64-64h384c35.3 0 64 28.7 64 64v320c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64Zm323.8 106.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6-26.5-33.1c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4S78.8 416 88 416h336c8.9 0 17.1Line truncated
|
||||
Reference in new issue
Block a user