1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-25 02:42:10 +02:00

@nickygerritsen Pass tech options to source handlers. closes #3245

This commit is contained in:
Nicky Gerritsen 2016-04-13 20:28:09 +02:00
parent 48ec1fb3ee
commit f606f9df50
6 changed files with 18 additions and 14 deletions

View File

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

View File

@ -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);

View File

@ -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);
};

View File

@ -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);
};

View File

@ -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;

View File

@ -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();
}
};
@ -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');
}
};
@ -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;
}
});