1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-28 08:58:46 +02:00

@nickygerritsen use the default seekable when a source handler is unset. closes #2401

This commit is contained in:
Nicky Gerritsen 2015-08-03 13:26:20 -04:00 committed by David LaPalomento
parent cb6465e9d2
commit 1d0ae800b8
2 changed files with 12 additions and 11 deletions

View File

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

View File

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