1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-28 08:58:46 +02:00

fix: make sure source options are passed through (#5241)

The changes to source caching in #5156 introduced a regression where the source options were no longer available to plugins. This PR makes sure the cached source object retains any source options passed along.
This commit is contained in:
Chuck Wilson 2018-06-11 13:47:36 -04:00 committed by Gary Katsevman
parent 002d7011c5
commit 9504a93643
2 changed files with 15 additions and 1 deletions

View File

@ -1241,7 +1241,7 @@ class Player extends Component {
}
// update `currentSource` cache always
this.cache_.source = {src, type};
this.cache_.source = mergeOptions({}, srcObj, {src, type});
const matchingSources = this.cache_.sources.filter((s) => s.src && s.src === src);
const sourceElSources = [];

View File

@ -1904,3 +1904,17 @@ QUnit.test('disposing a tech that dit NOT set a poster, should keep the poster',
player.dispose();
});
QUnit.test('source options are retained', function(assert) {
const player = TestHelpers.makePlayer();
const source = {
src: 'https://some.url',
type: 'someType',
sourceOption: 'someOption'
};
player.src(source);
assert.equal(player.currentSource().sourceOption, 'someOption', 'source option retained');
});