Skip to content

Commit

Permalink
@nickygerritsen use the default seekable when a source handler is uns…
Browse files Browse the repository at this point in the history
…et. closes #2401
  • Loading branch information
Nicky Gerritsen authored and dmlap committed Aug 3, 2015
1 parent cb6465e commit 1d0ae80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

--------------------

Expand Down
22 changes: 11 additions & 11 deletions src/js/tech/tech.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
};

Expand All @@ -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_;
}
};

Expand Down

0 comments on commit 1d0ae80

Please sign in to comment.