mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 23:51:20 -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
@@ -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,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user