mirror of
https://gitea.invidious.io/iv-org/videojs-quality-selector.git
synced 2024-08-15 00:43:13 +00:00
Merge pull request #48 from yokuze/fix_empty_selector_menu_47
fix: Update menu when sources are set after player is ready (#47)
This commit is contained in:
commit
303d85532a
3 changed files with 11 additions and 0 deletions
|
@ -34,6 +34,11 @@ module.exports = function(videojs) {
|
|||
});
|
||||
}.bind(this));
|
||||
|
||||
// Update the list of menu items only when the list of sources change
|
||||
player.on(events.PLAYER_SOURCES_CHANGED, function() {
|
||||
this.update();
|
||||
}.bind(this));
|
||||
|
||||
player.on(events.QUALITY_SELECTED, function(event, newSource) {
|
||||
// Update the selected source with the source that was actually selected
|
||||
this.setSelectedSource(newSource);
|
||||
|
|
|
@ -4,5 +4,6 @@ module.exports = {
|
|||
|
||||
QUALITY_REQUESTED: 'qualityRequested',
|
||||
QUALITY_SELECTED: 'qualitySelected',
|
||||
PLAYER_SOURCES_CHANGED: 'playerSourcesChanged',
|
||||
|
||||
};
|
||||
|
|
|
@ -17,6 +17,11 @@ module.exports = function(videojs) {
|
|||
player._qualitySelectorSafeSeek.onPlayerSourcesChange();
|
||||
}
|
||||
|
||||
if (!_.isEqual(sources, player._qualitySelectorPreviousSources)) {
|
||||
player.trigger(events.PLAYER_SOURCES_CHANGED, sources);
|
||||
player._qualitySelectorPreviousSources = sources;
|
||||
}
|
||||
|
||||
// There are generally two source options, the one that videojs
|
||||
// auto-selects and the one that a "user" of this plugin has
|
||||
// supplied via the `selected` property. `selected` can come from
|
||||
|
|
Loading…
Reference in a new issue