Skip to content

Commit

Permalink
fix: player.src() should return empty string if no source is set (#4711)
Browse files Browse the repository at this point in the history
player.src() returns undefined for a new player but it should return '' like player.currentSrc() does and as the video element itself does.
  • Loading branch information
forbesjo authored and gkatsev committed Nov 1, 2017
1 parent 9cf9800 commit 9acbcd8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -2285,7 +2285,7 @@ class Player extends Component {
src(source) {
// getter usage
if (typeof source === 'undefined') {
return this.cache_.src;
return this.cache_.src || '';
}
// filter out invalid sources and turn our source into
// an array of source objects
Expand Down
1 change: 1 addition & 0 deletions test/unit/player.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ QUnit.test('should get current source from src set', function(assert) {

// check for matching undefined src
assert.deepEqual(player.currentSource(), {});
assert.equal(player.src(), '');

player.src('http://google.com');

Expand Down

0 comments on commit 9acbcd8

Please sign in to comment.