public class BrightcoveSourceSelector extends java.lang.Object implements SourceSelector
Constructor and Description |
---|
BrightcoveSourceSelector() |
Modifier and Type | Method and Description |
---|---|
static Source |
findBestSourceByBitRate(SourceCollection sourceCollection,
java.lang.Integer bitRate)
Given a SourceCollection, finds the Source with the closest bit rate to the given value.
|
static SourceCollection |
findHEVCSources(SourceCollection sourceCollection)
Searches for HEVC sources in the provided
SourceCollection and creates a new SourceCollection
with the sources found. |
static SourceCollection |
findNonHEVCSources(SourceCollection sourceCollection)
Searches for non HEVC sources in the provided
SourceCollection and creates a new SourceCollection
with the sources found. |
static java.util.Set<Source> |
findSourcesByProfileVersion(SourceCollection sourceCollection,
java.lang.String profileVersion)
Find the Sources in the SourceCollection associated to the provided profile version.
|
boolean |
isPreferHls()
Returns whether to prefer HLS sources to other
delivery
types . |
static Source |
selectSource(java.util.Set<Source> sources)
Attempts to select the HTTPS source included in the source Set, if available.
|
Source |
selectSource(Video video)
Determines best appropriate Source within given Video object based on logic implemented.
|
void |
setPreferHls(boolean preferHls)
Sets whether to prefer HLS sources to other
delivery
types . |
public boolean isPreferHls()
delivery
types
. By default, this will be true if running on a device with API
level greater than or equal to Build.VERSION_CODES#ICE_CREAM_SANDWICH
.public void setPreferHls(boolean preferHls)
delivery
types
. By default, this will be true if running on a device with API
level greater than or equal to Build.VERSION_CODES#ICE_CREAM_SANDWICH
.preferHls
- true if HLS is preferred.@NonNull public Source selectSource(@NonNull Video video) throws NoSourceFoundException
selectSource
in interface SourceSelector
video
- Video in which to find the most appropriate Sourcejava.lang.IllegalArgumentException
- when the Video passed is nullNoSourceFoundException
- when no valid Source
is foundpublic static Source findBestSourceByBitRate(SourceCollection sourceCollection, java.lang.Integer bitRate)
sourceCollection
- the collection of Sources in which the match should be foundbitRate
- the target bit rate desired for the chosen Source@NonNull public static java.util.Set<Source> findSourcesByProfileVersion(@NonNull SourceCollection sourceCollection, @NonNull java.lang.String profileVersion)
SourceCollection
of typy DeliveryType.HLS
,
and its profile version, for example Source.EXT_X_VERSION_5
or Source.EXT_X_VERSION_4
.
The Set will be empty when no sources are found.
sourceCollection
- the source collectionprofileVersion
- the profile version@Nullable public static Source selectSource(@Nullable java.util.Set<Source> sources)
It will return null if the sources Set is null or empty.
sources
- the source Set representing the same media with different protocols,
for example, HTTP and HTTPS.@NonNull public static SourceCollection findHEVCSources(@NonNull SourceCollection sourceCollection)
SourceCollection
and creates a new SourceCollection
with the sources found. If no HEVC sources were found, SourceCollection.EMPTY
is returned.sourceCollection
- the Source Collection to look for HEVC sourcesSourceCollection.EMPTY
otherwise@NonNull public static SourceCollection findNonHEVCSources(@NonNull SourceCollection sourceCollection)
SourceCollection
and creates a new SourceCollection
with the sources found. If only HEVC sources were found, SourceCollection.EMPTY
is returned.sourceCollection
- the Source Collection to look for HEVC sourcesSourceCollection.EMPTY
otherwise