mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
artplayer-plugin-hls-quality.js v1.0.1
This commit is contained in:
1 parent
d3862db0f3
commit
3391ca1fed
11 files changed
+42
-26
No files matched your search
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- 插件 `artplayerPluginHlsQuality` 添加 `getResolution` 函数选项,用于获取从 `level` 中分辨率的文本
|
||||
|
||||
## [4.6.2] - 2023-1-26
|
||||
|
||||
- `Artplayer.PROGRESS_HEIGHT` 默认值改为 `6`
|
||||
|
||||
@@ -10,17 +10,28 @@ var art = new Artplayer({
|
||||
// Show quality in setting
|
||||
setting: true,
|
||||
|
||||
// Get the resolution text from level
|
||||
getResolution: (level) => level.height + 'P',
|
||||
|
||||
// I18n
|
||||
title: 'Quality',
|
||||
auto: 'Auto',
|
||||
}),
|
||||
],
|
||||
customType: {
|
||||
m3u8: function (video, url) {
|
||||
// Attach the Hls instance to the Artplayer instance
|
||||
art.hls = new Hls();
|
||||
art.hls.loadSource(url);
|
||||
art.hls.attachMedia(video);
|
||||
},
|
||||
m3u8: function playM3u8(video, url, art) {
|
||||
if (Hls.isSupported()) {
|
||||
const hls = new Hls();
|
||||
hls.loadSource(url);
|
||||
hls.attachMedia(video);
|
||||
art.hls = hls;
|
||||
art.once('url', () => hls.destroy());
|
||||
art.once('destroy', () => hls.destroy());
|
||||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = url;
|
||||
} else {
|
||||
art.notice.show = 'Unsupported playback format: m3u8';
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* artplayer-plugin-hls-quality.js v1.0.0
|
||||
* artplayer-plugin-hls-quality.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,o,r){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[o]&&l[o],u=i.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!u[t]){if(!e[t]){var r="function"==typeof l[o]&&l[o];if(!n&&r)return r(t,!0);if(i)return i(t,!0);if(f&&"string"==typeof t)return f(t);var s=new Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},c.cache={};var a=u[t]=new d.Module(t);e[t][0].call(a.exports,c,a,a.exports,this)}return u[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=u,d.parent=i,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return l[o]}}),l[o]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){var a=d(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=a:"function"==typeof define&&define.amd&&define((function(){return a}))}}({eEHR6:[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n);var r=e("bundle-text:./image.svg"),l=o.interopDefault(r);function i(e){return t=>{const{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;return t.on("ready",(function(){const r=t.hls||window.hls;o(r&&r.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');const i=e.auto||"Auto",u=e.title||"Quality",f=r.levels[r.currentLevel],d=f?f.height+"P":i;e.control&&t.controls.add({name:"hls-quality",position:"right",html:d,style:{padding:"0 10px"},selector:r.levels.map(((e,t)=>({html:e.height+"P",level:e.level||t,default:f===e}))),onSelect:e=>(r.nextLevel=e.level,e.html)}),e.setting&&t.setting.add({name:"hls-quality",tooltip:d,html:u,icon:l.default,width:200,selector:r.levels.map(((e,t)=>({html:e.height+"P",level:e.level||t,default:f===e}))),onSelect:function(e){return r.nextLevel=e.level,e.html}})})),{name:"artplayerPluginHlsQuality"}}}n.default=i,i.env="production",i.version="1.0.0",i.build="2023-01-26 15:27:10","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"5VXix","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"5VXix":[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"9pCYc":[function(e,t,n){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||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["eEHR6"],"eEHR6","parcelRequire4dc0");
|
||||
!function(e,t,n,o,r){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l.parcelRequire4dc0&&l.parcelRequire4dc0,u=i.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[t]){if(!e[t]){var o="function"==typeof l.parcelRequire4dc0&&l.parcelRequire4dc0;if(!n&&o)return o(t,!0);if(i)return i(t,!0);if(c&&"string"==typeof t)return c(t);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}a.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},a.cache={};var d=u[t]=new f.Module(t);e[t][0].call(d.exports,a,d,d.exports,this)}return u[t].exports;function a(e){var t=a.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l.parcelRequire4dc0}}),l.parcelRequire4dc0=f;for(var d=0;d<t.length;d++)f(t[d]);var a=f(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=a:"function"==typeof define&&define.amd&&define((function(){return a}))}({eEHR6:[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n);var r=e("bundle-text:./image.svg"),l=o.interopDefault(r);function i(e){return t=>{const{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;return t.on("ready",(function(){const r=t.hls||window.hls;o(r&&r.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');const i=e.auto||"Auto",u=e.title||"Quality",c=e.getResolution||(e=>(e.height||"Unknown ")+"P"),f=r.levels[r.currentLevel],d=f?c(f):i;e.control&&t.controls.add({name:"hls-quality",position:"right",html:d,style:{padding:"0 10px"},selector:r.levels.map(((e,t)=>({html:c(e),level:e.level||t,default:f===e}))),onSelect:e=>(r.nextLevel=e.level,e.html)}),e.setting&&t.setting.add({name:"hls-quality",tooltip:d,html:u,icon:l.default,width:200,selector:r.levels.map(((e,t)=>({html:c(e),level:e.level||t,default:f===e}))),onSelect:function(e){return r.nextLevel=e.level,e.html}})})),{name:"artplayerPluginHlsQuality"}}}n.default=i,i.env="production",i.version="1.0.1",i.build="2023-02-18 11:24:38","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"5VXix","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"5VXix":[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"9pCYc":[function(e,t,n){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||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["eEHR6"],"eEHR6");
|
||||
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* artplayer-plugin-hls-quality.js v1.0.0
|
||||
* artplayer-plugin-hls-quality.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,o,r){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[o]&&l[o],u=i.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!u[t]){if(!e[t]){var r="function"==typeof l[o]&&l[o];if(!n&&r)return r(t,!0);if(i)return i(t,!0);if(f&&"string"==typeof t)return f(t);var s=new Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},c.cache={};var a=u[t]=new d.Module(t);e[t][0].call(a.exports,c,a,a.exports,this)}return u[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=u,d.parent=i,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return l[o]}}),l[o]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){var a=d(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=a:"function"==typeof define&&define.amd&&define((function(){return a}))}}({"3yim4":[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n);var r=e("bundle-text:./image.svg"),l=o.interopDefault(r);function i(e){return t=>{const{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;return t.on("ready",(function(){const r=t.hls||window.hls;o(r&&r.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');const i=e.auto||"Auto",u=e.title||"Quality",f=r.levels[r.currentLevel],d=f?f.height+"P":i;e.control&&t.controls.add({name:"hls-quality",position:"right",html:d,style:{padding:"0 10px"},selector:r.levels.map(((e,t)=>({html:e.height+"P",level:e.level||t,default:f===e}))),onSelect:e=>(r.nextLevel=e.level,e.html)}),e.setting&&t.setting.add({name:"hls-quality",tooltip:d,html:u,icon:l.default,width:200,selector:r.levels.map(((e,t)=>({html:e.height+"P",level:e.level||t,default:f===e}))),onSelect:function(e){return r.nextLevel=e.level,e.html}})})),{name:"artplayerPluginHlsQuality"}}}n.default=i,i.env="production",i.version="1.0.0",i.build="2023-01-26 15:27:11","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"9cAMb","@parcel/transformer-js/src/esmodule-helpers.js":"47PTV"}],"9cAMb":[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"47PTV":[function(e,t,n){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||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["3yim4"],"3yim4","parcelRequire4dc0");
|
||||
!function(e,t,n,r,o){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l.parcelRequire4dc0&&l.parcelRequire4dc0,u=i.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,n){if(!u[t]){if(!e[t]){var r="function"==typeof l.parcelRequire4dc0&&l.parcelRequire4dc0;if(!n&&r)return r(t,!0);if(i)return i(t,!0);if(f&&"string"==typeof t)return f(t);var o=new Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}a.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},a.cache={};var d=u[t]=new c.Module(t);e[t][0].call(d.exports,a,d,d.exports,this)}return u[t].exports;function a(e){var t=a.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.exports={}},c.modules=e,c.cache=u,c.parent=i,c.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(c,"root",{get:function(){return l.parcelRequire4dc0}}),l.parcelRequire4dc0=c;for(var d=0;d<t.length;d++)c(t[d]);var a=c(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=a:"function"==typeof define&&define.amd&&define((function(){return a}))}({"3yim4":[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n);var o=e("bundle-text:./image.svg"),l=r.interopDefault(o);function i(e){return function(t){var n=t.template.$video,r=t.constructor.utils.errorHandle;return t.on("ready",(function(){var o=t.hls||window.hls;r(o&&o.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');var i=e.auto||"Auto",u=e.title||"Quality",f=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},c=o.levels[o.currentLevel],d=c?f(c):i;e.control&&t.controls.add({name:"hls-quality",position:"right",html:d,style:{padding:"0 10px"},selector:o.levels.map((function(e,t){return{html:f(e),level:e.level||t,default:c===e}})),onSelect:function(e){return o.nextLevel=e.level,e.html}}),e.setting&&t.setting.add({name:"hls-quality",tooltip:d,html:u,icon:l.default,width:200,selector:o.levels.map((function(e,t){return{html:f(e),level:e.level||t,default:c===e}})),onSelect:function(e){return o.nextLevel=e.level,e.html}})})),{name:"artplayerPluginHlsQuality"}}}n.default=i,i.env="production",i.version="1.0.1",i.build="2023-02-18 11:24:39","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"9cAMb","@parcel/transformer-js/src/esmodule-helpers.js":"47PTV"}],"9cAMb":[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"47PTV":[function(e,t,n){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||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["3yim4"],"3yim4");
|
||||
@@ -156,8 +156,9 @@ function artplayerPluginHlsQuality(option) {
|
||||
errorHandle(hls && hls.media === $video, 'Cannot find instance of HLS from "art.hls" or "window.hls"');
|
||||
const auto = option.auto || "Auto";
|
||||
const title = option.title || "Quality";
|
||||
const getResolution = option.getResolution || ((level)=>(level.height || "Unknown ") + "P");
|
||||
const defaultLevel = hls.levels[hls.currentLevel];
|
||||
const defaultHtml = defaultLevel ? defaultLevel.height + "P" : auto;
|
||||
const defaultHtml = defaultLevel ? getResolution(defaultLevel) : auto;
|
||||
if (option.control) art.controls.add({
|
||||
name: "hls-quality",
|
||||
position: "right",
|
||||
@@ -167,7 +168,7 @@ function artplayerPluginHlsQuality(option) {
|
||||
},
|
||||
selector: hls.levels.map((item, index)=>{
|
||||
return {
|
||||
html: item.height + "P",
|
||||
html: getResolution(item),
|
||||
level: item.level || index,
|
||||
default: defaultLevel === item
|
||||
};
|
||||
@@ -185,7 +186,7 @@ function artplayerPluginHlsQuality(option) {
|
||||
width: 200,
|
||||
selector: hls.levels.map((item, index)=>{
|
||||
return {
|
||||
html: item.height + "P",
|
||||
html: getResolution(item),
|
||||
level: item.level || index,
|
||||
default: defaultLevel === item
|
||||
};
|
||||
@@ -204,12 +205,12 @@ function artplayerPluginHlsQuality(option) {
|
||||
}
|
||||
exports.default = artplayerPluginHlsQuality;
|
||||
artplayerPluginHlsQuality.env = "development";
|
||||
artplayerPluginHlsQuality.version = "1.0.0";
|
||||
artplayerPluginHlsQuality.build = "2022-12-31 21:23:08";
|
||||
artplayerPluginHlsQuality.version = "1.0.1";
|
||||
artplayerPluginHlsQuality.build = "2023-02-18 11:28:03";
|
||||
if (typeof window !== "undefined") window["artplayerPluginHlsQuality"] = artplayerPluginHlsQuality;
|
||||
|
||||
},{"bundle-text:./image.svg":"1HFaU","@parcel/transformer-js/src/esmodule-helpers.js":"5dUr6"}],"1HFaU":[function(require,module,exports) {
|
||||
module.exports = "<?xml version=\"1.0\" standalone=\"no\"?>\r\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n<svg t=\"1666857514489\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"2580\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"24\" height=\"24\"><path d=\"M870.4 176 153.6 176C104.128 176 64 216.128 64 265.6l0 492.736c0 49.472 40.128 89.6 89.6 89.6L870.4 847.936c49.472 0 89.6-40.128 89.6-89.6L960 265.6C960 216.128 919.872 176 870.4 176zM870.4 668.8 825.6 668.8c0 0-29.696-65.792-89.6-89.6s-134.4 89.6-134.4 89.6S535.04 596.992 467.2 444.8C399.36 292.608 153.6 624 153.6 624l0-358.4L870.4 265.6 870.4 668.8zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2C631.68 355.2 601.6 385.344 601.6 422.4 601.6 459.52 631.68 489.6 668.8 489.6z\" p-id=\"2581\" fill=\"#ffffff\"></path>\r\n</svg>";
|
||||
module.exports = "<?xml version=\"1.0\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg t=\"1666857514489\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"2580\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"24\" height=\"24\"><path d=\"M870.4 176 153.6 176C104.128 176 64 216.128 64 265.6l0 492.736c0 49.472 40.128 89.6 89.6 89.6L870.4 847.936c49.472 0 89.6-40.128 89.6-89.6L960 265.6C960 216.128 919.872 176 870.4 176zM870.4 668.8 825.6 668.8c0 0-29.696-65.792-89.6-89.6s-134.4 89.6-134.4 89.6S535.04 596.992 467.2 444.8C399.36 292.608 153.6 624 153.6 624l0-358.4L870.4 265.6 870.4 668.8zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2C631.68 355.2 601.6 385.344 601.6 422.4 601.6 459.52 631.68 489.6 668.8 489.6z\" p-id=\"2581\" fill=\"#ffffff\"></path>\n</svg>";
|
||||
|
||||
},{}],"5dUr6":[function(require,module,exports) {
|
||||
exports.interopDefault = function(a) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAAA;;AAEe,SAAS,0BAA0B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;oBAC1B,OAAO,KAAK,IAAI;gBACpB;YACJ;QAER;QAEA,IAAI,EAAE,CAAC,SAAS;QAEhB,OAAO;YACH,MAAM;QACV;IACJ;AACJ;kBA7DwB;AA+DxB,0BAA0B,GAAG;AAC7B,0BAA0B,OAAO;AACjC,0BAA0B,KAAK;AAE/B,IAAI,OAAO,WAAW,aAClB,MAAM,CAAC,4BAA4B,GAAG;;;ACtE1C,OAAO,OAAO,GAAG;;;ACAjB,QAAQ,cAAc,GAAG,SAAU,CAAC,EAAE;IACpC,OAAO,KAAK,EAAE,UAAU,GAAG,IAAI;QAAC,SAAS;IAAC,CAAC;AAC7C;AAEA,QAAQ,iBAAiB,GAAG,SAAU,CAAC,EAAE;IACvC,OAAO,cAAc,CAAC,GAAG,cAAc;QAAC,OAAO,IAAI;IAAA;AACrD;AAEA,QAAQ,SAAS,GAAG,SAAU,MAAM,EAAE,IAAI,EAAE;IAC1C,OAAO,IAAI,CAAC,QAAQ,OAAO,CAAC,SAAU,GAAG,EAAE;QACzC,IAAI,QAAQ,aAAa,QAAQ,gBAAgB,KAAK,cAAc,CAAC,MACnE;QAGF,OAAO,cAAc,CAAC,MAAM,KAAK;YAC/B,YAAY,IAAI;YAChB,KAAK,WAAY;gBACf,OAAO,MAAM,CAAC,IAAI;YACpB;QACF;IACF;IAEA,OAAO;AACT;AAEA,QAAQ,MAAM,GAAG,SAAU,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE;IAC9C,OAAO,cAAc,CAAC,MAAM,UAAU;QACpC,YAAY,IAAI;QAChB,KAAK;IACP;AACF","sources":["packages/artplayer-plugin-hls-quality/src/index.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-cdfe3d14efbab84d.js","node_modules/@parcel/transformer-js/src/esmodule-helpers.js"],"sourcesContent":["import image from 'bundle-text:./image.svg';\n\nexport default function artplayerPluginHlsQuality(option) {\n return (art) => {\n const { $video } = art.template;\n const { errorHandle } = art.constructor.utils;\n\n function update() {\n const hls = art.hls || window.hls;\n errorHandle(hls && hls.media === $video, 'Cannot find instance of HLS from \"art.hls\" or \"window.hls\"');\n const auto = option.auto || 'Auto';\n const title = option.title || 'Quality';\n const defaultLevel = hls.levels[hls.currentLevel];\n const defaultHtml = defaultLevel ? defaultLevel.height + 'P' : auto;\n\n if (option.control) {\n art.controls.add({\n name: 'hls-quality',\n position: 'right',\n html: defaultHtml,\n style: { padding: '0 10px' },\n selector: hls.levels.map((item, index) => {\n return {\n html: item.height + 'P',\n level: item.level || index,\n default: defaultLevel === item,\n };\n }),\n onSelect(item) {\n hls.nextLevel = item.level;\n return item.html;\n },\n });\n }\n\n if (option.setting) {\n art.setting.add({\n name: 'hls-quality',\n tooltip: defaultHtml,\n html: title,\n icon: image,\n width: 200,\n selector: hls.levels.map((item, index) => {\n return {\n html: item.height + 'P',\n level: item.level || index,\n default: defaultLevel === item,\n };\n }),\n onSelect: function (item) {\n hls.nextLevel = item.level;\n return item.html;\n },\n });\n }\n }\n\n art.on('ready', update);\n\n return {\n name: 'artplayerPluginHlsQuality',\n };\n };\n}\n\nartplayerPluginHlsQuality.env = process.env.NODE_ENV;\nartplayerPluginHlsQuality.version = process.env.APP_VER;\nartplayerPluginHlsQuality.build = process.env.BUILD_DATE;\n\nif (typeof window !== 'undefined') {\n window['artplayerPluginHlsQuality'] = artplayerPluginHlsQuality;\n}\n","module.exports = \"138ab730cddc3409\";","exports.interopDefault Line truncated
|
||||
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAAA,kDAA4C;;AAE7B,SAAS,yBAAyB,CAAC,MAAM,EAAE;IACtD,OAAO,CAAC,GAAG,GAAK;QACZ,MAAM,EAAE,MAAM,CAAA,EAAE,GAAG,GAAG,CAAC,QAAQ,AAAC;QAChC,MAAM,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AAC;CAC7C,CAAC;AAEF,OAAO,CAAC,iBAAiB,GAAG,SAAU,CAAC,EAAE;IACvC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,YAAY,EAAE;QAAC,KAAK,EAAE,IAAI;KAAC,CAAC,CAAC;CACvD,CAAC;AAEF,OAAO,CAAC,SAAS,GAAG,SAAU,MAAM,EAAE,IAAI,EAAE;IAC1C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,SAAU,GAAG,EAAE;QACzC,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,YAAY,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EACvE,OAAO;QAGT,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE;YAC/B,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE,WAAY;gBACf,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;aACpB;SACF,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;CACb,CAAC;AAEF,OAAO,CAAC,MAAM,GAAG,SAAU,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE;IAC9C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE;QACpC,UAAU,EAAE,IAAI;QAChB,GAAG,EAAE,GAAG;KACT,CAAC,CAAC;CACJ,CAAC","sources":["packages/artplayer-plugin-hls-quality/src/index.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-cdfe3d14efbab84d.js","node_modules/@parcel/transformer-js/src/esmodule-helpers.js"],"sourcesContent":["import image from 'bundle-text:./image.svg';\n\nexport default function artplayerPluginHlsQuality(option) {\n return (art) => {\n const { $video } = art.template;\n const { errorHandle } = art.constructor.utils;\n\n function update() {\n const hls = art.hls || window.hls;\n errorHandle(hls && hls.media === $video, 'Cannot find instance of HLS from \"art.hls\" or \"window.hls\"');\n const auto = option.auto || 'Auto';\n const title = option.title || 'Quality';\n const getResolution = option.getResolution || ((level) => (level.height || 'Unknown ') + 'P');\n const defaultLevel = hls.levels[hls.currentLevel];\n const defaultHtml = defaultLevel ? getResolution(defaultLevel) : auto;\n\n if (option.control) {\n art.controls.add({\n name: 'hls-quality',\n position: 'right',\n html: defaultHtml,\n style: { padding: '0 10px' },\n selector: hls.levels.map((item, index) => {\n return {\n html: getResolution(item),\n level: item.level || index,\n default: defaultLevel === item,\n };\n }),\n onSelect(item) {\n hls.nextLevel = item.level;\n return item.html;\n },\n });\n }\n\n if (option.setting) {\n art.setting.add({\n name: 'hls-quality',\n Line truncated
|
||||
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* artplayer-plugin-hls-quality.js v1.0.0
|
||||
* artplayer-plugin-hls-quality.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,o,r){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[o]&&l[o],u=i.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!u[t]){if(!e[t]){var r="function"==typeof l[o]&&l[o];if(!n&&r)return r(t,!0);if(i)return i(t,!0);if(f&&"string"==typeof t)return f(t);var s=new Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},c.cache={};var a=u[t]=new d.Module(t);e[t][0].call(a.exports,c,a,a.exports,this)}return u[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=u,d.parent=i,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return l[o]}}),l[o]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){var a=d(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=a:"function"==typeof define&&define.amd&&define((function(){return a}))}}({eEHR6:[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n);var r=e("bundle-text:./image.svg"),l=o.interopDefault(r);function i(e){return t=>{const{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;return t.on("ready",(function(){const r=t.hls||window.hls;o(r&&r.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');const i=e.auto||"Auto",u=e.title||"Quality",f=r.levels[r.currentLevel],d=f?f.height+"P":i;e.control&&t.controls.add({name:"hls-quality",position:"right",html:d,style:{padding:"0 10px"},selector:r.levels.map(((e,t)=>({html:e.height+"P",level:e.level||t,default:f===e}))),onSelect:e=>(r.nextLevel=e.level,e.html)}),e.setting&&t.setting.add({name:"hls-quality",tooltip:d,html:u,icon:l.default,width:200,selector:r.levels.map(((e,t)=>({html:e.height+"P",level:e.level||t,default:f===e}))),onSelect:function(e){return r.nextLevel=e.level,e.html}})})),{name:"artplayerPluginHlsQuality"}}}n.default=i,i.env="production",i.version="1.0.0",i.build="2023-01-26 15:27:10","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"5VXix","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"5VXix":[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"9pCYc":[function(e,t,n){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||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["eEHR6"],"eEHR6","parcelRequire4dc0");
|
||||
!function(e,t,n,o,r){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l.parcelRequire4dc0&&l.parcelRequire4dc0,u=i.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[t]){if(!e[t]){var o="function"==typeof l.parcelRequire4dc0&&l.parcelRequire4dc0;if(!n&&o)return o(t,!0);if(i)return i(t,!0);if(c&&"string"==typeof t)return c(t);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}a.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},a.cache={};var d=u[t]=new f.Module(t);e[t][0].call(d.exports,a,d,d.exports,this)}return u[t].exports;function a(e){var t=a.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l.parcelRequire4dc0}}),l.parcelRequire4dc0=f;for(var d=0;d<t.length;d++)f(t[d]);var a=f(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=a:"function"==typeof define&&define.amd&&define((function(){return a}))}({eEHR6:[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n);var r=e("bundle-text:./image.svg"),l=o.interopDefault(r);function i(e){return t=>{const{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;return t.on("ready",(function(){const r=t.hls||window.hls;o(r&&r.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');const i=e.auto||"Auto",u=e.title||"Quality",c=e.getResolution||(e=>(e.height||"Unknown ")+"P"),f=r.levels[r.currentLevel],d=f?c(f):i;e.control&&t.controls.add({name:"hls-quality",position:"right",html:d,style:{padding:"0 10px"},selector:r.levels.map(((e,t)=>({html:c(e),level:e.level||t,default:f===e}))),onSelect:e=>(r.nextLevel=e.level,e.html)}),e.setting&&t.setting.add({name:"hls-quality",tooltip:d,html:u,icon:l.default,width:200,selector:r.levels.map(((e,t)=>({html:c(e),level:e.level||t,default:f===e}))),onSelect:function(e){return r.nextLevel=e.level,e.html}})})),{name:"artplayerPluginHlsQuality"}}}n.default=i,i.env="production",i.version="1.0.1",i.build="2023-02-18 11:24:38","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"5VXix","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"5VXix":[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"9pCYc":[function(e,t,n){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||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["eEHR6"],"eEHR6");
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* artplayer-plugin-hls-quality.js v1.0.0
|
||||
* artplayer-plugin-hls-quality.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,o,r){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[o]&&l[o],u=i.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!u[t]){if(!e[t]){var r="function"==typeof l[o]&&l[o];if(!n&&r)return r(t,!0);if(i)return i(t,!0);if(f&&"string"==typeof t)return f(t);var s=new Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},c.cache={};var a=u[t]=new d.Module(t);e[t][0].call(a.exports,c,a,a.exports,this)}return u[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=u,d.parent=i,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return l[o]}}),l[o]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){var a=d(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=a:"function"==typeof define&&define.amd&&define((function(){return a}))}}({"3yim4":[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n);var r=e("bundle-text:./image.svg"),l=o.interopDefault(r);function i(e){return t=>{const{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;return t.on("ready",(function(){const r=t.hls||window.hls;o(r&&r.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');const i=e.auto||"Auto",u=e.title||"Quality",f=r.levels[r.currentLevel],d=f?f.height+"P":i;e.control&&t.controls.add({name:"hls-quality",position:"right",html:d,style:{padding:"0 10px"},selector:r.levels.map(((e,t)=>({html:e.height+"P",level:e.level||t,default:f===e}))),onSelect:e=>(r.nextLevel=e.level,e.html)}),e.setting&&t.setting.add({name:"hls-quality",tooltip:d,html:u,icon:l.default,width:200,selector:r.levels.map(((e,t)=>({html:e.height+"P",level:e.level||t,default:f===e}))),onSelect:function(e){return r.nextLevel=e.level,e.html}})})),{name:"artplayerPluginHlsQuality"}}}n.default=i,i.env="production",i.version="1.0.0",i.build="2023-01-26 15:27:11","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"9cAMb","@parcel/transformer-js/src/esmodule-helpers.js":"47PTV"}],"9cAMb":[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"47PTV":[function(e,t,n){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||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["3yim4"],"3yim4","parcelRequire4dc0");
|
||||
!function(e,t,n,r,o){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l.parcelRequire4dc0&&l.parcelRequire4dc0,u=i.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,n){if(!u[t]){if(!e[t]){var r="function"==typeof l.parcelRequire4dc0&&l.parcelRequire4dc0;if(!n&&r)return r(t,!0);if(i)return i(t,!0);if(f&&"string"==typeof t)return f(t);var o=new Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}a.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},a.cache={};var d=u[t]=new c.Module(t);e[t][0].call(d.exports,a,d,d.exports,this)}return u[t].exports;function a(e){var t=a.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.exports={}},c.modules=e,c.cache=u,c.parent=i,c.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(c,"root",{get:function(){return l.parcelRequire4dc0}}),l.parcelRequire4dc0=c;for(var d=0;d<t.length;d++)c(t[d]);var a=c(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=a:"function"==typeof define&&define.amd&&define((function(){return a}))}({"3yim4":[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n);var o=e("bundle-text:./image.svg"),l=r.interopDefault(o);function i(e){return function(t){var n=t.template.$video,r=t.constructor.utils.errorHandle;return t.on("ready",(function(){var o=t.hls||window.hls;r(o&&o.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');var i=e.auto||"Auto",u=e.title||"Quality",f=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},c=o.levels[o.currentLevel],d=c?f(c):i;e.control&&t.controls.add({name:"hls-quality",position:"right",html:d,style:{padding:"0 10px"},selector:o.levels.map((function(e,t){return{html:f(e),level:e.level||t,default:c===e}})),onSelect:function(e){return o.nextLevel=e.level,e.html}}),e.setting&&t.setting.add({name:"hls-quality",tooltip:d,html:u,icon:l.default,width:200,selector:o.levels.map((function(e,t){return{html:f(e),level:e.level||t,default:c===e}})),onSelect:function(e){return o.nextLevel=e.level,e.html}})})),{name:"artplayerPluginHlsQuality"}}}n.default=i,i.env="production",i.version="1.0.1",i.build="2023-02-18 11:24:39","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"9cAMb","@parcel/transformer-js/src/esmodule-helpers.js":"47PTV"}],"9cAMb":[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"47PTV":[function(e,t,n){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||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["3yim4"],"3yim4");
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"license": "MIT",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"name": "artplayer-plugin-hls-quality",
|
||||
"types": "types/artplayer-plugin-hls-quality.d.ts",
|
||||
"description": "Iframe plugin for ArtPlayer",
|
||||
@@ -21,4 +21,4 @@
|
||||
"video",
|
||||
"player"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,9 @@ export default function artplayerPluginHlsQuality(option) {
|
||||
errorHandle(hls && hls.media === $video, 'Cannot find instance of HLS from "art.hls" or "window.hls"');
|
||||
const auto = option.auto || 'Auto';
|
||||
const title = option.title || 'Quality';
|
||||
const getResolution = option.getResolution || ((level) => (level.height || 'Unknown ') + 'P');
|
||||
const defaultLevel = hls.levels[hls.currentLevel];
|
||||
const defaultHtml = defaultLevel ? defaultLevel.height + 'P' : auto;
|
||||
const defaultHtml = defaultLevel ? getResolution(defaultLevel) : auto;
|
||||
|
||||
if (option.control) {
|
||||
art.controls.add({
|
||||
@@ -21,7 +22,7 @@ export default function artplayerPluginHlsQuality(option) {
|
||||
style: { padding: '0 10px' },
|
||||
selector: hls.levels.map((item, index) => {
|
||||
return {
|
||||
html: item.height + 'P',
|
||||
html: getResolution(item),
|
||||
level: item.level || index,
|
||||
default: defaultLevel === item,
|
||||
};
|
||||
@@ -42,7 +43,7 @@ export default function artplayerPluginHlsQuality(option) {
|
||||
width: 200,
|
||||
selector: hls.levels.map((item, index) => {
|
||||
return {
|
||||
html: item.height + 'P',
|
||||
html: getResolution(item),
|
||||
level: item.level || index,
|
||||
default: defaultLevel === item,
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@ declare const artplayerPluginHlsQuality: (option: {
|
||||
setting?: boolean;
|
||||
title?: string;
|
||||
auto?: string;
|
||||
getResolution?(level: any): String;
|
||||
}) => (art: Artplayer) => {
|
||||
name: 'artplayerPluginHlsQuality';
|
||||
};
|
||||
Reference in new issue
Block a user