9e932b3b by David LaPalomento

Merge pull request #183 from videojs/trigger-bandwidth-events

Add a 'bandwidthupdate' event
2 parents 61566277 83237357
...@@ -125,7 +125,8 @@ videojs.Hls.prototype.handleSourceOpen = function() { ...@@ -125,7 +125,8 @@ videojs.Hls.prototype.handleSourceOpen = function() {
125 }; 125 };
126 126
127 oldMediaPlaylist = this.playlists.media(); 127 oldMediaPlaylist = this.playlists.media();
128 this.bandwidth = this.playlists.bandwidth; 128 this.setBandwidth(this.playlists);
129
129 selectedPlaylist = this.selectPlaylist(); 130 selectedPlaylist = this.selectPlaylist();
130 oldBitrate = oldMediaPlaylist.attributes && 131 oldBitrate = oldMediaPlaylist.attributes &&
131 oldMediaPlaylist.attributes.BANDWIDTH || 0; 132 oldMediaPlaylist.attributes.BANDWIDTH || 0;
...@@ -464,6 +465,8 @@ videojs.Hls.prototype.setBandwidth = function(xhr) { ...@@ -464,6 +465,8 @@ videojs.Hls.prototype.setBandwidth = function(xhr) {
464 tech.segmentXhrTime = xhr.roundTripTime; 465 tech.segmentXhrTime = xhr.roundTripTime;
465 tech.bandwidth = xhr.bandwidth; 466 tech.bandwidth = xhr.bandwidth;
466 tech.bytesReceived += xhr.bytesReceived || 0; 467 tech.bytesReceived += xhr.bytesReceived || 0;
468
469 tech.trigger('bandwidthupdate');
467 }; 470 };
468 471
469 videojs.Hls.prototype.loadSegment = function(segmentUri, offset) { 472 videojs.Hls.prototype.loadSegment = function(segmentUri, offset) {
......