1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-13 10:32:26 +02:00

Merge branch 'stable'

This commit is contained in:
Gary Katsevman 2016-05-27 18:28:40 -04:00
commit b9e3e55384
5 changed files with 85 additions and 2 deletions

View File

@ -14,6 +14,9 @@ CHANGELOG
--------------------
## 5.10.3 (2016-05-27)
* @BrandonOCasey fixed source handlers being disposed multiple times when a video is put into the video element directly ([view](https://github.com/videojs/video.js/pull/3343))
## 5.10.2 (2016-05-12)
* @gkatsev nulled out currentSource_ in setSource ([view](https://github.com/videojs/video.js/pull/3314))

View File

@ -1,7 +1,7 @@
{
"name": "video.js",
"description": "An HTML5 and Flash video player with a common API and skin for both.",
"version": "5.10.2",
"version": "5.10.3",
"keywords": [
"videojs",
"html5",

View File

@ -1,7 +1,7 @@
{
"name": "video.js",
"description": "An HTML5 and Flash video player with a common API and skin for both.",
"version": "5.10.2",
"version": "5.10.3",
"copyright": "Copyright Brightcove, Inc. <https://www.brightcove.com/>",
"license": "Apache-2.0",
"keywords": [

View File

@ -857,6 +857,7 @@ Tech.withSourceHandlers = function(_Tech){
this.off(this.el_, 'loadstart', _Tech.prototype.firstLoadStartListener_);
this.off(this.el_, 'loadstart', _Tech.prototype.successiveLoadStartListener_);
this.sourceHandler_.dispose();
this.sourceHandler_ = null;
}
};

View File

@ -414,3 +414,82 @@ test('Tech#setSource clears currentSource_ after repeated loadstart', function()
equal(tech.currentSource_, null, 'Current source is still null');
});
test('setSource after tech dispose should dispose source handler once', function(){
let MyTech = extendFn(Tech);
Tech.withSourceHandlers(MyTech);
let disposeCount = 0;
let handler = {
dispose() {
disposeCount++;
}
};
MyTech.registerSourceHandler({
canPlayType: function() {
return true;
},
canHandleSource: function() {
return true;
},
handleSource: function(source, tech, options) {
return handler;
}
});
let tech = new MyTech();
tech.setSource('test');
equal(disposeCount, 0, 'did not call sourceHandler_ dispose for initial dispose');
tech.dispose();
ok(!tech.sourceHandler_, 'sourceHandler should be unset');
equal(disposeCount, 1, 'called the source handler dispose');
// this would normally be done above tech on src after dispose
tech.el_ = tech.createEl();
tech.setSource('test');
equal(disposeCount, 1, 'did not dispose after initial setSource');
tech.setSource('test');
equal(disposeCount, 2, 'did dispose on second setSource');
});
test('setSource after previous setSource should dispose source handler once', function(){
let MyTech = extendFn(Tech);
Tech.withSourceHandlers(MyTech);
let disposeCount = 0;
let handler = {
dispose() {
disposeCount++;
}
};
MyTech.registerSourceHandler({
canPlayType: function() {
return true;
},
canHandleSource: function() {
return true;
},
handleSource: function(source, tech, options) {
return handler;
}
});
let tech = new MyTech();
tech.setSource('test');
equal(disposeCount, 0, 'did not call dispose for initial setSource');
tech.setSource('test');
equal(disposeCount, 1, 'did dispose for second setSource');
tech.setSource('test');
equal(disposeCount, 2, 'did dispose for third setSource');
});