fix: Allow get seekRange on manifestparsed event in some cases (#5892)

Fixes https://github.com/shaka-project/shaka-player/issues/5115
This commit is contained in:
Álvaro Velad Galván
2023-11-16 08:08:18 +01:00
committed by GitHub
parent 9d23a87f85
commit 606d693900
+10 -5
View File
@@ -3317,17 +3317,22 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
/**
* Get the range of time (in seconds) that seeking is allowed. If the player
* has not loaded content, this will return a range from 0 to 0.
* has not loaded content and the manifest is HLS, this will return a range
* from 0 to 0.
*
* @return {{start: number, end: number}}
* @export
*/
seekRange() {
if (!this.fullyLoaded_) {
return {'start': 0, 'end': 0};
}
if (this.manifest_) {
// With HLS lazy-loading, there were some situations where the manifest
// had partially loaded, enough to move onto further load stages, but no
// segments had been loaded, so the timeline is still unknown.
// See: https://github.com/shaka-project/shaka-player/pull/4590
if (!this.fullyLoaded_ &&
this.manifest_.type == shaka.media.ManifestParser.HLS) {
return {'start': 0, 'end': 0};
}
const timeline = this.manifest_.presentationTimeline;
return {