Merge remote-tracking branch 'origin/artplayer-plugin-dash-control'

This commit is contained in:
Harvey Zack committed 2024-10-26 15:26:14 +08:00
commit 5e8047e33b
24 files changed
+602 -230

No files matched your search

@@ -1,10 +1,10 @@
# artplayer-plugin-dash-quality
# artplayer-plugin-dash-control
Dash quality plugin for ArtPlayer
Dash control plugin for ArtPlayer
## Demo
[https://artplayer.org](https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.5.2/dash.all.min.js%0A./uncompiled/artplayer-plugin-dash-quality/index.js&example=dash.quality)
[https://artplayer.org](https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.5.2/dash.all.min.js%0A./uncompiled/artplayer-plugin-dash-control/index.js&example=dash.control)
## License
@@ -1,11 +1,11 @@
{
"license": "MIT",
"version": "2.0.0",
"name": "artplayer-plugin-dash-quality",
"types": "types/artplayer-plugin-dash-quality.d.ts",
"description": "Iframe plugin for ArtPlayer",
"main": "dist/artplayer-plugin-dash-quality.js",
"legacy": "dist/artplayer-plugin-dash-quality.legacy.js",
"version": "1.0.0",
"name": "artplayer-plugin-dash-control",
"types": "types/artplayer-plugin-dash-control.d.ts",
"description": "Dash control plugin for ArtPlayer",
"main": "dist/artplayer-plugin-dash-control.js",
"legacy": "dist/artplayer-plugin-dash-control.legacy.js",
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
"browserslist": "last 1 Chrome version",
"homepage": "https://artplayer.org",
@@ -21,4 +21,4 @@
"video",
"player"
]
}
}
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6c26.5 0 48 21.5 48 48l0 128c0 26.5-21.5 48-48 48c-44.2 0-80-35.8-80-80l0-16 0-48 0-48C0 146.6 114.6 32 256 32s256 114.6 256 256l0 48 0 48 0 16c0 44.2-35.8 80-80 80c-26.5 0-48-21.5-48-48l0-128c0-26.5 21.5-48 48-48c10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80z"/></svg>

After

Width:  |  Height:  |  Size: 424 B

@@ -0,0 +1,174 @@
import $quality from 'bundle-text:./quality.svg';
import $audio from 'bundle-text:./audio.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);
});
}
export default function artplayerPluginDashControl(option = {}) {
return (art) => {
const { $video } = art.template;
const { errorHandle } = art.constructor.utils;
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 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,
});
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,
});
}
}
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,
});
}
}
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;
}
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-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.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>

After

Width:  |  Height:  |  Size: 506 B

