Members
(constant) comparePlaylistBandwidth
A comparator function to sort two playlist object by bandwidth.
- Source:
(constant) comparePlaylistResolution
A comparator function to sort two playlist object by resolution (width).
- Source:
(constant) duration
Calculates the duration of a playlist. If a start and end index
are specified, the duration will be for the subset of the media
timeline between those two indices. The total duration for live
playlists is always Infinity.
- Source:
(constant) getMediaInfoForTime
Determine the index and estimated starting time of the segment that
contains a specified playback position in a media playlist.
- Source:
(constant) isAes
Returns whether the current playlist is an AES encrypted HLS stream
- Source:
(constant) isFmp4
Returns whether the current playlist contains fMP4
- Source:
(constant) lastBandwidthSelector
Chooses the appropriate media playlist based on the most recent
bandwidth estimate and the player size.
Expects to be called within the context of an instance of HlsHandler
- Source:
(constant) lowestBitrateCompatibleVariantSelector
Chooses the appropriate media playlist, which in this case is the lowest bitrate
one with video. If no renditions with video exist, return the lowest audio rendition.
Expects to be called within the context of an instance of HlsHandler
- Source:
(constant) mediaSegmentRequest
Load all resources and does any processing necessary for a media-segment
Features:
decrypts the media-segment if it has a key uri and an iv
aborts *all* requests if *any* one request fails
The segment object, at minimum, has the following format:
{
resolvedUri: String,
[byterange]: {
offset: Number,
length: Number
},
[key]: {
resolvedUri: String
[byterange]: {
offset: Number,
length: Number
},
iv: {
bytes: Uint32Array
}
},
[map]: {
resolvedUri: String,
[byterange]: {
offset: Number,
length: Number
},
[bytes]: Uint8Array
}
}
...where [name] denotes optional properties
- Source:
(constant) minRebufferMaxBandwidthSelector
Chooses the appropriate media playlist based on the potential to rebuffer
- Source:
(constant) movingAverageBandwidthSelector
Chooses the appropriate media playlist based on an
exponential-weighted moving average of the bandwidth after
filtering for player size.
Expects to be called within the context of an instance of HlsHandler
- Source:
- See:
(constant) parseCodecs
Parses a codec string to retrieve the number of codecs specified,
the video codec and object type indicator, and the audio profile.
- Source:
(constant) refreshDelay
Calculates the time to wait before refreshing a live playlist
- Source:
(constant) safeBackBufferTrimTime
Calculates a time value that is safe to remove from the back buffer without interupting
playback.
- Source:
(constant) seekable
Calculates the interval of time that is currently seekable in a
playlist. The returned time ranges are relative to the earliest
moment in the specified playlist that is still available. A full
seekable implementation for live streams would need to offset
these values by the duration of content that has expired from the
stream.
- Source:
(constant) simpleSelector
Chooses the appropriate media playlist based on bandwidth and player size
- Source:
(constant) sumDurations
Calculate the time between two indexes in the current playlist
neight the start- nor the end-index need to be within the current
playlist in which case, the targetDuration of the playlist is used
to approximate the durations of the segments
- Source:
systemBandwidth
`systemBandwidth` is a combination of two serial processes bit-rates. The first
is the network bitrate provided by `bandwidth` and the second is the bitrate of
the entire process after that - decryption, transmuxing, and appending - provided
by `throughput`.
Since the two process are serial, the overall system bandwidth is given by:
sysBandwidth = 1 / (1 / bandwidth + 1 / throughput)
- Source:
(constant) updateMaster
Returns a new master playlist that is the result of merging an
updated media playlist into the original version. If the
updated media playlist does not match any of the playlist
entries in the original master playlist, null is returned.
- Source:
(constant) updateSegments
Returns a new array of segments that is the result of merging
properties from an older list of segments onto an updated
list. No properties on the updated playlist will be overridden.
- Source:
(constant) utils
utils to help dump binary data to the console
- Source:
Methods
abort()
abort anything that is currently doing on with the SegmentLoader
and reset to a default state
- Source:
abort(done)
Aborts the current segment and resets the segment parser.
Parameters:
Name | Type | Description |
---|---|---|
done |
function | function to call when done |
- Source:
- See:
abortAll(activeXhrs)
Abort all requests
Parameters:
Name | Type | Description |
---|---|---|
activeXhrs |
Object | an object that tracks all XHR requests |
- Source:
activeGroup(type, settings) → {function}
Returns a function used to get the active group of the provided type
Parameters:
Name | Type | Description |
---|---|---|
type |
String | MediaGroup type |
settings |
Object | Object containing required information for media groups |
- Source:
Returns:
Function that returns the active media group for the provided type. Takes an
optional parameter {TextTrack} track. If no track is provided, a list of all
variants in the group, otherwise the variant corresponding to the provided
track is returned.
- Type
- function
appendBuffer(bytes, done)
Queue an update to append an ArrayBuffer.
Parameters:
Name | Type | Description |
---|---|---|
bytes |
ArrayBuffer | |
done |
function | the function to call when done |
- Source:
- See:
backwardDuration(playlist, endSequence)
walk backward until we find a duration we can use
or return a failure
Parameters:
Name | Type | Description |
---|---|---|
playlist |
Playlist | the playlist to walk through |
endSequence |
Number | the mediaSequence to stop walking on |
- Source:
buffered()
Indicates what TimeRanges are buffered in the managed SourceBuffer.
- Source:
- See:
buffered_() → {TimeRange}
Indicates which time ranges are buffered
- Source:
Returns:
TimeRange object representing the current buffered ranges
- Type
- TimeRange
buffered_() → {TimeRange}
Indicates which time ranges are buffered
- Source:
Returns:
TimeRange object representing the current buffered ranges
- Type
- TimeRange
bufferIntersection(bufferA, bufferB) → {TimeRanges}
Calculate the intersection of two TimeRanges
Parameters:
Name | Type | Description |
---|---|---|
bufferA |
TimeRanges | |
bufferB |
TimeRanges |
Returns:
The interesection of `bufferA` with `bufferB`
- Type
- TimeRanges
byterangeStr(byterange)
Turns segment byterange into a string suitable for use in
HTTP Range requests
Parameters:
Name | Type | Description |
---|---|---|
byterange |
Object | an object with two values defining the start and end of a byte-range |
- Source:
calculateBufferedPercent(segmentRange, referenceRange, currentTime, buffered) → {Number}
Calculates the percentage of `segmentRange` that overlaps the
`buffered` time ranges.
Parameters:
Name | Type | Description |
---|---|---|
segmentRange |
TimeRanges | the time range that the segment covers adjusted according to currentTime |
referenceRange |
TimeRanges | the original time range that the segment covers |
currentTime |
Number | time in seconds where the current playback is at |
buffered |
TimeRanges | the currently buffered time ranges |
Returns:
percent of the segment currently buffered
- Type
- Number
checkBuffer_(buffered, playlist, mediaIndex, hasPlayed, currentTime, syncPoint) → {Object}
Determines what segment request should be made, given current playback
state.
Parameters:
Name | Type | Description |
---|---|---|
buffered |
TimeRanges | the state of the buffer |
playlist |
Object | the playlist object to fetch segments from |
mediaIndex |
Number | the previous mediaIndex fetched or null |
hasPlayed |
Boolean | a flag indicating whether we have played or not |
currentTime |
Number | the playback position in seconds |
syncPoint |
Object | a segment info object that describes the |
- Source:
Returns:
a segment request object that describes the segment to load
- Type
- Object
clamp(num, start, end) → {Number}
Clamps a value to within a range
Parameters:
Name | Type | Description |
---|---|---|
num |
Number | the value to clamp |
start |
Number | the start of the range to clamp within, inclusive |
end |
Number | the end of the range to clamp within, inclusive |
Returns:
- Type
- Number
createMediaTypes() → {Object}
Creates skeleton object used to store the loaders, tracks, and utility methods for each
media type
- Source:
Returns:
Object to store the loaders, tracks, and utility methods for each media type
- Type
- Object
createTransferableMessage(message) → {Object}
Creates an object for sending to a web worker modifying properties that are TypedArrays
into a new object with seperated properties for the buffer, byteOffset, and byteLength.
Parameters:
Name | Type | Description |
---|---|---|
message |
Object | Object of properties and values to send to the web worker |
- Source:
Returns:
Modified message with TypedArray values expanded
- Type
- Object
DecrypterWorker(self)
Our web worker interface so that things can talk to aes-decrypter
that will be running in a web worker. the scope is passed to this by
webworkify.
Parameters:
Name | Type | Description |
---|---|---|
self |
Object | the scope for the web worker |
- Source:
decryptSegment(decrypter, segment, doneFn)
Decrypt the segment via the decryption web worker
Parameters:
Name | Type | Description |
---|---|---|
decrypter |
WebWorker | a WebWorker interface to AES-128 decryption routines |
segment |
Object | a simplified copy of the segmentInfo object from SegmentLoader |
doneFn |
function | a callback that is executed after decryption has completed |
- Source:
detectEndOfStream(playlist, mediaSource, segmentIndex) → {Boolean}
Determines if we should call endOfStream on the media source based
on the state of the buffer or if appened segment was the final
segment in the playlist.
Parameters:
Name | Type | Description |
---|---|---|
playlist |
Object | a media playlist object |
mediaSource |
Object | the MediaSource object |
segmentIndex |
Number | the index of segment we last appended |
- Source:
Returns:
do we need to call endOfStream on the MediaSource
- Type
- Boolean
dispose()
dispose of the source updater and the underlying sourceBuffer
- Source:
dispose()
dispose of the SegmentLoader and reset to the default state
- Source:
dispose()
Abort any outstanding work and clean up.
- Source:
enableFunction(loader, playlistUri, changePlaylistFn, enableopt) → {function}
Returns a function that acts as the Enable/disable playlist function.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
loader |
PlaylistLoader | The master playlist loader | |
playlistUri |
String | uri of the playlist | |
changePlaylistFn |
function | A function to be called after a playlist's enabled-state has been changed. Will NOT be called if a playlist's enabled-state is unchanged | |
enable |
Boolean |
<optional> |
Value to set the playlist enabled-state to or if undefined returns the current enabled-state for the playlist |
- Source:
Returns:
Function for setting/getting enabled
- Type
- function
error(error) → {Error}
set an error on the segment loader and null out any pending segements
Parameters:
Name | Type | Description |
---|---|---|
error |
Error | the error to set on the SegmentLoader |
- Source:
Returns:
the error that was set or that is currently set
- Type
- Error
estimateSegmentRequestTime(segmentDuration, bandwidth, playlist, bytesReceivedopt) → {Number|NaN}
Estimates the time required to complete a segment download from the specified playlist
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
segmentDuration |
Number | Duration of requested segment | |
bandwidth |
Number | Current measured bandwidth of the player | |
playlist |
Object | The media playlist object | |
bytesReceived |
Number |
<optional> |
Number of bytes already received for the request. Defaults to 0 |
- Source:
Returns:
The estimated time to request the segment. NaN if bandwidth information for
the given playlist is unavailable
- Type
- Number | NaN
findAdCue()
Searches for an ad cue that overlaps with the given mediaTime
- Source:
findGaps(buffered) → {TimeRanges}
Returns gaps within a list of TimeRanges
Parameters:
Name | Type | Description |
---|---|---|
buffered |
TimeRanges | the TimeRanges object |
Returns:
a TimeRanges object of gaps
- Type
- TimeRanges
findNextRange(timeRanges, time) → {TimeRanges}
Returns the TimeRanges that begin later than the specified time.
Parameters:
Name | Type | Description |
---|---|---|
timeRanges |
TimeRanges | the TimeRanges object to query |
time |
number | the time to filter on. |
Returns:
a new TimeRanges object.
- Type
- TimeRanges
findRange(buffered, time) → {TimeRanges}
Attempts to find the buffered TimeRange that contains the specified
time.
Parameters:
Name | Type | Description |
---|---|---|
buffered |
TimeRanges | the TimeRanges object to query |
time |
number | the time to filter on. |
Returns:
a new TimeRanges object
- Type
- TimeRanges
findSoleUncommonTimeRangesEnd(original, update) → {Number|null}
Search for a likely end time for the segment that was just appened
based on the state of the `buffered` property before and after the
append. If we fin only one such uncommon end-point return it.
Parameters:
Name | Type | Description |
---|---|---|
original |
TimeRanges | the buffered time ranges before the update |
update |
TimeRanges | the buffered time ranges after the update |
Returns:
the end time added between `original` and `update`,
or null if one cannot be unambiguously determined.
- Type
- Number | null
formatHexString(e, i)
format a number as hex string
Parameters:
Name | Type | Description |
---|---|---|
e |
Number | The number |
i |
Number | the iterator |
- Source:
forwardDuration(playlist, endSequence)
walk forward until we find a duration we can use
or return a failure
Parameters:
Name | Type | Description |
---|---|---|
playlist |
Playlist | the playlist to walk through |
endSequence |
Number | the mediaSequence to stop walking on |
- Source:
getCodecs(media) → {Object}
Returns a set of codec strings parsed from the playlist or the default
codec strings if no codecs were specified in the playlist
Parameters:
Name | Type | Description |
---|---|---|
media |
Playlist | the current media playlist |
- Source:
Returns:
an object with the video and audio codecs
- Type
- Object
getContainerType(media) → {String}
Returns the type container based on information in the playlist
Parameters:
Name | Type | Description |
---|---|---|
media |
Playlist | the current media playlist |
- Source:
Returns:
a valid media container type
- Type
- String
getExpiredTime(playlist, duration) → {Number|null}
Calculate the amount of time that has expired off the playlist during playback
Parameters:
Name | Type | Description |
---|---|---|
playlist |
Playlist | Playlist object to calculate expired from |
duration |
Number | Duration of the MediaSource (Infinity if playling a live source) |
- Source:
Returns:
The amount of time that has expired off the playlist during playback. Null
if no sync-points for the playlist can be found.
- Type
- Number | null
getMostImportantError()
The purpose of this function is to get the most pertinent error from the
array of errors.
For instance if a timeout and two aborts occur, then the aborts were
likely triggered by the timeout so return that error object.
- Source:
getProgressStats(progressEvent)
If possible gather bandwidth stats as a request is in
progress
Parameters:
Name | Type | Description |
---|---|---|
progressEvent |
Event | an event object from an XHR's progress event |
- Source:
getRequestStats(request)
Gather important bandwidth stats once a request has completed
Parameters:
Name | Type | Description |
---|---|---|
request |
Object | the XHR request from which to gather stats |
- Source:
getSegmentBufferedPercent(startOfSegment, segmentDuration, currentTime, buffered) → {Number}
Return the amount of a range specified by the startOfSegment and segmentDuration
overlaps the current buffered content.
Parameters:
Name | Type | Description |
---|---|---|
startOfSegment |
Number | the time where the segment begins |
segmentDuration |
Number | the duration of the segment in seconds |
currentTime |
Number | time in seconds where the current playback is at |
buffered |
TimeRanges | the state of the buffer |
Returns:
percentage of the segment's time range that is
already in `buffered`
- Type
- Number
getSyncPoint(playlist, duration, currentTimeline) → {Object}
Find a sync-point for the playlist specified
A sync-point is defined as a known mapping from display-time to
a segment-index in the current playlist.
Parameters:
Name | Type | Description |
---|---|---|
playlist |
Playlist | The playlist that needs a sync-point |
duration |
Number | Duration of the MediaSource (Infinite if playing a live source) |
currentTimeline |
Number | The last timeline from which a segment was loaded |
- Source:
Returns:
A sync-point object
- Type
- Object
getSyncSegmentCandidate_(playlist) → {Number}
The segment loader has no recourse except to fetch a segment in the
current playlist and use the internal timestamps in that segment to
generate a syncPoint. This function returns a good candidate index
for that process.
Parameters:
Name | Type | Description |
---|---|---|
playlist |
Object | the playlist object to look for a |
- Source:
Returns:
An index of a segment from the playlist to load
- Type
- Number
handleErrors(error, request)
Handle all error conditions in one place and return an object
with all the information
Parameters:
Name | Type | Description |
---|---|---|
error |
Error | null | if non-null signals an error occured with the XHR |
request |
Object | the XHR request that possibly generated the error |
- Source:
handleHlsLoadedMetadata(qualityLevels, hls)
Adds quality levels to list once playlist metadata is available
Parameters:
Name | Type | Description |
---|---|---|
qualityLevels |
QualityLevelList | The QualityLevelList to attach events to. |
hls |
Object | Hls object to listen to for media events. |
- Source:
handleHlsMediaChange(qualityLevels, playlistLoader)
Updates the selectedIndex of the QualityLevelList when a mediachange happens in hls.
Parameters:
Name | Type | Description |
---|---|---|
qualityLevels |
QualityLevelList | The QualityLevelList to update. |
playlistLoader |
PlaylistLoader | PlaylistLoader containing the new media info. |
- Source:
handleInitSegmentResponse(segment, finishProcessingFn)
Handle init-segment responses
Parameters:
Name | Type | Description |
---|---|---|
segment |
Object | a simplified copy of the segmentInfo object from SegmentLoader |
finishProcessingFn |
function | a callback to execute to continue processing this request |
- Source:
handleKeyResponse(segment, finishProcessingFn)
Handle responses for key data and convert the key data to the correct format
for the decryption step later
Parameters:
Name | Type | Description |
---|---|---|
segment |
Object | a simplified copy of the segmentInfo object from SegmentLoader |
finishProcessingFn |
function | a callback to execute to continue processing this request |
- Source:
handleProgress(segment, progressFn, event)
Simple progress event callback handler that gathers some stats before
executing a provided callback with the `segment` object
Parameters:
Name | Type | Description |
---|---|---|
segment |
Object | a simplified copy of the segmentInfo object from SegmentLoader |
progressFn |
function | a callback that is executed each time a progress event is received |
event |
Event | the progress event object from XMLHttpRequest |
- Source:
handleSegmentResponse(segment, finishProcessingFn)
Response handler for segment-requests being sure to set the correct
property depending on whether the segment is encryped or not
Also records and keeps track of stats that are used for ABR purposes
Parameters:
Name | Type | Description |
---|---|---|
segment |
Object | a simplified copy of the segmentInfo object from SegmentLoader |
finishProcessingFn |
function | a callback to execute to continue processing this request |
- Source:
hasAttribute(attr, playlist) → {Boolean}
Checks if the playlist has a value for the specified attribute
Parameters:
Name | Type | Description |
---|---|---|
attr |
String | Attribute to check for |
playlist |
Object | The media playlist object |
- Source:
Returns:
Whether the playlist contains a value for the attribute or not
- Type
- Boolean
HlsSourceHandler()
The Source Handler object, which informs video.js what additional
MIME types are supported and sets up playback. It is registered
automatically to the appropriate tech based on the capabilities of
the browser it is running in. It is not necessary to use or modify
this object in normal usage.
- Source:
initSegment(map, setopt) → {Object}
Gets and sets init segment for the provided map
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
map |
Object | The map object representing the init segment to get or set | ||
set |
Boolean |
<optional> |
false | If true, the init segment for the provided map should be saved |
- Source:
Returns:
map object for desired init segment
- Type
- Object
initSegment(map, setopt) → {Object}
Gets and sets init segment for the provided map
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
map |
Object | The map object representing the init segment to get or set | ||
set |
Boolean |
<optional> |
false | If true, the init segment for the provided map should be saved |
- Source:
Returns:
map object for desired init segment
- Type
- Object
initSegmentId()
Returns a unique string identifier for a media initialization
segment.
- Source:
intervalDuration(playlist, endSequenceopt, expired) → {Number}
Calculate the media duration from the segments associated with a
playlist. The duration of a subinterval of the available segments
may be calculated by specifying an end index.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
playlist |
Object | a media playlist object | |
endSequence |
Number |
<optional> |
an exclusive upper boundary for the playlist. Defaults to playlist length. |
expired |
Number | the amount of time that has dropped off the front of the playlist in a live scenario |
- Source:
Returns:
the duration between the first available segment
and end index.
- Type
- Number
isBlacklisted(playlist) → {boolean}
Check whether the playlist is blacklisted or not.
Parameters:
Name | Type | Description |
---|---|---|
playlist |
Object | the media playlist object |
- Source:
Returns:
whether the playlist is blacklisted or not
- Type
- boolean
isDisabled(playlist) → {boolean}
Check whether the playlist has been manually disabled through the representations api.
Parameters:
Name | Type | Description |
---|---|---|
playlist |
Object | the media playlist object |
- Source:
Returns:
whether the playlist is disabled manually or not
- Type
- boolean
isEnabled(playlist) → {boolean}
Check whether the playlist is enabled or not.
Parameters:
Name | Type | Description |
---|---|---|
playlist |
Object | the media playlist object |
- Source:
Returns:
whether the playlist is enabled or not
- Type
- boolean
isIncompatible(playlist) → {boolean}
Check whether the playlist is compatible with current playback configuration or has
been blacklisted permanently for being incompatible.
Parameters:
Name | Type | Description |
---|---|---|
playlist |
Object | the media playlist object |
- Source:
Returns:
whether the playlist is incompatible or not
- Type
- boolean
load()
start loading of the playlist
- Source:
load()
load a playlist and start to fill the buffer
- Source:
makeMimeTypeString(type, container, codecs) → {String}
Build a media mime-type string from a set of parameters
Parameters:
Name | Type | Description |
---|---|---|
type |
String | either 'audio' or 'video' |
container |
String | either 'mp2t' or 'mp4' |
codecs |
Array | an array of codec strings to add |
- Source:
Returns:
a valid media mime-type
- Type
- String
media(playlistopt) → {Playlist}
When called without any arguments, returns the currently
active media playlist. When called with a single argument,
triggers the playlist loader to asynchronously switch to the
specified media playlist. Calling this method while the
loader is in the HAVE_NOTHING causes an error to be emitted
but otherwise has no effect.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
playlist |
Object |
<optional> |
the parsed media playlist object to switch to |
- Source:
Returns:
the current loaded media
- Type
- Playlist
mimeType(mimeType)
create/set the following mimetype on the SourceBuffer through a
SourceUpdater
Parameters:
Name | Type | Description |
---|---|---|
mimeType |
String | the mime type string to use |
- Source:
onGroupChanged(type, settings) → {function}
Returns a function to be called when the media group changes. It performs a
non-destructive (preserve the buffer) resync of the SegmentLoader. This is because a
change of group is merely a rendition switch of the same content at another encoding,
rather than a change of content, such as switching audio from English to Spanish.
Parameters:
Name | Type | Description |
---|---|---|
type |
String | MediaGroup type |
settings |
Object | Object containing required information for media groups |
- Source:
Returns:
Handler for a non-destructive resync of SegmentLoader when the active media
group changes.
- Type
- function
onTrackChanged(type, settings) → {function}
Returns a function to be called when the media track changes. It performs a
destructive reset of the SegmentLoader to ensure we start loading as close to
currentTime as possible.
Parameters:
Name | Type | Description |
---|---|---|
type |
String | MediaGroup type |
settings |
Object | Object containing required information for media groups |
- Source:
Returns:
Handler for a destructive reset of SegmentLoader when the active media
track changes.
- Type
- function
pause()
pause loading of the playlist
- Source:
pause()
Prevent the loader from fetching additional segments. If there
is a segment request outstanding, it will finish processing
before the loader halts. A segment loader can be unpaused by
calling load().
- Source:
paused()
Returns whether the segment loader is fetching additional
segments when given the opportunity. This property can be
modified through calls to pause() and load().
- Source:
playlist(media)
set a playlist on the segment loader
Parameters:
Name | Type | Description |
---|---|---|
media |
PlaylistLoader | the playlist to set on the segment loader |
- Source:
playlistEnd(playlist, expiredopt, useSafeLiveEnd) → {Number}
Calculates the playlist end time
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
playlist |
Object | a media playlist object | |
expired |
Number |
<optional> |
the amount of time that has dropped off the front of the playlist in a live scenario |
useSafeLiveEnd |
Boolean | false | a boolean value indicating whether or not the playlist end calculation should consider the safe live end (truncate the playlist end by three segments). This is normally used for calculating the end of the playlist's seekable range. |
- Source:
Returns:
the end time of playlist
- Type
- Number
printableRange(range) → {String}
Gets a human readable string for a TimeRange
Parameters:
Name | Type | Description |
---|---|---|
range |
TimeRange |
Returns:
a human readable string
- Type
- String
probeSegmentInfo(segmentInfo)
Probe or inspect a fmp4 or an mpeg2-ts segment to determine the start
and end of the segment in it's internal "media time". Used to generate
mappings from that internal "media time" to the display time that is
shown on the player.
Parameters:
Name | Type | Description |
---|---|---|
segmentInfo |
SegmentInfo | The current active request information |
- Source:
queueCallback_()
Queue a callback to run
- Source:
reloadSourceOnError(optionsopt)
Reload the source when an error is detected as long as there
wasn't an error previously within the last 30 seconds
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object |
<optional> |
an object with plugin options |
- Source:
remove(start, end)
Remove any data in the source buffer between start and end times
Parameters:
Name | Type | Description |
---|---|---|
start |
Number | the start time of the region to remove from the buffer |
end |
Number | the end time of the region to remove from the buffer |
- Source:
remove(start, end)
Remove any data in the source buffer between start and end times
Parameters:
Name | Type | Description |
---|---|---|
start |
Number | the start time of the region to remove from the buffer |
end |
Number | the end time of the region to remove from the buffer |
- Source:
remove(start, end)
Queue an update to remove a time range from the buffer.
Parameters:
Name | Type | Description |
---|---|---|
start |
Number | where to start the removal |
end |
Number | where to end the removal |
- Source:
- See:
renditionSelectionMixin(hlsHandler)
A mixin function that adds the `representations` api to an instance
of the HlsHandler class
Parameters:
Name | Type | Description |
---|---|---|
hlsHandler |
HlsHandler | An instance of HlsHandler to add the representation API into |
- Source:
reset()
Reset the state of the inspection cache when we do a rendition
switch
- Source:
resetEverything()
Delete all the buffered data and reset the SegmentLoader
- Source:
resetLoader()
Force the SegmentLoader to resync and start loading around the currentTime instead
of starting at the end of the buffer
Useful for fast quality changes
- Source:
resyncLoader()
Force the SegmentLoader to restart synchronization and make a conservative guess
before returning to the simple walk-forward method
- Source:
runCallback_()
Run a queued callback
- Source:
safeGetComputedStyle(el, the)
Returns the CSS value for the specified property on an element
using `getComputedStyle`. Firefox has a long-standing issue where
getComputedStyle() may return null when running in an iframe with
`display: none`.
Parameters:
Name | Type | Description |
---|---|---|
el |
HTMLElement | the htmlelement to work on |
the |
string | proprety to get the style for |
safeLiveIndex(playlist) → {Number}
Determines the media index of the segment corresponding to the safe edge of the live
window which is the duration of the last segment plus 2 target durations from the end
of the playlist.
Parameters:
Name | Type | Description |
---|---|---|
playlist |
Object | a media playlist object |
- Source:
Returns:
The media index of the segment at the safe live point. 0 if there is no "safe"
point.
- Type
- Number
saveExpiredSegmentInfo(oldPlaylist, newPlaylist)
Save any meta-data present on the segments when segments leave
the live window to the playlist to allow for synchronization at the
playlist level later.
Parameters:
Name | Type | Description |
---|---|---|
oldPlaylist |
Playlist | The previous active playlist |
newPlaylist |
Playlist | The updated and most current playlist |
- Source:
segmentXhrHeaders(segment)
Defines headers for use in the xhr request for a particular segment.
Parameters:
Name | Type | Description |
---|---|---|
segment |
Object | a simplified copy of the segmentInfo object from SegmentLoader |
- Source:
setDateTimeMapping(playlist)
Save the mapping from playlist's ProgramDateTime to display. This should
only ever happen once at the start of playback.
Parameters:
Name | Type | Description |
---|---|---|
playlist |
Playlist | The currently active playlist |
- Source:
setupMediaGroups(settings, mode)
Setup PlaylistLoaders and Tracks for media groups (Audio, Subtitles,
Closed-Captions) specified in the master manifest.
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
settings |
Object | Object containing required information for setting up the media groups
Properties
|
|||||||||||||||||||||
mode |
String | Mode of the hls source handler. Can be 'auto', 'html5', or 'flash' | |||||||||||||||||||||
settings.hls |
HlsHandler | HLS SourceHandler | |||||||||||||||||||||
settings.master |
Object | The parsed master manifest | |||||||||||||||||||||
settings.mediaTypes |
Object | Object to store the loaders, tracks, and utility methods for each media type | |||||||||||||||||||||
settings.blacklistCurrentPlaylist |
function | Blacklists the current rendition and forces a rendition switch. |
- Source:
skipEmptySegments_(segmentInfo) → {Object}
Prevents the segment loader from requesting segments we know contain no subtitles
by walking forward until we find the next segment that we don't know whether it is
empty or not.
Parameters:
Name | Type | Description |
---|---|---|
segmentInfo |
Object | a segment info object that describes the current segment |
- Source:
Returns:
a segment info object that describes the current segment
- Type
- Object
stableSort(array, sortFn)
Resuable stable sort function
Parameters:
Name | Type | Description |
---|---|---|
array |
Playlists | |
sortFn |
function | Different comparators |
- Source:
start()
start loading of the playlist
- Source:
startLoaders(playlistLoader, mediaType)
Start loading provided segment loader and playlist loader
Parameters:
Name | Type | Description |
---|---|---|
playlistLoader |
PlaylistLoader | PlaylistLoader to start loading |
mediaType |
Object | Active media type |
- Source:
stopLoaders(segmentLoader, mediaType)
Pause provided segment loader and playlist loader if active
Parameters:
Name | Type | Description |
---|---|---|
segmentLoader |
SegmentLoader | SegmentLoader to pause |
mediaType |
Object | Active media type |
- Source:
textRange(range, i)
convert a TimeRange to text
Parameters:
Name | Type | Description |
---|---|---|
range |
TimeRange | the timerange to use for conversion |
i |
Number | the iterator on the range to convert |
- Source:
timestampOffset() → {Number}
Set/get the timestampoffset on the SourceBuffer
- Source:
Returns:
the timestamp offset
- Type
- Number
timeUntilRebuffer(buffered, currentTime, playbackRate) → {Number}
Calculates the amount of time left in seconds until the player hits the end of the
buffer and causes a rebuffer
Parameters:
Name | Type | Description |
---|---|---|
buffered |
TimeRange | The state of the buffer |
currentTime |
Numnber | The current time of the player |
playbackRate |
Number | The current playback rate of the player. Defaults to 1. |
Returns:
Time until the player has to start rebuffering in seconds.
- Type
- Number
track(trackopt) → {TextTrack}
Set a subtitle track on the segment loader to add subtitles to
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
track |
TextTrack |
<optional> |
The text track to add loaded subtitles to |
- Source:
Returns:
Returns the subtitles track
- Type
- TextTrack
updating() → {Boolean}
Whether the underlying sourceBuffer is updating or not
- Source:
Returns:
the updating status of the SourceBuffer
- Type
- Boolean
waitForCompletion(activeXhrs, decrypter, doneFn)
This function waits for all XHRs to finish (with either success or failure)
before continueing processing via it's callback. The function gathers errors
from each request into a single errors array so that the error status for
each request can be examined later.
Parameters:
Name | Type | Description |
---|---|---|
activeXhrs |
Object | an object that tracks all XHR requests |
decrypter |
WebWorker | a WebWorker interface to AES-128 decryption routines |
doneFn |
function | a callback that is executed after all resources have been downloaded and any decryption completed |
- Source: