Constructor
new PreferenceBasedCriteria()
- Implements:
- Source:
Members
config_ :shaka.extern.AdaptationSetCriteria.Configuration
Type:
lastAdaptationSet_ :shaka.media.AdaptationSet
Type:
Methods
applyAudioPreferences_(variantsnon-null, preferredAudionon-null, audioCodec, activeAudioCodec) → {Array<shaka.extern.Variant>}
Apply audio preference entries in priority order.
For each entry, filter candidates by all specified fields (AND logic).
First entry with results wins. Falls back to primary then all variants.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
preferredAudio |
Array<!shaka.extern.AudioPreference> | |
audioCodec |
string | Runtime audio codec override |
activeAudioCodec |
string | Runtime active audio codec override |
Returns:
- Type
- Array<shaka.extern.Variant>
applyVideoPreferences_(variantsnon-null, preferredVideonon-null) → {Array<shaka.extern.Variant>}
Apply video preference entries in priority order.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
preferredVideo |
Array<!shaka.extern.VideoPreference> |
Returns:
- Type
- Array<shaka.extern.Variant>
chooseVariantWithLargestLadder_(variantsnon-null, compareCodecs) → {shaka.extern.Variant}
Choose the variant that the adaptation set is built around (its root).
By default it's the first one, the most preferred. But when codecs can't
be switched smoothly, the adaptation set only holds the root's codecs, so
pick the variant whose video codec leaves the most variants to adapt
between. Otherwise, a codec that is only used for a few resolutions
would pin playback to those resolutions.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
compareCodecs |
boolean |
Returns:
- Type
- shaka.extern.Variant
filterByLanguage_(variantsnon-null, preferredLanguage) → {Array<shaka.extern.Variant>}
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
preferredLanguage |
string |
Returns:
- Type
- Array<shaka.extern.Variant>
filterVariantsByAudioChannelCount_(variantsnon-null, channelCount) → {Array<shaka.extern.Variant>}
Filter Variants by channelCount.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
channelCount |
number |
Returns:
- Type
- Array<shaka.extern.Variant>
filterVariantsByAudioCodec_(variantsnon-null, audioCodec, normalize)
Filters variants according to the given audio codec.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
audioCodec |
string | |
normalize |
boolean | If true, any codec of the same family matches. |
filterVariantsByAudioLabel_(variantsnon-null, preferredLabel) → {Array<shaka.extern.Variant>}
Filter Variants by audio label.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
preferredLabel |
string |
Returns:
- Type
- Array<shaka.extern.Variant>
filterVariantsByAudioRole_(variantsnon-null, preferredRole) → {Array<shaka.extern.Variant>}
Filter Variants by audio role.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
preferredRole |
string |
Returns:
- Type
- Array<shaka.extern.Variant>
filterVariantsByHDRLevel_(variantsnon-null, hdrLevel)
Filters variants according to the given hdr level config.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
hdrLevel |
string |
filterVariantsBySpatialAudio_(variantsnon-null, spatialAudio)
Filters variants according to the given spatial audio config.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
spatialAudio |
boolean |
filterVariantsByVideoCodec_(variantsnon-null, videoCodec)
Filters variants according to the given video codec.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
videoCodec |
string |
filterVariantsByVideoLabel_(variantsnon-null, preferredLabel) → {Array<shaka.extern.Variant>}
Filter Variants by video label.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
preferredLabel |
string |
Returns:
- Type
- Array<shaka.extern.Variant>
filterVariantsByVideoLanguage_(variantsnon-null, preferredLanguage) → {Array<shaka.extern.Variant>}
Filter Variants by video language. Used to disambiguate video tracks
that share the same role but differ in language, e.g. multiple
sign-language video tracks.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
preferredLanguage |
string |
Returns:
- Type
- Array<shaka.extern.Variant>
filterVariantsByVideoLayout_(variantsnon-null, videoLayout)
Filters variants according to the given video layout config.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
videoLayout |
string |
filterVariantsByVideoRole_(variantsnon-null, preferredRole) → {Array<shaka.extern.Variant>}
Filter Variants by video role.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> | |
preferredRole |
string |
Returns:
- Type
- Array<shaka.extern.Variant>
configure(config)
Sets the AdaptationSetCriteria configuration.
Parameters:
| Name | Type | Description |
|---|---|---|
config |
shaka.extern.AdaptationSetCriteria.Configuration |
- Implements:
- Source:
create(variantsnon-null) → {shaka.media.AdaptationSet}
Take a set of variants, and return a subset of variants that can be
adapted between.
Parameters:
| Name | Type | Description |
|---|---|---|
variants |
Array<shaka.extern.Variant> |
- Implements:
- Source:
Returns:
getConfiguration() → {shaka.extern.AdaptationSetCriteria.Configuration}
Gets the current AdaptationSetCriteria configuration.
- Implements:
- Source:
Returns:
getLastAdaptationSet() → {shaka.media.AdaptationSet}
Return the result of last create call.
- Implements:
- Source: