mirror of
https://github.com/videojs/video.js.git
synced 2024-11-24 08:42:25 +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:
parent
002d7011c5
commit
9504a93643
@ -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 = [];
|
||||
|
@ -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');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user