@@ -0,0 +1,17 @@
import type Artplayer from 'artplayer';
export = artplayerPluginDashControl;
export as namespace artplayerPluginDashControl;
type 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;
};
@@ -1 +0,0 @@
/*! * artplayer-plugin-dash-quality.js v2.0.0 * Github:https://github.com/zhw2590582/ArtPlayer * (c) 2017-2024 Harvey Zack * Released under the MIT License. */ !function(e,t,n,o,r){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof i[o]&&i[o],l=a.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!l[t]){if(!e[t]){var r="function"==typeof i[o]&&i[o];if(!n&&r)return r(t,!0);if(a)return a(t,!0);if(u&&"string"==typeof t)return u(t);var s=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 f=l[t]=new d.Module(t);e[t][0].call(f.exports,c,f,f.exports,this)}return l[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=l,d.parent=a,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[o]}}),i[o]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){var f=d(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({"92dvd":[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",()=>a);var r=e("bundle-text:./image.svg"),i=o.interopDefault(r);function a(e){return t=>{!function(e){let{version:t,utils:{errorHandle:n}}=e.constructor,o=t.split(".").map(Number);n(o[0]+o[1]/100>=5,`Artplayer.js@${t}is not compatible the artplayerPluginDashQuality@${a.version}. Please update it to version Artplayer.js@5.x.x`)}(t);let{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function r(){let r=t.dash||window.dash;o(r&&r.getVideoElement()===n,'Cannot find instance of Dash from "art.dash" or "window.dash"');let a=e.auto||"Auto",l=e.title||"Quality",u=r.getBitrateInfoListFor("video"),d=r.getQualityFor("video"),s=e.getResolution||(e=>(e.height||"Unknown ")+"P"),f=r.getSettings(),c=u[d],p=f?.streaming?.abr?.autoSwitchBitrate?.video?a:s(c),h={streaming:{abr:{autoSwitchBitrate:{}}}};e.control&&t.controls.update({name:"dash-quality",position:"right",html:p,style:{padding:"0 10px"},selector:u.map((e,t)=>({html:s(e),level:t,default:c===e})),onSelect:e=>(h.streaming.abr.autoSwitchBitrate.video=!1,r.updateSettings(h),r.setQualityFor("video",e.level,!0),e.html)}),e.setting&&t.setting.update({name:"dash-quality",tooltip:p,html:l,icon:i.default,width:200,selector:u.map((e,t)=>({html:s(e),level:t,default:c===e})),onSelect:function(e){return h.streaming.abr.autoSwitchBitrate.video=!1,r.updateSettings(h),r.setQualityFor("video",e.level,!0),e.html}})}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginDashQuality"}}}"undefined"!=typeof window&&(window.artplayerPluginDashQuality=a)},{"bundle-text:./image.svg":"kcayM","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],kcayM:[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||Object.prototype.hasOwnProperty.call(t,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})}},{}]},["92dvd"],"92dvd","parcelRequire4dc0");
@@ -1 +0,0 @@
/*! * artplayer-plugin-dash-quality.js v2.0.0 * Github:https://github.com/zhw2590582/ArtPlayer * (c) 2017-2024 Harvey Zack * Released under the MIT License. */ !function(e,t,n,o,r){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof i[o]&&i[o],l=u.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!l[t]){if(!e[t]){var r="function"==typeof i[o]&&i[o];if(!n&&r)return r(t,!0);if(u)return u(t,!0);if(a&&"string"==typeof t)return a(t);var s=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 f=l[t]=new d.Module(t);e[t][0].call(f.exports,c,f,f.exports,this)}return l[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=l,d.parent=u,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[o]}}),i[o]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){var f=d(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({gZVrQ:[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",function(){return u});var r=e("bundle-text:./image.svg"),i=o.interopDefault(r);function u(e){return function(t){o=(n=t.constructor).version,(0,n.utils.errorHandle)((r=o.split(".").map(Number))[0]+r[1]/100>=5,"Artplayer.js@".concat(o," is not compatible the artplayerPluginDashQuality@").concat(u.version,". Please update it to version Artplayer.js@5.x.x"));var n,o,r,l=t.template.$video,a=t.constructor.utils.errorHandle;function d(){var n,o,r,u=t.dash||window.dash;a(u&&u.getVideoElement()===l,'Cannot find instance of Dash from "art.dash" or "window.dash"');var d=e.auto||"Auto",s=e.title||"Quality",f=u.getBitrateInfoListFor("video"),c=u.getQualityFor("video"),p=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},h=u.getSettings(),g=f[c],v=(null==h?void 0:null===(r=h.streaming)||void 0===r?void 0:null===(o=r.abr)||void 0===o?void 0:null===(n=o.autoSwitchBitrate)||void 0===n?void 0:n.video)?d:p(g),m={streaming:{abr:{autoSwitchBitrate:{}}}};e.control&&t.controls.update({name:"dash-quality",position:"right",html:v,style:{padding:"0 10px"},selector:f.map(function(e,t){return{html:p(e),level:t,default:g===e}}),onSelect:function(e){return m.streaming.abr.autoSwitchBitrate.video=!1,u.updateSettings(m),u.setQualityFor("video",e.level,!0),e.html}}),e.setting&&t.setting.update({name:"dash-quality",tooltip:v,html:s,icon:i.default,width:200,selector:f.map(function(e,t){return{html:p(e),level:t,default:g===e}}),onSelect:function(e){return m.streaming.abr.autoSwitchBitrate.video=!1,u.updateSettings(m),u.setQualityFor("video",e.level,!0),e.html}})}return t.on("ready",d),t.on("restart",d),{name:"artplayerPluginDashQuality"}}}"undefined"!=typeof window&&(window.artplayerPluginDashQuality=u)},{"bundle-text:./image.svg":"gI7Xh","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],gI7Xh:[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>'},{}],iWrD0:[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||Object.prototype.hasOwnProperty.call(t,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})}},{}]},["gZVrQ"],"gZVrQ","parcelRequire4dc0");
@@ -1,4 +0,0 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<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>
</svg>

Before

Width:  |  Height:  |  Size: 883 B

@@ -1,104 +0,0 @@
import image from 'bundle-text:./image.svg';
function checkVersion(art) {
const {
version,
utils: { errorHandle },
} = art.constructor;
const arr = version.split('.').map(Number);
const major = arr[0];
const minor = arr[1] / 100;
errorHandle(
major + minor >= 5,
`Artplayer.js@${version} is not compatible the artplayerPluginDashQuality@${artplayerPluginDashQuality.version}. Please update it to version Artplayer.js@5.x.x`,
);
}
export default function artplayerPluginDashQuality(option) {
return (art) => {
checkVersion(art);
const { $video } = art.template;
const { errorHandle } = art.constructor.utils;
function update() {
const dash = art.dash || window.dash;
errorHandle(
dash && dash.getVideoElement() === $video,
'Cannot find instance of Dash from "art.dash" or "window.dash"',
);
const auto = option.auto || 'Auto';
const title = option.title || 'Quality';
const levels = dash.getBitrateInfoListFor('video');
const currentLevel = dash.getQualityFor('video');
const getResolution = option.getResolution || ((level) => (level.height || 'Unknown ') + 'P');
const settings = dash.getSettings();
const defaultLevel = levels[currentLevel];
const defaultHtml = settings?.streaming?.abr?.autoSwitchBitrate?.video ? auto : getResolution(defaultLevel);
const cfg = {
streaming: {
abr: {
autoSwitchBitrate: {},
},
},
};
if (option.control) {
art.controls.update({
name: 'dash-quality',
position: 'right',
html: defaultHtml,
style: { padding: '0 10px' },
selector: levels.map((item, index) => {
return {
html: getResolution(item),
level: index,
default: defaultLevel === item,
};
}),
onSelect(item) {
cfg.streaming.abr.autoSwitchBitrate['video'] = false;
dash.updateSettings(cfg);
dash.setQualityFor('video', item.level, true);
return item.html;
},
});
}
if (option.setting) {
art.setting.update({
name: 'dash-quality',
tooltip: defaultHtml,
html: title,
icon: image,
width: 200,
selector: levels.map((item, index) => {
return {
html: getResolution(item),
level: index,
default: defaultLevel === item,
};
}),
onSelect: function (item) {
cfg.streaming.abr.autoSwitchBitrate['video'] = false;
dash.updateSettings(cfg);
dash.setQualityFor('video', item.level, true);
return item.html;
},
});
}
}
art.on('ready', update);
art.on('restart', update);
return {
name: 'artplayerPluginDashQuality',
};
};
}
if (typeof window !== 'undefined') {
window['artplayerPluginDashQuality'] = artplayerPluginDashQuality;
}
@@ -1,14 +0,0 @@
import type Artplayer from 'artplayer';
export = artplayerPluginDashQuality;
export as namespace artplayerPluginDashQuality;
declare const artplayerPluginDashQuality: (option: {
control?: boolean;
setting?: boolean;
title?: string;
auto?: string;
getResolution?(level: any): String;
}) => (art: Artplayer) => {
name: 'artplayerPluginDashQuality';
};
@@ -3,7 +3,7 @@
"version": "1.0.1",
"name": "artplayer-plugin-hls-control",
"types": "types/artplayer-plugin-hls-control.d.ts",
"description": "Iframe plugin for ArtPlayer",
"description": "Hls control plugin for ArtPlayer",
"main": "dist/artplayer-plugin-hls-control.js",
"legacy": "dist/artplayer-plugin-hls-control.legacy.js",
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
@@ -47,7 +47,8 @@ export default function artplayerPluginHlsControl(option = {}) {
const onSelect = (item) => {
hls.currentLevel = item.value;
art.notice.show = `${title}: ${item.html}`;
art.emit('artplayerPluginHlsControl:quality', item);
if (config.control) art.controls.check(item);
if (config.setting) art.setting.check(item);
return item.html;
};
@@ -59,11 +60,6 @@ export default function artplayerPluginHlsControl(option = {}) {
style: { padding: '0 10px' },
selector: selector,
onSelect: onSelect,
mounted: () => {
art.on('artplayerPluginHlsControl:quality', (item) => {
art.controls.check(item);
});
},
});
}
@@ -76,11 +72,6 @@ export default function artplayerPluginHlsControl(option = {}) {
width: 200,
selector: selector,
onSelect: onSelect,
mounted: () => {
art.on('artplayerPluginHlsControl:quality', (item) => {
art.setting.check(item);
});
},
});
}
}
@@ -108,9 +99,9 @@ export default function artplayerPluginHlsControl(option = {}) {
const onSelect = (item) => {
hls.audioTrack = item.value;
art.loading.show = true;
art.notice.show = `${title}: ${item.html}`;
art.emit('artplayerPluginHlsControl:audio', item);
if (config.control) art.controls.check(item);
if (config.setting) art.setting.check(item);
return item.html;
};
@@ -122,11 +113,6 @@ export default function artplayerPluginHlsControl(option = {}) {
style: { padding: '0 10px' },
selector: selector,
onSelect: onSelect,
mounted: () => {
art.on('artplayerPluginHlsControl:audio', (item) => {
art.controls.check(item);
});
},
});
}
@@ -139,11 +125,6 @@ export default function artplayerPluginHlsControl(option = {}) {
width: 200,
selector: selector,
onSelect: onSelect,
mounted: () => {
art.on('artplayerPluginHlsControl:audio', (item) => {
art.setting.check(item);
});
},
});
}
}
@@ -70,7 +70,7 @@ const config = {
{ text: '视频广告', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-ads/index.js&example=ads' },
{ text: 'Iframe 控制', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-iframe/index.js&example=iframe' },
{ text: 'Hls 控制', link: 'https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/hls.js/8.0.0-beta.3/hls.min.js%0A./uncompiled/artplayer-plugin-hls-control/index.js&example=hls.control' },
{ text: 'Dash 画质', link: 'https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.5.2/dash.all.min.js%0A./uncompiled/artplayer-plugin-dash-quality/index.js&example=dash.quality' },
{ text: 'Dash 控制', link: 'https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.5.2/dash.all.min.js%0A./uncompiled/artplayer-plugin-dash-control/index.js&example=dash.control' },
{ text: 'Vtt 缩略图', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vtt-thumbnail/index.js&example=vtt.thumbnail'},
{ text: '多重字幕', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-multiple-subtitles/index.js&example=multiple.subtitles'},
{ text: 'Ass 字幕', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-libass/index.js&example=libass'},
@@ -138,7 +138,7 @@ const config = {
{ text: 'Advertise', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-ads/index.js&example=ads' },
{ text: 'Iframe Control', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-iframe/index.js&example=iframe' },
{ text: 'Hls Control', link: 'https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/hls.js/8.0.0-beta.3/hls.min.js%0A./uncompiled/artplayer-plugin-hls-control/index.js&example=hls.control' },
{ text: 'Dash Quality', link: 'https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.5.2/dash.all.min.js%0A./uncompiled/artplayer-plugin-dash-quality/index.js&example=dash.quality' },
{ text: 'Dash Control', link: 'https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.5.2/dash.all.min.js%0A./uncompiled/artplayer-plugin-dash-control/index.js&example=dash.control' },
{ text: 'Vtt Thumbnail', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vtt-thumbnail/index.js&example=vtt.thumbnail'},
{ text: 'Multiple Subtitles', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-multiple-subtitles/index.js&example=multiple.subtitles'},
{ text: 'Ass Subtitle', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-libass/index.js&example=libass'},