Permalink
Browse files

fix: player.src() should return empty string if no source is set (#4711)

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 9acbcd84100d868855f3a645dc68045bd087b5f1
Showing with 2 additions and 1 deletion.
  1. +1 −1 src/js/player.js
  2. +1 −0 test/unit/player.test.js
View
@@ -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
View
@@ -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');

0 comments on commit 9acbcd8

Please sign in to comment.