diff --git a/CHANGELOG.md b/CHANGELOG.md index f4ef35748..8db247f94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG ## HEAD (Unreleased) * @DatTran fixed bower paths. Fixes #2740 ([view](https://github.com/videojs/video.js/pull/2775)) * @nbibler ensured classes begin with alpha characters. Fixes #2828 ([view](https://github.com/videojs/video.js/pull/2829)) +* @bcvio fixed returning current source rather than blob url ([view](https://github.com/videojs/video.js/pull/2833)) -------------------- diff --git a/src/js/tech/html5.js b/src/js/tech/html5.js index b91d691a9..114be72fe 100644 --- a/src/js/tech/html5.js +++ b/src/js/tech/html5.js @@ -492,7 +492,13 @@ class Html5 extends Tech { * @return {Object} * @method currentSrc */ - currentSrc() { return this.el_.currentSrc; } + currentSrc() { + if (this.currentSource_) { + return this.currentSource_.src; + } else { + return this.el_.currentSrc; + } + } /** * Get poster diff --git a/test/unit/tech/html5.test.js b/test/unit/tech/html5.test.js index e7e861a66..4059301b2 100644 --- a/test/unit/tech/html5.test.js +++ b/test/unit/tech/html5.test.js @@ -249,6 +249,12 @@ if (Html5.supportsNativeTextTracks()) { equal(adds[2][0], rems[2][0], 'removetrack event handler removed'); }); } +test('should always return currentSource_ if set', function(){ + let currentSrc = Html5.prototype.currentSrc; + equal(currentSrc.call({el_: {currentSrc:'test1'}}), 'test1', 'sould return source from element if nothing else set'); + equal(currentSrc.call({currentSource_:{src: 'test2'}}), 'test2', 'sould return source from currentSource_, if nothing else set'); + equal(currentSrc.call({currentSource_:{src: 'test2'}, el_:{currentSrc:'test1'}}), 'test2', 'sould return source from source set, not from element'); +}); test('should fire makeup events when a video tag is initialized late', function(){ let lateInit = Html5.prototype.handleLateInit_;