Only save quality setting when it's updated by the user. Fixes bug in html5 player where it would override the settings if the current video does not support the given quality.

This commit is contained in:
Robin van Nunen 2018-09-29 21:23:10 +02:00
parent fac134dd95
commit a86bbae851
2 changed files with 10 additions and 3 deletions

View File

@ -82,9 +82,6 @@ const html5 = {
triggerEvent.call(player, player.media, 'qualitychange', false, {
quality: input,
});
// Save to storage
player.storage.set({ quality: input });
},
});
},

View File

@ -692,10 +692,15 @@ class Plyr {
config.default,
].find(is.number);
let updateStorage = true;
if (!options.includes(quality)) {
const value = closest(options, quality);
this.debug.warn(`Unsupported quality option: ${quality}, using ${value} instead`);
quality = value;
// Don't update storage if quality is not supported
updateStorage = false;
}
// Update config
@ -703,6 +708,11 @@ class Plyr {
// Set quality
this.media.quality = quality;
// Save to storage
if (updateStorage) {
this.storage.set({ quality: quality });
}
}
/**