Skip to content

Commit

Permalink
hls: instantiate stream-controller after abr-controller
Browse files Browse the repository at this point in the history
fix startLevel=-1 not working since v0.7.0
FRAG_LOADED event needs to be handled first in abr-controller so that nextAutoLevel will return the correct value when stream-controller will pick it up
relying on listener order is not satisfactory, we need to sync of a better way ...
  • Loading branch information
mangui committed Feb 24, 2017
1 parent 5cbbb55 commit d652909
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/hls.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ class Hls {
this.off = observer.off.bind(observer);
this.trigger = observer.trigger.bind(observer);

// core controllers and network loaders
const abrController = this.abrController = new config.abrController(this);
const bufferController = new config.bufferController(this);
const capLevelController = new config.capLevelController(this);
const fpsController = new config.fpsController(this);
const playListLoader = new PlaylistLoader(this);
const fragmentLoader = new FragmentLoader(this);
const keyLoader = new KeyLoader(this);

// network controllers
const levelController = this.levelController = new LevelController(this);
const streamController = this.streamController = new StreamController(this);
Expand All @@ -99,19 +108,8 @@ class Hls {
if (Controller) {
networkControllers.push(new Controller(this));
}

this.networkControllers = networkControllers;

// core controllers and network loaders
// hls.abrController is referenced in levelController, this would need to be fixed
const abrController = this.abrController = new config.abrController(this);
const bufferController = new config.bufferController(this);
const capLevelController = new config.capLevelController(this);
const fpsController = new config.fpsController(this);
const playListLoader = new PlaylistLoader(this);
const fragmentLoader = new FragmentLoader(this);
const keyLoader = new KeyLoader(this);

let coreComponents = [ playListLoader, fragmentLoader, keyLoader, abrController, bufferController, capLevelController, fpsController ];

// optional audio track and subtitle controller
Expand Down

0 comments on commit d652909

Please sign in to comment.