@ListensFor(events="selectSource") @Emits(events="sourceNotFound") public class DefaultSourceSelectionController extends AbstractComponent implements Component, SourceSelector
SourceSelector controller responsible to react to the
EventType.SELECT_SOURCE event and call SourceSelector.selectSource(Video) of the
SourceSelector set. By default, BrightcoveSourceSelector is used.
The selected Source will be added to the EventType.SELECT_SOURCE event properties
with the AbstractEvent.SOURCE key.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
TAG |
eventEmitter, listenerTokens| Constructor and Description |
|---|
DefaultSourceSelectionController(EventEmitter eventEmitter)
Initializes this controller with the given EventEmitter using the default
BrightcoveSourceSelector. |
| Modifier and Type | Method and Description |
|---|---|
static DefaultSourceSelectionController |
create(EventEmitter eventEmitter)
Creates the Default Source Selection Controller using the default
BrightcoveSourceSelector. |
static DefaultSourceSelectionController |
createWithSourceSelector(EventEmitter eventEmitter,
SourceSelector sourceSelector)
Creates the Default Source Selection Controller with a custom
SourceSelector. |
Source |
findBestSourceByBitRate(SourceCollection sourceCollection,
java.lang.Integer bitRate)
Given a SourceCollection, finds the Source with the closest bit rate to the given value.
|
SourceSelector |
getSourceSelector() |
protected void |
initializeListeners() |
protected 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 |
setSourceSelector(SourceSelector sourceSelector) |
addListener, addOnceListener, getEventEmitter, removeListener, removeListenerspublic DefaultSourceSelectionController(@NonNull
EventEmitter eventEmitter)
BrightcoveSourceSelector.eventEmitter - the EventEmitter through which this controller will interactpublic static DefaultSourceSelectionController create(@NonNull EventEmitter eventEmitter)
BrightcoveSourceSelector.eventEmitter - the event emitterpublic static DefaultSourceSelectionController createWithSourceSelector(@NonNull EventEmitter eventEmitter, @NonNull SourceSelector sourceSelector)
SourceSelector.eventEmitter - the event emittersourceSelector - the source selectorpublic void setSourceSelector(@NonNull
SourceSelector sourceSelector)
@NonNull public SourceSelector getSourceSelector()
@NonNull public Source selectSource(@NonNull Video video) throws NoSourceFoundException
SourceSelectorselectSource in interface SourceSelectorvideo - Video in which to find the most appropriate SourceNoSourceFoundException - when no valid Source is foundSourceSelector.selectSource(com.brightcove.player.model.Video)@Nullable protected Source selectSource(@Nullable java.util.Set<Source> sources)
It will return null if the sources Set is null or empty.
sources - the source Set.public 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 Sourceprotected void initializeListeners()