From 84aa4ab2b9e05373e026c26a6d00ebb776c07cba Mon Sep 17 00:00:00 2001 From: Chuck Wilson Date: Fri, 8 Jun 2018 19:46:43 -0400 Subject: [PATCH] make sure source options are passed through --- src/js/player.js | 2 +- test/unit/player.test.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/js/player.js b/src/js/player.js index 531848922d..a0e6b5d8a4 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -1258,7 +1258,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 = []; diff --git a/test/unit/player.test.js b/test/unit/player.test.js index 614e6fee9d..20372bba82 100644 --- a/test/unit/player.test.js +++ b/test/unit/player.test.js @@ -1907,3 +1907,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'); +});