Class: shaka.util.StreamUtils
A set of utility functions for dealing with Streams and Manifests.
Members
(private, static) nextTrackId_ :number
Type:
- Source:
Methods
(static) applyRestrictions(variantsnon-null, restrictions, maxHwRes) → {boolean}
Parameters:
- Source:
Returns:
Whether the tracks changed.
-
Type
-
boolean
(private, static) areStreamsCompatible_(s0, s1) → {boolean}
Parameters:
- Source:
Returns:
-
Type
-
boolean
(static) filterNewPeriod(drmEngine, activeAudionullable, activeVideonullable, period)
Alters the given Period to filter out any unplayable streams.
Parameters:
- Source:
(static) filterStreamsByLanguageAndRole(streamsnon-null, preferredLanguage, preferredRole) → (non-null) {Array.<!shaka.extern.Stream>}
Chooses streams according to the given config.
Parameters:
| Name |
Type |
Description |
streams |
Array.<shaka.extern.Stream>
|
|
preferredLanguage |
string
|
|
preferredRole |
string
|
|
- Source:
Returns:
-
Type
-
Array.<!shaka.extern.Stream>
(private, static) filterTextStreamsByRole_(textStreamsnon-null, preferredRole) → (non-null) {Array.<shaka.extern.Stream>}
Filter text Streams by role.
Parameters:
- Source:
Returns:
-
Type
-
Array.<shaka.extern.Stream>
(static) filterVariantsByAudioChannelCount(variantsnon-null, preferredAudioChannelCount) → (non-null) {Array.<!shaka.extern.Variant>}
Filters variants according to the given audio channel count config.
Parameters:
- Source:
Returns:
-
Type
-
Array.<!shaka.extern.Variant>
(private, static) getStreamSummaryString_(stream) → {string}
Parameters:
- Source:
Returns:
-
Type
-
string
(static) getVariantByStreams(audionullable, videonullable, variantsnon-null) → (nullable) {shaka.extern.Variant}
Finds a Variant with given audio and video streams.
Returns null if no such Variant was found.
Parameters:
- Source:
Returns:
-
Type
-
shaka.extern.Variant
(static) getVariantStreams(variant) → (non-null) {Array.<shaka.extern.Stream>}
Get all non-null streams in the variant as an array.
Parameters:
- Source:
Returns:
-
Type
-
Array.<shaka.extern.Stream>
(static) html5TrackId(html5Track) → {number}
Generate and return an ID for this track, since the ID field is optional.
Parameters:
| Name |
Type |
Description |
html5Track |
TextTrack
|
AudioTrack
|
|
- Source:
Returns:
The generated ID.
-
Type
-
number
(private, static) html5TrackToGenericShakaTrack_(html5Track) → {shaka.extern.Track}
Creates a Track object with non-type specific fields filled out. The caller
is responsible for completing the Track object with any type-specific
information (audio or text).
Parameters:
| Name |
Type |
Description |
html5Track |
TextTrack
|
AudioTrack
|
|
- Source:
Returns:
-
Type
-
shaka.extern.Track
(static) isAudio(stream) → {boolean}
Checks if the given stream is an audio stream.
Parameters:
- Source:
Returns:
-
Type
-
boolean
(static) isPlayable(variantnon-null) → {boolean}
Determines if the given variant is playable.
Parameters:
- Source:
Returns:
-
Type
-
boolean
(static) isVideo(stream) → {boolean}
Checks if the given stream is a video stream.
Parameters:
- Source:
Returns:
-
Type
-
boolean
(static) meetsRestrictions(variant, restrictions, maxHwRes) → {boolean}
Parameters:
| Name |
Type |
Description |
variant |
shaka.extern.Variant
|
|
restrictions |
shaka.extern.Restrictions
|
Configured restrictions from the user. |
maxHwRes |
{width: number, height: number}
|
The maximum resolution the hardware can handle.
This is applied separately from user restrictions because the setting
should not be easily replaced by the user's configuration. |
- Source:
Returns:
-
Type
-
boolean