From 1d0ae800b88eb24b4e998d154c7765940bad7163 Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Mon, 3 Aug 2015 13:26:20 -0400 Subject: [PATCH] @nickygerritsen use the default seekable when a source handler is unset. closes #2401 --- CHANGELOG.md | 1 + src/js/tech/tech.js | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de41526e82..f09e44c995 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,7 @@ CHANGELOG * @nickygerritsen scrubbing() is a method, not a property ([view](https://github.com/videojs/video.js/pull/2411)) * @sirlancelot change "video" to "media" in error messages ([view](https://github.com/videojs/video.js/pull/2409)) * @sirlancelot change "video" to "media" in error messages ([view](https://github.com/videojs/video.js/pull/2409)) +* @nickygerritsen use the default seekable when a source handler is unset ([view](https://github.com/videojs/video.js/pull/2401)) -------------------- diff --git a/src/js/tech/tech.js b/src/js/tech/tech.js index ce73cf4659..cf53ecc42e 100644 --- a/src/js/tech/tech.js +++ b/src/js/tech/tech.js @@ -538,6 +538,17 @@ Tech.withSourceHandlers = function(_Tech){ return ''; }; + let originalSeekable = _Tech.prototype.seekable; + + // when a source handler is registered, prefer its implementation of + // seekable when present. + _Tech.prototype.seekable = function() { + if (this.sourceHandler_ && this.sourceHandler_.seekable) { + return this.sourceHandler_.seekable(); + } + return originalSeekable.call(this); + }; + /* * Create a function for setting the source using a source object * and source handlers. @@ -566,16 +577,6 @@ Tech.withSourceHandlers = function(_Tech){ this.sourceHandler_ = sh.handleSource(source, this); this.on('dispose', this.disposeSourceHandler); - this.originalSeekable_ = this.seekable; - // when a source handler is registered, prefer its implementation of - // seekable when present. - this.seekable = function() { - if (this.sourceHandler_ && this.sourceHandler_.seekable) { - return this.sourceHandler_.seekable(); - } - return this.originalSeekable_.call(this); - }; - return this; }; @@ -585,7 +586,6 @@ Tech.withSourceHandlers = function(_Tech){ _Tech.prototype.disposeSourceHandler = function(){ if (this.sourceHandler_ && this.sourceHandler_.dispose) { this.sourceHandler_.dispose(); - this.seekable = this.originalSeekable_; } };