Class: shaka.util.StreamUtils

A set of utility functions for dealing with Streams and Manifests.

Members

(private, static) nextTrackId_ :number

Type:
  • number
Source:

Methods

(static) applyRestrictions(variantsnon-null, restrictions, maxHwRes) → {boolean}

Parameters:
Name Type Description
variants Array.<shaka.extern.Variant>
restrictions shaka.extern.Restrictions
maxHwRes {width: number, height: number}
Source:
Returns:
Whether the tracks changed.
Type
boolean

(private, static) areStreamsCompatible_(s0, s1) → {boolean}

Parameters:
Name Type Description
s0 shaka.extern.Stream
s1 shaka.extern.Stream
Source:
Returns:
Type
boolean

(static) filterNewPeriod(drmEngine, activeAudionullable, activeVideonullable, period)

Alters the given Period to filter out any unplayable streams.
Parameters:
Name Type Attributes Description
drmEngine shaka.media.DrmEngine
activeAudio shaka.extern.Stream <nullable>
activeVideo shaka.extern.Stream <nullable>
period shaka.extern.Period
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:
Name Type Description
textStreams Array.<shaka.extern.Stream>
preferredRole string
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:
Name Type Description
variants Array.<shaka.extern.Variant>
preferredAudioChannelCount number
Source:
Returns:
Type
Array.<!shaka.extern.Variant>

(static) getPlayableVariants(variantsnon-null) → (non-null) {Array.<!shaka.extern.Variant>}

Filters out unplayable variants.
Parameters:
Name Type Description
variants Array.<!shaka.extern.Variant>
Source:
Returns:
Type
Array.<!shaka.extern.Variant>

(private, static) getStreamSummaryString_(stream) → {string}

Parameters:
Name Type Description
stream shaka.extern.Stream
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:
Name Type Attributes Description
audio shaka.extern.Stream <nullable>
video shaka.extern.Stream <nullable>
variants Array.<!shaka.extern.Variant>
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:
Name Type Description
variant shaka.extern.Variant
Source:
Returns:
Type
Array.<shaka.extern.Stream>

(static) html5AudioTrackToTrack(audioTrack) → {shaka.extern.Track}

Parameters:
Name Type Description
audioTrack AudioTrack
Source:
Returns:
Type
shaka.extern.Track

(static) html5TextTrackToTrack(textTrack) → {shaka.extern.Track}

Parameters:
Name Type Description
textTrack TextTrack
Source:
Returns:
Type
shaka.extern.Track

(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:
Name Type Description
stream shaka.extern.Stream
Source:
Returns:
Type
boolean

(static) isPlayable(variantnon-null) → {boolean}

Determines if the given variant is playable.
Parameters:
Name Type Description
variant shaka.extern.Variant
Source:
Returns:
Type
boolean

(static) isVideo(stream) → {boolean}

Checks if the given stream is a video stream.
Parameters:
Name Type Description
stream shaka.extern.Stream
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

(static) textStreamToTrack(stream) → {shaka.extern.Track}

Parameters:
Name Type Description
stream shaka.extern.Stream
Source:
Returns:
Type
shaka.extern.Track

(static) variantToTrack(variant) → {shaka.extern.Track}

Parameters:
Name Type Description
variant shaka.extern.Variant
Source:
Returns:
Type
shaka.extern.Track