Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass tech options to source handlers #3245

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant.

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