Skip to content

Commit

Permalink
@nickygerritsen Pass tech options to source handlers. closes #3245
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicky Gerritsen committed Apr 13, 2016
1 parent 48ec1fb commit f606f9d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CHANGELOG
=========

## HEAD (Unreleased)
_(none)_
* @nickygerritsen Pass tech options to source handlers ([view](https://github.com/videojs/video.js/pull/3245))

--------------------

Expand Down
7 changes: 4 additions & 3 deletions src/js/tech/flash-rtmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ function FlashRtmpDecorator(Flash) {
* Pass the source to the flash object
* Adaptive source handlers will have more complicated workflows before passing
* video data to the video element
* @param {Object} source The source object
* @param {Flash} tech The instance of the Flash tech
* @param {Object} source The source object
* @param {Flash} tech The instance of the Flash tech
* @param {Object} options The options to pass to the source
*/
Flash.rtmpSourceHandler.handleSource = function(source, tech){
Flash.rtmpSourceHandler.handleSource = function(source, tech, options){
let srcParts = Flash.streamToParts(source.src);

tech['setRtmpConnection'](srcParts.connection);
Expand Down
7 changes: 4 additions & 3 deletions src/js/tech/flash.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,11 @@ Flash.nativeSourceHandler.canHandleSource = function(source){
* Adaptive source handlers will have more complicated workflows before passing
* video data to the video element
*
* @param {Object} source The source object
* @param {Flash} tech The instance of the Flash tech
* @param {Object} source The source object
* @param {Flash} tech The instance of the Flash tech
* @param {Object} options The options to pass to the source
*/
Flash.nativeSourceHandler.handleSource = function(source, tech){
Flash.nativeSourceHandler.handleSource = function(source, tech, options){
tech.setSrc(source.src);
};

Expand Down
7 changes: 4 additions & 3 deletions src/js/tech/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -903,10 +903,11 @@ Html5.nativeSourceHandler.canHandleSource = function(source){
* Adaptive source handlers will have more complicated workflows before passing
* video data to the video element
*
* @param {Object} source The source object
* @param {Html5} tech The instance of the Html5 tech
* @param {Object} source The source object
* @param {Html5} tech The instance of the Html5 tech
* @param {Object} options The options to pass to the source
*/
Html5.nativeSourceHandler.handleSource = function(source, tech){
Html5.nativeSourceHandler.handleSource = function(source, tech, options){
tech.setSrc(source.src);
};

Expand Down
2 changes: 1 addition & 1 deletion src/js/tech/tech.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ Tech.withSourceHandlers = function(_Tech){
this.off('dispose', this.disposeSourceHandler);

this.currentSource_ = source;
this.sourceHandler_ = sh.handleSource(source, this);
this.sourceHandler_ = sh.handleSource(source, this, this.options_);
this.on('dispose', this.disposeSourceHandler);

return this;
Expand Down
7 changes: 4 additions & 3 deletions test/unit/tech/tech.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,10 @@ test('should add the source handler interface to a tech', function(){
}
return '';
},
handleSource: function(s, t){
handleSource: function(s, t, o){
strictEqual(tech, t, 'the tech instance was passed to the source handler');
strictEqual(sourceA, s, 'the tech instance was passed to the source handler');
strictEqual(tech.options_, o, 'the tech options were passed to the source handler');
return new handlerInternalState();
}
};
Expand All @@ -161,7 +162,7 @@ test('should add the source handler interface to a tech', function(){
canHandleSource: function(source){
return ''; // no support
},
handleSource: function(source, tech){
handleSource: function(source, tech, options){
ok(false, 'handlerTwo supports nothing and should never be called');
}
};
Expand Down Expand Up @@ -261,7 +262,7 @@ test('delegates seekable to the source handler', function(){
canHandleSource: function() {
return true;
},
handleSource: function(source, tech) {
handleSource: function(source, tech, options) {
return handler;
}
});
Expand Down

0 comments on commit f606f9d

Please sign in to comment.