From 5248d86f9e7e14d2f9bfeef6591034e7c5fc17bc Mon Sep 17 00:00:00 2001 From: Carey Hinoki Date: Fri, 26 Aug 2016 15:41:22 -0700 Subject: [PATCH] @chemoish when the src redefines the current source, with a single source, have the current sources be set to null. When the `currentSources()` are called after `src('http://example.com')`, expect the `currentSources()` to only return the newly set source. This way sources, via `` or `src([...])` list, should never be out of sync when redefining a single source. Updating tests to specify behavior changes. Remove autoplay from fixtures to bypass `loadTech()` ramifications. # Conflicts: # src/js/player.js # test/unit/player.js --- src/js/player.js | 5 ++++- test/unit/player.test.js | 34 ++++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/js/player.js b/src/js/player.js index 2ad507dda7..0ef7d61691 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -619,6 +619,7 @@ class Player extends Component { techOptions.startTime = this.cache_.currentTime; } + this.cache_.sources = null; this.cache_.source = source; this.cache_.src = source.src; } @@ -1977,8 +1978,10 @@ class Player extends Component { // the tech loop to check for a compatible technology this.sourceList_([source]); } else { + this.cache_.sources = null; this.cache_.source = source; this.cache_.src = source.src; + this.currentType_ = source.type || ''; // wait until the tech is ready to set the source @@ -2083,7 +2086,7 @@ class Player extends Component { * @method currentSource */ currentSource() { - return this.cache_.source || {}; + return this.cache_.source || { src: this.currentSrc() }; } /** diff --git a/test/unit/player.test.js b/test/unit/player.test.js index 6013131a19..d64948b286 100644 --- a/test/unit/player.test.js +++ b/test/unit/player.test.js @@ -124,7 +124,7 @@ QUnit.test('should get current source from source tag', function(assert) { const fixture = document.getElementById('qunit-fixture'); const html = [ - '