mirror of
https://github.com/iv-org/videojs-quality-selector.git
synced 2025-12-20 10:55:18 -05:00
Refs #13 Support quality selector buttons anywhere in the player's component hierarchy
Previously, the SourceInterceptor made the assumption that the QualitySelector button component is a direct child of the controlBar component. That may not always be true. Video.js allows you to specify a nested hierarchy of components, and so when plugin users choose to move the QualitySelector button elsewhere, the plugin does not work properly. This commit introduces a new event type called QUALITY_REQUESTED to signal when the user is requesting a quality change. The old QUALITY_SELECTED event is now used to denote when the plugin actually uses a new quality source. This dichotomy eliminates the need for the SourceInterceptor to have a reference to the QualitySelector button component.
This commit is contained in:
parent
ec9e06196f
commit
a682125480
5 changed files with 19 additions and 13 deletions
|
|
@ -13,7 +13,7 @@ module.exports = function(videojs) {
|
|||
|
||||
videojs.hook('setup', function(player) {
|
||||
// Add handler to switch sources when the user requests a change
|
||||
player.on(events.QUALITY_SELECTED, function(event, newSource) {
|
||||
player.on(events.QUALITY_REQUESTED, function(event, newSource) {
|
||||
var sources = player.currentSources(),
|
||||
currentTime = player.currentTime(),
|
||||
isPaused = player.paused(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue