1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-25 02:42:10 +02:00

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.
This commit is contained in:
Joe Forbes 2017-11-01 11:12:48 -04:00 committed by Gary Katsevman
parent 9cf98006d5
commit 9acbcd8410
2 changed files with 2 additions and 1 deletions

View File

@ -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 File

@ -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');