mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 01:21:20 -08:00
Refactor Artplayer class to update video URLs with query parameters
This commit is contained in:
1 parent
945ff841d5
commit
395747f88f
7 files changed
+52
-60
No files matched your search
@@ -15,7 +15,7 @@ function uniqBy(array, property) {
|
||||
export default function artplayerPluginHlsControl(option = {}) {
|
||||
return (art) => {
|
||||
const { $video } = art.template;
|
||||
const { errorHandle, query, queryAll, inverseClass } = art.constructor.utils;
|
||||
const { errorHandle } = art.constructor.utils;
|
||||
|
||||
function updateQuality(hls) {
|
||||
if (!hls.levels.length) return;
|
||||
@@ -59,13 +59,9 @@ export default function artplayerPluginHlsControl(option = {}) {
|
||||
style: { padding: '0 10px' },
|
||||
selector: selector,
|
||||
onSelect: onSelect,
|
||||
mounted: ($control) => {
|
||||
mounted: () => {
|
||||
art.on('artplayerPluginHlsControl:quality', (item) => {
|
||||
const $value = query('.art-selector-value', $control);
|
||||
const $items = queryAll('.art-selector-item', $control);
|
||||
$value.innerHTML = item.html;
|
||||
const $item = $items.find((element) => Number(element.dataset.value) === item.value);
|
||||
inverseClass($item, 'art-current');
|
||||
art.controls.check(item);
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -126,13 +122,9 @@ export default function artplayerPluginHlsControl(option = {}) {
|
||||
style: { padding: '0 10px' },
|
||||
selector: selector,
|
||||
onSelect: onSelect,
|
||||
mounted: ($control) => {
|
||||
mounted: () => {
|
||||
art.on('artplayerPluginHlsControl:audio', (item) => {
|
||||
const $value = query('.art-selector-value', $control);
|
||||
const $items = queryAll('.art-selector-item', $control);
|
||||
$value.innerHTML = item.html;
|
||||
const $item = $items.find((element) => Number(element.dataset.value) === item.value);
|
||||
inverseClass($item, 'art-current');
|
||||
art.controls.check(item);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user