-
- All Implemented Interfaces:
-
com.brightcove.player.controller.SourceSelector
public class BrightcoveSourceSelector implements SourceSelector
It is the default SourceSelector implementation that will automatically select a Source rendition based on the following rules:
- If an HLS source rendition exists use it (there should be only one, if any)
- If no HLS renditions exists, but MP4 renditions exist, use the rendition that is closest to 256 kBps
- If no HLS or MP4 renditions exist, throw a NoSourceFoundException
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
preferHls
-
Method Summary
Modifier and Type Method Description void
setPreferHls(boolean preferHls)
Sets whether to prefer HLS sources to other delivery types. boolean
isPreferHls()
Returns whether to prefer HLS sources to other delivery types. Source
selectSource(@NonNull() Video video)
Determines best appropriate Source within given Video object based on logic implemented. static Source
findBestSourceByBitRate(SourceCollection sourceCollection, Integer bitRate)
Given a SourceCollection, finds the Source with the closest bit rate to the given value. static Set<Source>
findSourcesByProfileVersion(@NonNull() SourceCollection sourceCollection, @NonNull() String profileVersion)
Find the Sources in the SourceCollection associated to the provided profile version. static Source
selectSource(@Nullable() Set<Source> sources)
Attempts to select the HTTPS source included in the source Set, if available. static SourceCollection
findHEVCSources(@NonNull() SourceCollection sourceCollection)
Searches for HEVC sources in the provided SourceCollection and creates a new SourceCollection with the sources found. static SourceCollection
findNonHEVCSources(@NonNull() SourceCollection sourceCollection)
Searches for non HEVC sources in the provided SourceCollection and creates a new SourceCollection with the sources found. -
-
Method Detail
-
setPreferHls
void setPreferHls(boolean preferHls)
Sets whether to prefer HLS sources to other delivery types. By default, this will be true if running on a device with APIlevel greater than or equal to ICE_CREAM_SANDWICH.
- Parameters:
preferHls
- true if HLS is preferred.
-
isPreferHls
boolean isPreferHls()
Returns whether to prefer HLS sources to other delivery types. By default, this will be true if running on a device with APIlevel greater than or equal to ICE_CREAM_SANDWICH.
-
selectSource
@NonNull() Source selectSource(@NonNull() Video video)
Determines best appropriate Source within given Video object based on logic implemented.
-
findBestSourceByBitRate
static Source findBestSourceByBitRate(SourceCollection sourceCollection, Integer bitRate)
Given a SourceCollection, finds the Source with the closest bit rate to the given value.
- Parameters:
sourceCollection
- the collection of Sources in which the match should be foundbitRate
- the target bit rate desired for the chosen Source
-
findSourcesByProfileVersion
@NonNull() static Set<Source> findSourcesByProfileVersion(@NonNull() SourceCollection sourceCollection, @NonNull() String profileVersion)
Find the Sources in the SourceCollection associated to the provided profile version.Currently this applies only to SourceCollection of typy HLS,and its profile version, for example EXT_X_VERSION_5 or EXT_X_VERSION_4.
The Set will be empty when no sources are found.
- Parameters:
sourceCollection
- the source collectionprofileVersion
- the profile version
-
selectSource
@Nullable() static Source selectSource(@Nullable() Set<Source> sources)
Attempts to select the HTTPS source included in the source Set, if available. Otherwise, it willselect the first source given by the Set Iterator.
It will return null if the sources Set is null or empty.
- Parameters:
sources
- the source Set representing the same media with different protocols,for example, HTTP and HTTPS.
-
findHEVCSources
@NonNull() static SourceCollection findHEVCSources(@NonNull() SourceCollection sourceCollection)
Searches for HEVC sources in the provided SourceCollection and creates a new SourceCollection with the sources found. If no HEVC sources were found, EMPTY is returned.
- Parameters:
sourceCollection
- the Source Collection to look for HEVC sources
-
findNonHEVCSources
@NonNull() static SourceCollection findNonHEVCSources(@NonNull() SourceCollection sourceCollection)
Searches for non HEVC sources in the provided SourceCollection and creates a new SourceCollection with the sources found. If only HEVC sources were found, EMPTY is returned.
- Parameters:
sourceCollection
- the Source Collection to look for HEVC sources
-
-
-
-