mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
build all
Refactor utility functions for improved readability and consistency - Updated compatibility.js to use consistent line endings and formatting. - Refactored component.js for better readability and structure, including consistent use of arrow functions and binding. - Simplified dom.js functions with consistent formatting and improved readability. - Enhanced emitter.js with consistent formatting and arrow function usage. - Streamlined error.js for improved readability and consistency. - Refactored file.js to use consistent formatting and improved readability. - Improved format.js functions for better readability and consistency. - Updated index.js to maintain consistent export formatting. - Refactored property.js for improved readability and consistency. - Enhanced subtitle.js with consistent formatting and improved readability. - Refactored time.js for better readability and consistent formatting. fix: update lint script to target only source files for consistency Revert "fix: restore export statements for various plugins and update type definitions for better clarity" This reverts commit b5e969d81ec765cd8a34b06e6ef4f232ef25087f. fix: restore export statements for various plugins and update type definitions for better clarity Refactor type definitions to use interfaces instead of type aliases for better extensibility and clarity across i18n, icons, option, player, quality, setting, subtitle, template, and utils modules.
This commit is contained in:
1 parent
532dd67cfd
commit
35ad9883af
447 files changed
+18248
-17946
No files matched your search
+1
-1
@@ -5,5 +5,5 @@
|
||||
* (c) 2017-2025 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,o,n,r,i,l,u){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof a[n]&&a[n],s=d.i||{},c=d.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,o){if(!c[t]){if(!e[t]){if(r[t])return r[t];var i="function"==typeof a[n]&&a[n];if(!o&&i)return i(t,!0);if(d)return d(t,!0);if(f&&"string"==typeof t)return f(t);var l=Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}s.resolve=function(o){var n=e[t][1][o];return null!=n?n:o},s.cache={};var u=c[t]=new p.Module(t);e[t][0].call(u.exports,s,u,u.exports,a)}return c[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}: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=c,p.parent=d,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=s,p.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(p,"root",{get:function(){return a[n]}}),a[n]=p;for(var h=0;h<t.length;h++)p(t[h]);if(o){var g=p(o);"object"==typeof exports&&"undefined"!=typeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({"4omrA":[function(e,t,o,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(o),r.export(o,"default",()=>s);var i=e("bundle-text:./quality.svg"),l=r.interopDefault(i),u=e("bundle-text:./audio.svg"),a=r.interopDefault(u);function d(e,t){let o=new Map;return e.filter(e=>{let n=e[t];return void 0===n||!o.has(n)&&o.set(n,1)})}function s(e={}){return t=>{let{$video:o}=t.template,{errorHandle:n}=t.constructor.utils;function r(){n(t.dash.getVideoElement()===o,'Cannot find instance of DASH from "art.dash"'),function(o){let n=o.getBitrateInfoListFor("video");if(!n||!n.length)return;let r=e.quality||{},i=r.auto||"Auto",u=r.title||"Quality",a=r.getName||(e=>`${e.height}p`),s=o.getQualityFor("video"),c=o.getSettings().streaming.abr.autoSwitchBitrate.video,f=c?i:a(n[s]),p=d(n.map(e=>({html:a(e),value:e.qualityIndex,default:s===e.qualityIndex&&!c})),"html").sort((e,t)=>t.value-e.value);p.push({html:i,value:"auto",default:c});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}`,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:f,style:{padding:"0 10px"},selector:p,onSelect:h}),r.setting&&t.setting.update({name:"dash-quality",tooltip:f,html:u,icon:l.default,width:200,selector:p,onSelect:h})}(t.dash),function(o){let n=o.getTracksFor("audio");if(!n||!n.length)return;let r=e.audio||{},i=r.auto||"Auto",l=r.title||"Audio",u=r.getName||(e=>e.lang||e.id),s=o.getCurrentTrackFor("audio")||n[0],c=s?u(s):i,f=d(n.map(e=>({html:u(e),value:e,default:s===e})),"html"),p=e=>(o.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:c,style:{padding:"0 10px"},selector:f,onSelect:p}),r.setting&&t.setting.update({name:"dash-audio",tooltip:c,html:l,icon:a.default,width:200,selector:f,onSelect:p})}(t.dash)}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginDashControl",update:r}}}"undefined"!=typeof window&&(window.artplayerPluginDashControl=s)},{"bundle-text:./quality.svg":"5iEAx","bundle-text:./audio.svg":"909Xy","@parcel/transformer-js/src/esmodule-helpers.js":"w4pLy"}],"5iEAx":[function(e,t,o,n){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.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96"/></svg>'},{}],"909Xy":[function(e,t,o,n){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>'},{}],w4pLy:[function(e,t,o,n){o.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},o.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.exportAll=function(e,t){return Object.keys(e).forEach(function(o){"default"===o||"__esModule"===o||Object.prototype.hasOwnProperty.call(t,o)||Object.defLine truncated
|
||||
!function(e,t,n,o,i,r,l,u){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],s=d.i||{},f=d.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!f[t]){if(!e[t]){if(i[t])return i[t];var r="function"==typeof a[o]&&a[o];if(!n&&r)return r(t,!0);if(d)return d(t,!0);if(c&&"string"==typeof t)return c(t);var l=Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}s.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},s.cache={};var u=f[t]=new p.Module(t);e[t][0].call(u.exports,s,u,u.exports,a)}return f[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}: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=f,p.parent=d,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=s,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})}}({"58GV3":[function(e,t,n,o){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",()=>s);var r=e("bundle-text:./audio.svg"),l=i.interopDefault(r),u=e("bundle-text:./quality.svg"),a=i.interopDefault(u);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 s(e={}){return t=>{let{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function i(){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 i=e.quality||{},r=i.auto||"Auto",l=i.title||"Quality",u=i.getName||(e=>`${e.height}p`),s=n.getQualityFor("video"),f=n.getSettings().streaming.abr.autoSwitchBitrate.video,c=f?r:u(o[s]),p=d(o.map(e=>({html:u(e),value:e.qualityIndex,default:s===e.qualityIndex&&!f})),"html").sort((e,t)=>t.value-e.value);p.push({html:r,value:"auto",default:f});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=`${l}: ${e.html}`,i.control&&t.controls.check(e),i.setting&&t.setting.check(e),e.html);i.control&&t.controls.update({name:"dash-quality",position:"right",html:c,style:{padding:"0 10px"},selector:p,onSelect:h}),i.setting&&t.setting.update({name:"dash-quality",tooltip:c,html:l,icon:a.default,width:200,selector:p,onSelect:h})}(t.dash),function(n){let o=n.getTracksFor("audio");if(!o||!o.length)return;let i=e.audio||{},r=i.auto||"Auto",u=i.title||"Audio",a=i.getName||(e=>e.lang||e.id),s=n.getCurrentTrackFor("audio")||o[0],f=s?a(s):r,c=d(o.map(e=>({html:a(e),value:e,default:s===e})),"html"),p=e=>(n.setCurrentTrack(e.value),t.notice.show=`${u}: ${e.html}`,i.control&&t.controls.check(e),i.setting&&t.setting.check(e),e.html);i.control&&t.controls.update({name:"dash-audio",position:"right",html:f,style:{padding:"0 10px"},selector:c,onSelect:p}),i.setting&&t.setting.update({name:"dash-audio",tooltip:f,html:u,icon:l.default,width:200,selector:c,onSelect:p})}(t.dash)}return t.on("ready",i),t.on("restart",i),{name:"artplayerPluginDashControl",update:i}}}"undefined"!=typeof window&&(window.artplayerPluginDashControl=s)},{"bundle-text:./audio.svg":"jpinR","bundle-text:./quality.svg":"C2BZy","@parcel/transformer-js/src/esmodule-helpers.js":"5lQoW"}],jpinR:[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>'},{}],C2BZy:[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-64 80c-5.8 7.2-6.9 17.1-2.9 25.4S78.8 416 88 416h336c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7ZM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96"/></svg>'},{}],"5lQoW":[function(e,t,n,o){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function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CAAC,QAAS,CAAC,CAC5C,EAEA,EAAQ,iBAAiB,CAAG,SAAU,CAAC,EACrC,OAAO,cAAc,CAAC,EAAG,aAAc,CAAC,MAAO,CAAA,CAAI,EACrD,EAEA,EAAQ,SAAS,CAAG,SAAU,CAAM,CAAE,CAAI,EAkBxC,OAjBA,OAAO,IAAI,CAAC,GAAQ,OAAO,CAAC,SAAU,CAAG,EAE7B,YAAR,GACA,AAAQ,eAAR,GACA,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,EAAM,IAK7C,OAAO,cAAc,CAAC,EAAM,EAAK,CAC/B,WAAY,CAAA,EACZ,IAAK,WACH,OAAO,CAAM,CAAC,EAAI,AACpB,CACF,EACF,GAEO,CACT,EAEA,EAAQ,MAAM,CAAG,SAAU,CAAI,CAAE,CAAQ,CAAE,CAAG,EAC5C,OAAO,cAAc,CAAC,EAAM,EAAU,CACpC,WAAY,CAAA,EACZ,IAAK,CACP,EACF,C,E,C,E,E,C,Q,C,Q,oB,C,G,G,C,Q,C,C,C,kB,gB,K,O","sources":["<anon>","src/index.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-26d48274f89c9ca8.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-5b9ef104be305102.js","../../node_modules/@parcel/transformer-js/src/esmodule-helpers.js"],"sourcesContent":["// modules are defined as an array\n// [ module function, map of requires ]\n//\n// map of requires is short require name -Line truncated
|
||||
{"mappings":"C,A,S,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,E,I,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,A,Y,O,C,C,E,E,C,C,E,C,E,E,C,E,C,E,E,E,K,E,C,E,E,A,a,O,Q,A,Y,O,O,O,E,O,O,C,I,C,Q,S,E,C,C,C,E,G,C,C,C,E,C,C,G,C,C,C,E,C,C,G,C,C,E,C,O,C,C,E,C,I,E,A,Y,O,C,C,E,E,C,C,E,C,G,C,G,E,O,E,E,C,G,G,E,O,E,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AE,CAAG,EAC5C,OAAO,cAAc,CAAC,EAAM,EAAU,CACpC,WAAY,CAAA,EACZ,IAAK,CACP,EACF,C,E,C,E,E,C,Q,C,Q,oB,C,G,G,C,Q,C,C,C,kB,gB,K,O","sources":["<anon>","packages/artplayer-plugin-dash-control/src/index.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-45c5e4a1957df1cf.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-4bcc1b66476ef162.js","node_modules/@parcel/transformer-js/src/esmodule-helpers.js"],"sourcesContent":["// modules are defined as an array\n// [ module function, map of requires ]\n//\n// map of reqLine truncated
|
||||
+1
-1
@@ -5,4 +5,4 @@
|
||||
* (c) 2017-2025 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,o,n,r,i,l,u){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof a[n]&&a[n],s=d.i||{},c=d.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,o){if(!c[t]){if(!e[t]){if(r[t])return r[t];var i="function"==typeof a[n]&&a[n];if(!o&&i)return i(t,!0);if(d)return d(t,!0);if(f&&"string"==typeof t)return f(t);var l=Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}s.resolve=function(o){var n=e[t][1][o];return null!=n?n:o},s.cache={};var u=c[t]=new p.Module(t);e[t][0].call(u.exports,s,u,u.exports,a)}return c[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}: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=c,p.parent=d,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=s,p.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(p,"root",{get:function(){return a[n]}}),a[n]=p;for(var h=0;h<t.length;h++)p(t[h]);if(o){var g=p(o);"object"==typeof exports&&"undefined"!=typeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({jz4E5:[function(e,t,o,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(o),r.export(o,"default",()=>s);var i=e("bundle-text:./quality.svg"),l=r.interopDefault(i),u=e("bundle-text:./audio.svg"),a=r.interopDefault(u);function d(e,t){let o=new Map;return e.filter(e=>{let n=e[t];return void 0===n||!o.has(n)&&o.set(n,1)})}function s(e={}){return t=>{let{$video:o}=t.template,{errorHandle:n}=t.constructor.utils;function r(){n(t.dash.getVideoElement()===o,'Cannot find instance of DASH from "art.dash"'),function(o){let n=o.getBitrateInfoListFor("video");if(!n||!n.length)return;let r=e.quality||{},i=r.auto||"Auto",u=r.title||"Quality",a=r.getName||(e=>`${e.height}p`),s=o.getQualityFor("video"),c=o.getSettings().streaming.abr.autoSwitchBitrate.video,f=c?i:a(n[s]),p=d(n.map(e=>({html:a(e),value:e.qualityIndex,default:s===e.qualityIndex&&!c})),"html").sort((e,t)=>t.value-e.value);p.push({html:i,value:"auto",default:c});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}`,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:f,style:{padding:"0 10px"},selector:p,onSelect:h}),r.setting&&t.setting.update({name:"dash-quality",tooltip:f,html:u,icon:l.default,width:200,selector:p,onSelect:h})}(t.dash),function(o){let n=o.getTracksFor("audio");if(!n||!n.length)return;let r=e.audio||{},i=r.auto||"Auto",l=r.title||"Audio",u=r.getName||(e=>e.lang||e.id),s=o.getCurrentTrackFor("audio")||n[0],c=s?u(s):i,f=d(n.map(e=>({html:u(e),value:e,default:s===e})),"html"),p=e=>(o.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:c,style:{padding:"0 10px"},selector:f,onSelect:p}),r.setting&&t.setting.update({name:"dash-audio",tooltip:c,html:l,icon:a.default,width:200,selector:f,onSelect:p})}(t.dash)}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginDashControl",update:r}}}"undefined"!=typeof window&&(window.artplayerPluginDashControl=s)},{"bundle-text:./quality.svg":"l1ZNL","bundle-text:./audio.svg":"icbOY","@parcel/transformer-js/src/esmodule-helpers.js":"7o2zS"}],l1ZNL:[function(e,t,o,n){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.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96"/></svg>'},{}],icbOY:[function(e,t,o,n){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>'},{}],"7o2zS":[function(e,t,o,n){o.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},o.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.exportAll=function(e,t){return Object.keys(e).forEach(function(o){"default"===o||"__esModule"===o||Object.prototype.hasOwnProperty.call(t,o)||Object.definePLine truncated
|
||||
!function(e,t,n,o,i,r,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],s=d.i||{},f=d.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!f[t]){if(!e[t]){if(i[t])return i[t];var r="function"==typeof a[o]&&a[o];if(!n&&r)return r(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}s.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},s.cache={};var l=f[t]=new p.Module(t);e[t][0].call(l.exports,s,l,l.exports,a)}return f[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}: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=f,p.parent=d,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=s,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})}}({fpgdj:[function(e,t,n,o){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",()=>s);var r=e("bundle-text:./audio.svg"),u=i.interopDefault(r),l=e("bundle-text:./quality.svg"),a=i.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 s(e={}){return t=>{let{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function i(){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 i=e.quality||{},r=i.auto||"Auto",u=i.title||"Quality",l=i.getName||(e=>`${e.height}p`),s=n.getQualityFor("video"),f=n.getSettings().streaming.abr.autoSwitchBitrate.video,c=f?r:l(o[s]),p=d(o.map(e=>({html:l(e),value:e.qualityIndex,default:s===e.qualityIndex&&!f})),"html").sort((e,t)=>t.value-e.value);p.push({html:r,value:"auto",default:f});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}`,i.control&&t.controls.check(e),i.setting&&t.setting.check(e),e.html);i.control&&t.controls.update({name:"dash-quality",position:"right",html:c,style:{padding:"0 10px"},selector:p,onSelect:h}),i.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 i=e.audio||{},r=i.auto||"Auto",l=i.title||"Audio",a=i.getName||(e=>e.lang||e.id),s=n.getCurrentTrackFor("audio")||o[0],f=s?a(s):r,c=d(o.map(e=>({html:a(e),value:e,default:s===e})),"html"),p=e=>(n.setCurrentTrack(e.value),t.notice.show=`${l}: ${e.html}`,i.control&&t.controls.check(e),i.setting&&t.setting.check(e),e.html);i.control&&t.controls.update({name:"dash-audio",position:"right",html:f,style:{padding:"0 10px"},selector:c,onSelect:p}),i.setting&&t.setting.update({name:"dash-audio",tooltip:f,html:l,icon:u.default,width:200,selector:c,onSelect:p})}(t.dash)}return t.on("ready",i),t.on("restart",i),{name:"artplayerPluginDashControl",update:i}}}"undefined"!=typeof window&&(window.artplayerPluginDashControl=s)},{"bundle-text:./audio.svg":"1dVMq","bundle-text:./quality.svg":"hfm0m","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"1dVMq":[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>'},{}],hfm0m:[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-64 80c-5.8 7.2-6.9 17.1-2.9 25.4S78.8 416 88 416h336c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7ZM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96"/></svg>'},{}],"6ykb1":[function(e,t,n,o){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||Object.prototype.hasOwnProperty.call(t,n)||Object.definLine truncated
|
||||
+1
-1
@@ -5,4 +5,4 @@
|
||||
* (c) 2017-2025 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,o,r,i,u,a){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},c="function"==typeof l[o]&&l[o],d=c.i||{},f=c.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!f[t]){if(!e[t]){if(r[t])return r[t];var i="function"==typeof l[o]&&l[o];if(!n&&i)return i(t,!0);if(c)return c(t,!0);if(s&&"string"==typeof t)return s(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}d.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},d.cache={};var a=f[t]=new p.Module(t);e[t][0].call(a.exports,d,a,a.exports,l)}return f[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=f,p.parent=c,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=d,p.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return l[o]}}),l[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})}}({bzF6W:[function(e,t,n,o){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n),r.export(n,"default",function(){return d});var i=e("bundle-text:./quality.svg"),u=r.interopDefault(i),a=e("bundle-text:./audio.svg"),l=r.interopDefault(a);function c(e,t){var n=new Map;return e.filter(function(e){var o=e[t];return void 0===o||!n.has(o)&&n.set(o,1)})}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){var n=t.template.$video,o=t.constructor.utils.errorHandle;function r(){o(t.dash.getVideoElement()===n,'Cannot find instance of DASH from "art.dash"'),function(n){var o=n.getBitrateInfoListFor("video");if(o&&o.length){var r=e.quality||{},i=r.auto||"Auto",a=r.title||"Quality",l=r.getName||function(e){return"".concat(e.height,"p")},d=n.getQualityFor("video"),f=n.getSettings().streaming.abr.autoSwitchBitrate.video,s=f?i:l(o[d]),p=c(o.map(function(e){return{html:l(e),value:e.qualityIndex,default:d===e.qualityIndex&&!f}}),"html").sort(function(e,t){return t.value-e.value});p.push({html:i,value:"auto",default:f});var h=function(e){return"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="".concat(a,": ").concat(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:s,style:{padding:"0 10px"},selector:p,onSelect:h}),r.setting&&t.setting.update({name:"dash-quality",tooltip:s,html:a,icon:u.default,width:200,selector:p,onSelect:h})}}(t.dash),function(n){var o=n.getTracksFor("audio");if(o&&o.length){var r=e.audio||{},i=r.auto||"Auto",u=r.title||"Audio",a=r.getName||function(e){return e.lang||e.id},d=n.getCurrentTrackFor("audio")||o[0],f=d?a(d):i,s=c(o.map(function(e){return{html:a(e),value:e,default:d===e}}),"html"),p=function(e){return n.setCurrentTrack(e.value),t.notice.show="".concat(u,": ").concat(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:f,style:{padding:"0 10px"},selector:s,onSelect:p}),r.setting&&t.setting.update({name:"dash-audio",tooltip:f,html:u,icon:l.default,width:200,selector:s,onSelect:p})}}(t.dash)}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginDashControl",update:r}}}"undefined"!=typeof window&&(window.artplayerPluginDashControl=d)},{"bundle-text:./quality.svg":"emaAn","bundle-text:./audio.svg":"5cT3J","@parcel/transformer-js/src/esmodule-helpers.js":"ihnSZ"}],emaAn:[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-64 80c-5.8 7.2-6.9 17.1-2.9 25.4S78.8 416 88 416h336c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96"/></svg>'},{}],"5cT3J":[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>'},{}],ihnSZ:[function(e,t,n,o){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=functiLine truncated
|
||||
!function(t,e,n,o,r,i,u,a){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},c="function"==typeof l[o]&&l[o],d=c.i||{},f=c.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(e,n){if(!f[e]){if(!t[e]){if(r[e])return r[e];var i="function"==typeof l[o]&&l[o];if(!n&&i)return i(e,!0);if(c)return c(e,!0);if(s&&"string"==typeof e)return s(e);var u=Error("Cannot find module '"+e+"'");throw u.code="MODULE_NOT_FOUND",u}d.resolve=function(n){var o=t[e][1][n];return null!=o?o:n},d.cache={};var a=f[e]=new p.Module(e);t[e][0].call(a.exports,d,a,a.exports,l)}return f[e].exports;function d(t){var e=d.resolve(t);return!1===e?{}:p(e)}}p.isParcelRequire=!0,p.Module=function(t){this.id=t,this.bundle=p,this.require=s,this.exports={}},p.modules=t,p.cache=f,p.parent=c,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=d,p.register=function(e,n){t[e]=[function(t,e){e.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return l[o]}}),l[o]=p;for(var h=0;h<e.length;h++)p(e[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})}}({SomuF:[function(t,e,n,o){var r=t("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n),r.export(n,"default",function(){return d});var i=t("bundle-text:./audio.svg"),u=r.interopDefault(i),a=t("bundle-text:./quality.svg"),l=r.interopDefault(a);function c(t,e){var n=new Map;return t.filter(function(t){var o=t[e];return void 0===o||!n.has(o)&&n.set(o,1)})}function d(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(e){var n=e.template.$video,o=e.constructor.utils.errorHandle;function r(){o(e.dash.getVideoElement()===n,'Cannot find instance of DASH from "art.dash"'),function(n){var o=n.getBitrateInfoListFor("video");if(o&&o.length){var r=t.quality||{},i=r.auto||"Auto",u=r.title||"Quality",a=r.getName||function(t){return"".concat(t.height,"p")},d=n.getQualityFor("video"),f=n.getSettings().streaming.abr.autoSwitchBitrate.video,s=f?i:a(o[d]),p=c(o.map(function(t){return{html:a(t),value:t.qualityIndex,default:d===t.qualityIndex&&!f}}),"html").sort(function(t,e){return e.value-t.value});p.push({html:i,value:"auto",default:f});var h=function(t){return"auto"===t.value?n.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}}):(n.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),n.setQualityFor("video",t.value)),e.notice.show="".concat(u,": ").concat(t.html),r.control&&e.controls.check(t),r.setting&&e.setting.check(t),t.html};r.control&&e.controls.update({name:"dash-quality",position:"right",html:s,style:{padding:"0 10px"},selector:p,onSelect:h}),r.setting&&e.setting.update({name:"dash-quality",tooltip:s,html:u,icon:l.default,width:200,selector:p,onSelect:h})}}(e.dash),function(n){var o=n.getTracksFor("audio");if(o&&o.length){var r=t.audio||{},i=r.auto||"Auto",a=r.title||"Audio",l=r.getName||function(t){return t.lang||t.id},d=n.getCurrentTrackFor("audio")||o[0],f=d?l(d):i,s=c(o.map(function(t){return{html:l(t),value:t,default:d===t}}),"html"),p=function(t){return n.setCurrentTrack(t.value),e.notice.show="".concat(a,": ").concat(t.html),r.control&&e.controls.check(t),r.setting&&e.setting.check(t),t.html};r.control&&e.controls.update({name:"dash-audio",position:"right",html:f,style:{padding:"0 10px"},selector:s,onSelect:p}),r.setting&&e.setting.update({name:"dash-audio",tooltip:f,html:a,icon:u.default,width:200,selector:s,onSelect:p})}}(e.dash)}return e.on("ready",r),e.on("restart",r),{name:"artplayerPluginDashControl",update:r}}}"undefined"!=typeof window&&(window.artplayerPluginDashControl=d)},{"bundle-text:./audio.svg":"lUA8D","bundle-text:./quality.svg":"gqRgl","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],lUA8D:[function(t,e,n,o){e.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>'},{}],gqRgl:[function(t,e,n,o){e.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.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7ZM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96"/></svg>'},{}],qpMMf:[function(t,e,n,o){n.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},n.defineInteropFlag=functionLine truncated
|
||||
@@ -1,30 +1,30 @@
|
||||
{
|
||||
"license": "MIT",
|
||||
"version": "1.0.0",
|
||||
"name": "artplayer-plugin-dash-control",
|
||||
"description": "Dash control plugin for ArtPlayer",
|
||||
"main": "dist/artplayer-plugin-dash-control.js",
|
||||
"legacy": "dist/artplayer-plugin-dash-control.legacy.js",
|
||||
"module": "dist/artplayer-plugin-dash-control.esm.js",
|
||||
"types": "types/artplayer-plugin-dash-control.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/artplayer-plugin-dash-control.esm.js",
|
||||
"require": "./dist/artplayer-plugin-dash-control.js",
|
||||
"default": "./dist/artplayer-plugin-dash-control.js"
|
||||
},
|
||||
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
|
||||
"browserslist": "last 1 Chrome version",
|
||||
"homepage": "https://artplayer.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"html5",
|
||||
"video",
|
||||
"player"
|
||||
]
|
||||
"name": "artplayer-plugin-dash-control",
|
||||
"version": "1.0.0",
|
||||
"description": "Dash control plugin for ArtPlayer",
|
||||
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
"homepage": "https://artplayer.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"html5",
|
||||
"video",
|
||||
"player"
|
||||
],
|
||||
"exports": {
|
||||
"import": "./dist/artplayer-plugin-dash-control.esm.js",
|
||||
"require": "./dist/artplayer-plugin-dash-control.js",
|
||||
"default": "./dist/artplayer-plugin-dash-control.js"
|
||||
},
|
||||
"main": "dist/artplayer-plugin-dash-control.js",
|
||||
"legacy": "dist/artplayer-plugin-dash-control.legacy.js",
|
||||
"module": "dist/artplayer-plugin-dash-control.esm.js",
|
||||
"types": "types/artplayer-plugin-dash-control.d.ts",
|
||||
"browserslist": "last 1 Chrome version"
|
||||
}
|
||||
@@ -1,174 +1,181 @@
|
||||
import $quality from 'bundle-text:./quality.svg';
|
||||
import $audio from 'bundle-text:./audio.svg';
|
||||
import $audio from 'bundle-text:./audio.svg'
|
||||
import $quality from 'bundle-text:./quality.svg'
|
||||
|
||||
function uniqBy(array, property) {
|
||||
const seen = new Map();
|
||||
return array.filter((item) => {
|
||||
const key = item[property];
|
||||
if (key === undefined) {
|
||||
return true;
|
||||
}
|
||||
return !seen.has(key) && seen.set(key, 1);
|
||||
});
|
||||
const seen = new Map()
|
||||
return array.filter((item) => {
|
||||
const key = item[property]
|
||||
if (key === undefined) {
|
||||
return true
|
||||
}
|
||||
return !seen.has(key) && seen.set(key, 1)
|
||||
})
|
||||
}
|
||||
|
||||
export default function artplayerPluginDashControl(option = {}) {
|
||||
return (art) => {
|
||||
const { $video } = art.template;
|
||||
const { errorHandle } = art.constructor.utils;
|
||||
return (art) => {
|
||||
const { $video } = art.template
|
||||
const { errorHandle } = art.constructor.utils
|
||||
|
||||
function updateQuality(dash) {
|
||||
const qualities = dash.getBitrateInfoListFor('video');
|
||||
if (!qualities || !qualities.length) return;
|
||||
function updateQuality(dash) {
|
||||
const qualities = dash.getBitrateInfoListFor('video')
|
||||
if (!qualities || !qualities.length)
|
||||
return
|
||||
|
||||
const config = option.quality || {};
|
||||
const auto = config.auto || 'Auto';
|
||||
const title = config.title || 'Quality';
|
||||
const getName = config.getName || ((level) => `${level.height}p`);
|
||||
const currentQuality = dash.getQualityFor('video');
|
||||
const currentAuto = dash.getSettings().streaming.abr.autoSwitchBitrate['video'];
|
||||
const defaultHtml = currentAuto ? auto : getName(qualities[currentQuality]);
|
||||
const config = option.quality || {}
|
||||
const auto = config.auto || 'Auto'
|
||||
const title = config.title || 'Quality'
|
||||
const getName = config.getName || (level => `${level.height}p`)
|
||||
const currentQuality = dash.getQualityFor('video')
|
||||
const currentAuto = dash.getSettings().streaming.abr.autoSwitchBitrate.video
|
||||
const defaultHtml = currentAuto ? auto : getName(qualities[currentQuality])
|
||||
|
||||
const selector = uniqBy(
|
||||
qualities.map((item) => {
|
||||
return {
|
||||
html: getName(item),
|
||||
value: item.qualityIndex,
|
||||
default: currentQuality === item.qualityIndex && !currentAuto,
|
||||
};
|
||||
}),
|
||||
'html',
|
||||
).sort((a, b) => b.value - a.value);
|
||||
const selector = uniqBy(
|
||||
qualities.map((item) => {
|
||||
return {
|
||||
html: getName(item),
|
||||
value: item.qualityIndex,
|
||||
default: currentQuality === item.qualityIndex && !currentAuto,
|
||||
}
|
||||
}),
|
||||
'html',
|
||||
).sort((a, b) => b.value - a.value)
|
||||
|
||||
selector.push({
|
||||
html: auto,
|
||||
value: 'auto',
|
||||
default: currentAuto,
|
||||
});
|
||||
selector.push({
|
||||
html: auto,
|
||||
value: 'auto',
|
||||
default: currentAuto,
|
||||
})
|
||||
|
||||
const onSelect = (item) => {
|
||||
if (item.value === 'auto') {
|
||||
dash.updateSettings({
|
||||
streaming: {
|
||||
abr: {
|
||||
autoSwitchBitrate: {
|
||||
video: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
dash.updateSettings({
|
||||
streaming: {
|
||||
abr: {
|
||||
autoSwitchBitrate: {
|
||||
video: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
dash.setQualityFor('video', item.value);
|
||||
}
|
||||
art.notice.show = `${title}: ${item.html}`;
|
||||
if (config.control) art.controls.check(item);
|
||||
if (config.setting) art.setting.check(item);
|
||||
return item.html;
|
||||
};
|
||||
|
||||
if (config.control) {
|
||||
art.controls.update({
|
||||
name: 'dash-quality',
|
||||
position: 'right',
|
||||
html: defaultHtml,
|
||||
style: { padding: '0 10px' },
|
||||
selector: selector,
|
||||
onSelect: onSelect,
|
||||
});
|
||||
}
|
||||
|
||||
if (config.setting) {
|
||||
art.setting.update({
|
||||
name: 'dash-quality',
|
||||
tooltip: defaultHtml,
|
||||
html: title,
|
||||
icon: $quality,
|
||||
width: 200,
|
||||
selector: selector,
|
||||
onSelect: onSelect,
|
||||
});
|
||||
}
|
||||
const onSelect = (item) => {
|
||||
if (item.value === 'auto') {
|
||||
dash.updateSettings({
|
||||
streaming: {
|
||||
abr: {
|
||||
autoSwitchBitrate: {
|
||||
video: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function updateAudio(dash) {
|
||||
const audioTracks = dash.getTracksFor('audio');
|
||||
if (!audioTracks || !audioTracks.length) return;
|
||||
|
||||
const config = option.audio || {};
|
||||
const auto = config.auto || 'Auto';
|
||||
const title = config.title || 'Audio';
|
||||
const getName = config.getName || ((track) => track.lang || track.id);
|
||||
const currentTrack = dash.getCurrentTrackFor('audio') || audioTracks[0];
|
||||
const defaultHtml = currentTrack ? getName(currentTrack) : auto;
|
||||
|
||||
const selector = uniqBy(
|
||||
audioTracks.map((item) => {
|
||||
return {
|
||||
html: getName(item),
|
||||
value: item,
|
||||
default: currentTrack === item,
|
||||
};
|
||||
}),
|
||||
'html',
|
||||
);
|
||||
|
||||
const onSelect = (item) => {
|
||||
dash.setCurrentTrack(item.value);
|
||||
art.notice.show = `${title}: ${item.html}`;
|
||||
if (config.control) art.controls.check(item);
|
||||
if (config.setting) art.setting.check(item);
|
||||
return item.html;
|
||||
};
|
||||
|
||||
if (config.control) {
|
||||
art.controls.update({
|
||||
name: 'dash-audio',
|
||||
position: 'right',
|
||||
html: defaultHtml,
|
||||
style: { padding: '0 10px' },
|
||||
selector: selector,
|
||||
onSelect: onSelect,
|
||||
});
|
||||
}
|
||||
|
||||
if (config.setting) {
|
||||
art.setting.update({
|
||||
name: 'dash-audio',
|
||||
tooltip: defaultHtml,
|
||||
html: title,
|
||||
icon: $audio,
|
||||
width: 200,
|
||||
selector: selector,
|
||||
onSelect: onSelect,
|
||||
});
|
||||
}
|
||||
else {
|
||||
dash.updateSettings({
|
||||
streaming: {
|
||||
abr: {
|
||||
autoSwitchBitrate: {
|
||||
video: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
dash.setQualityFor('video', item.value)
|
||||
}
|
||||
art.notice.show = `${title}: ${item.html}`
|
||||
if (config.control)
|
||||
art.controls.check(item)
|
||||
if (config.setting)
|
||||
art.setting.check(item)
|
||||
return item.html
|
||||
}
|
||||
|
||||
function update() {
|
||||
errorHandle(art.dash.getVideoElement() === $video, 'Cannot find instance of DASH from "art.dash"');
|
||||
updateQuality(art.dash);
|
||||
updateAudio(art.dash);
|
||||
}
|
||||
if (config.control) {
|
||||
art.controls.update({
|
||||
name: 'dash-quality',
|
||||
position: 'right',
|
||||
html: defaultHtml,
|
||||
style: { padding: '0 10px' },
|
||||
selector,
|
||||
onSelect,
|
||||
})
|
||||
}
|
||||
|
||||
art.on('ready', update);
|
||||
art.on('restart', update);
|
||||
if (config.setting) {
|
||||
art.setting.update({
|
||||
name: 'dash-quality',
|
||||
tooltip: defaultHtml,
|
||||
html: title,
|
||||
icon: $quality,
|
||||
width: 200,
|
||||
selector,
|
||||
onSelect,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
name: 'artplayerPluginDashControl',
|
||||
update,
|
||||
};
|
||||
};
|
||||
function updateAudio(dash) {
|
||||
const audioTracks = dash.getTracksFor('audio')
|
||||
if (!audioTracks || !audioTracks.length)
|
||||
return
|
||||
|
||||
const config = option.audio || {}
|
||||
const auto = config.auto || 'Auto'
|
||||
const title = config.title || 'Audio'
|
||||
const getName = config.getName || (track => track.lang || track.id)
|
||||
const currentTrack = dash.getCurrentTrackFor('audio') || audioTracks[0]
|
||||
const defaultHtml = currentTrack ? getName(currentTrack) : auto
|
||||
|
||||
const selector = uniqBy(
|
||||
audioTracks.map((item) => {
|
||||
return {
|
||||
html: getName(item),
|
||||
value: item,
|
||||
default: currentTrack === item,
|
||||
}
|
||||
}),
|
||||
'html',
|
||||
)
|
||||
|
||||
const onSelect = (item) => {
|
||||
dash.setCurrentTrack(item.value)
|
||||
art.notice.show = `${title}: ${item.html}`
|
||||
if (config.control)
|
||||
art.controls.check(item)
|
||||
if (config.setting)
|
||||
art.setting.check(item)
|
||||
return item.html
|
||||
}
|
||||
|
||||
if (config.control) {
|
||||
art.controls.update({
|
||||
name: 'dash-audio',
|
||||
position: 'right',
|
||||
html: defaultHtml,
|
||||
style: { padding: '0 10px' },
|
||||
selector,
|
||||
onSelect,
|
||||
})
|
||||
}
|
||||
|
||||
if (config.setting) {
|
||||
art.setting.update({
|
||||
name: 'dash-audio',
|
||||
tooltip: defaultHtml,
|
||||
html: title,
|
||||
icon: $audio,
|
||||
width: 200,
|
||||
selector,
|
||||
onSelect,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function update() {
|
||||
errorHandle(art.dash.getVideoElement() === $video, 'Cannot find instance of DASH from "art.dash"')
|
||||
updateQuality(art.dash)
|
||||
updateAudio(art.dash)
|
||||
}
|
||||
|
||||
art.on('ready', update)
|
||||
art.on('restart', update)
|
||||
|
||||
return {
|
||||
name: 'artplayerPluginDashControl',
|
||||
update,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
window['artplayerPluginDashControl'] = artplayerPluginDashControl;
|
||||
window.artplayerPluginDashControl = artplayerPluginDashControl
|
||||
}
|
||||
+13
-13
@@ -1,17 +1,17 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginDashControl;
|
||||
export = artplayerPluginDashControl
|
||||
export as namespace artplayerPluginDashControl;
|
||||
|
||||
type Config = {
|
||||
control?: boolean;
|
||||
setting?: boolean;
|
||||
title?: string;
|
||||
auto?: string;
|
||||
getName?(level: object): String;
|
||||
};
|
||||
interface Config {
|
||||
control?: boolean
|
||||
setting?: boolean
|
||||
title?: string
|
||||
auto?: string
|
||||
getName?: (level: object) => string
|
||||
}
|
||||
|
||||
declare const artplayerPluginDashControl: (option: { quality?: Config; audio?: Config }) => (art: Artplayer) => {
|
||||
name: 'artplayerPluginDashControl';
|
||||
update: () => void;
|
||||
};
|
||||
declare const artplayerPluginDashControl: (option: { quality?: Config, audio?: Config }) => (art: Artplayer) => {
|
||||
name: 'artplayerPluginDashControl'
|
||||
update: () => void
|
||||
}
|
||||
Reference in new issue
Block a user