Constructor
new SegmentPrefetch(prefetchLimit, stream, fetchDispatcher)
This class manages segment prefetch operations. Called by StreamingEngine to prefetch next N segments ahead of playhead, to reduce the chances of rebuffering.
Parameters:
Name | Type | Description |
---|---|---|
prefetchLimit |
number | |
stream |
shaka.extern.Stream | |
fetchDispatcher |
shaka.media.SegmentPrefetch.FetchDispatcher |
- Source:
Members
segmentPrefetchMap_ :Map.<shaka.media.SegmentReference, !shaka.media.SegmentPrefetchOperation>
Type:
- Source:
Methods
logPrefix_() → {string}
The prefix of the logs that are created in this class.
- Source:
Returns:
- Type
- string
abortPrefetchedSegment_(reference)
Remove a segment from prefetch map and abort it.
Parameters:
Name | Type | Description |
---|---|---|
reference |
shaka.media.SegmentReference |
- Source:
getPrefetchedSegment(reference, streamDataCallbacknullable) → {shaka.net.NetworkingEngine.PendingRequest}
Get the result of prefetched segment if already exists.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
reference |
shaka.media.SegmentReference | ||
streamDataCallback |
?function(BufferSource):!Promise= |
<nullable> |
- Source:
Returns:
op
prefetchSegments(startReference)
Fetch next segments ahead of current segment.
Parameters:
Name | Type | Description |
---|---|---|
startReference |
shaka.media.SegmentReference |
- Source:
resetLimit(newPrefetchLimit)
Reset the prefetchLimit and clear all internal states.
Called by StreamingEngine when configure() was called.
Parameters:
Name | Type | Description |
---|---|---|
newPrefetchLimit |
number |
- Source:
switchStream(stream)
Called by Streaming Engine when switching variant.
Parameters:
Name | Type | Description |
---|---|---|
stream |
shaka.extern.Stream |
- Source:
Type Definitions
FetchDispatcher
A callback function that fetches a segment.
Type:
- function(!(shaka.media.InitSegmentReference|shaka.media.SegmentReference), shaka.extern.Stream, ?function(BufferSource): !Promise=): !shaka.net.NetworkingEngine.PendingRequest
- Source: