Constructor
new QueueManager(player)
Parameters:
| Name | Type | Description |
|---|---|---|
player |
shaka.Player |
- Implements:
- Source:
Members
preloadNext_ :?{item: shaka.extern.QueueItem, preloadManager: ?shaka.media.PreloadManager}
Type:
- ?{item: shaka.extern.QueueItem, preloadManager: ?shaka.media.PreloadManager}
- Source:
preloadPrev_ :?{item: shaka.extern.QueueItem, preloadManager: ?shaka.media.PreloadManager}
Type:
- ?{item: shaka.extern.QueueItem, preloadManager: ?shaka.media.PreloadManager}
- Source:
Methods
parseExtInf_(line) → {shaka.extern.QueueItemMetadata}
Parses a single #EXTINF line and extracts its attributes together with
the human-readable display name that follows the last comma.
Expected format (newlines added here for readability only):
#EXTINF:-1 tvg-id="ch1" tvg-name="Channel 1"
tvg-logo="https://example.com/logo.png"
tvg-language="English" tvg-country="US"
group-title="News",Channel 1 Display Name
All key="value" attributes are copied directly into the returned
metadata object using their original attribute names. Unknown
attributes are preserved automatically.
The standard QueueItemMetadata fields are also populated:
- title <- tvg-name or display title
- poster <- tvg-logo
Attribute parsing is intentionally lenient: malformed or unsupported
attributes are ignored, and missing attributes are omitted rather than
set to empty strings.
Parameters:
| Name | Type | Description |
|---|---|---|
line |
string | A single #EXTINF line from the playlist. |
- Source:
Returns:
parseM3uPlaylist_(text) → {Array<shaka.extern.QueueItem>}
Parses raw M3U/M3U8 playlist text and returns an array of
shaka.extern.QueueItem objects ready to be inserted into the
queue.
Only lines that follow an #EXTINF directive are treated as stream URLs;
bare URL-only playlists (no #EXTM3U / #EXTINF) are also supported —
every non-comment, non-empty line is treated as a stream URI with no
metadata in that case.
Parameters:
| Name | Type | Description |
|---|---|---|
text |
string |
- Source:
Returns:
- Type
- Array<shaka.extern.QueueItem>
addExtraTracks_(itemnon-null) → {Promise}
Adds extra tracks (text, thumbnails, chapters) in parallel
Parameters:
| Name | Type | Description |
|---|---|---|
item |
shaka.extern.QueueItem |
- Source:
Returns:
- Type
- Promise
cleanupPreloadPrev_(currentItemnon-null, previousItemnullable)
Cleans up preloadPrev_ if no longer needed and saves preload of the
previous item
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
currentItem |
shaka.extern.QueueItem | ||
previousItem |
shaka.extern.QueueItem |
<nullable> |
- Source:
configure(config)
Called by the Player to provide an updated configuration any time it
changes.
Parameters:
| Name | Type | Description |
|---|---|---|
config |
shaka.extern.QueueConfiguration |
- Implements:
- Source:
destroy() → {Promise}
Request that this object be destroyed, releasing all resources and shutting
down all operations. Returns a Promise which is resolved when destruction
is complete. This Promise should never be rejected.
- Overrides:
- Implements:
- Source:
Returns:
- Type
- Promise
getAssetOrPreloader_(itemnon-null) → {string|shaka.media.PreloadManager}
Determines which asset to use: preloadPrev_, preloadNext_ or manifestUri
Parameters:
| Name | Type | Description |
|---|---|---|
item |
shaka.extern.QueueItem |
- Source:
Returns:
- Type
- string | shaka.media.PreloadManager
getConfiguration() → {shaka.extern.QueueConfiguration}
Returns the current configuration.
- Implements:
- Source:
Returns:
getCurrentItemIndex() → {number}
Returns the index of the current playing item.
- Implements:
- Source:
Returns:
- Type
- number
getItems() → {Array<shaka.extern.QueueItem>}
Returns all items.
- Implements:
- Source:
Returns:
- Type
- Array<shaka.extern.QueueItem>
insertItems(itemsnon-null)
Insert new items in the current queue.
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array<shaka.extern.QueueItem> |
- Implements:
- Source:
loadFromM3uPlaylist(url, playOnLoadopt) → {Promise}
Fetches an M3U/M3U8 playlist from the given URL using the player's
networking engine, parses it, and inserts the resulting items into the
queue. Supports the extended EXTINF format with tvg-* attributes
commonly found in IPTV playlists (tvg-id, tvg-name, tvg-logo,
tvg-language, tvg-country, tvg-url, group-title).
The parsed tvg-* attribute values are stored in the item's metadata:
- tvg-name → metadata.title (falls back to the display name)
- tvg-logo → metadata.poster
- tvg-id → metadata.tvgId
- tvg-language → metadata.tvgLanguage
- tvg-country → metadata.tvgCountry
- tvg-url → metadata.tvgUrl
- group-title → metadata.groupTitle
- display name → metadata.displayTitle
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
url |
string | |||
playOnLoad |
boolean |
<optional> |
false |
- Implements:
- Source:
Returns:
- Type
- Promise
playCurrentItemAfterPause_(mediaElement)
Handles repeating the current item when paused
Parameters:
| Name | Type | Description |
|---|---|---|
mediaElement |
HTMLMediaElement |
- Source:
playItem(itemIndex) → {Promise}
Plays a item number in the queue.
Parameters:
| Name | Type | Description |
|---|---|---|
itemIndex |
number |
- Implements:
- Source:
Returns:
- Type
- Promise
removeAllItems() → {Promise}
Remove all items.
- Implements:
- Source:
Returns:
- Type
- Promise
setCustomPlayer(player)
Set a custom player for preloading, event management and autoplay next.
This is useful when using a CastProxy.
Parameters:
| Name | Type | Description |
|---|---|---|
player |
shaka.Player |
- Implements:
- Source:
setupPreloadNext_(mediaElement)
Sets up preloading of the next item if applicable
Parameters:
| Name | Type | Description |
|---|---|---|
mediaElement |
HTMLMediaElement |
- Source:
setupRepeatOnComplete_(mediaElement)
Sets up repeat behavior on playback completion
Parameters:
| Name | Type | Description |
|---|---|---|
mediaElement |
HTMLMediaElement |
- Source: