Refactor Control class to update control option variables and element references

This commit is contained in:
Harvey Zack committed 2024-10-21 18:32:42 +08:00
1 parent bb3fc27427
commit cebbb6ec29
4 files changed
+17 -71

No files matched your search

@@ -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);
});
},
});
}
}
@@ -110,7 +101,8 @@ export default function artplayerPluginHlsControl(option = {}) {
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 +114,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 +126,6 @@ export default function artplayerPluginHlsControl(option = {}) {
width: 200,
selector: selector,
onSelect: onSelect,
mounted: () => {
art.on('artplayerPluginHlsControl:audio', (item) => {
art.setting.check(item);
});
},
});
}
}