Skip to content

Commit a86bbae

Browse files
committed
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.
1 parent fac134d commit a86bbae

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/js/html5.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ const html5 = {
8282
triggerEvent.call(player, player.media, 'qualitychange', false, {
8383
quality: input,
8484
});
85-
86-
// Save to storage
87-
player.storage.set({ quality: input });
8885
},
8986
});
9087
},

src/js/plyr.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,17 +692,27 @@ class Plyr {
692692
config.default,
693693
].find(is.number);
694694

695+
let updateStorage = true;
696+
695697
if (!options.includes(quality)) {
696698
const value = closest(options, quality);
697699
this.debug.warn(`Unsupported quality option: ${quality}, using ${value} instead`);
698700
quality = value;
701+
702+
// Don't update storage if quality is not supported
703+
updateStorage = false;
699704
}
700705

701706
// Update config
702707
config.selected = quality;
703708

704709
// Set quality
705710
this.media.quality = quality;
711+
712+
// Save to storage
713+
if (updateStorage) {
714+
this.storage.set({ quality: quality });
715+
}
706716
}
707717

708718
/**

0 commit comments

Comments
 (0)