@Emits(events={"addAnalyticsBaseParams","analyticsVideoEngagement","audioTracks","bufferingCompleted","bufferingStarted","caption","captionsLanguages","toggleClosedCaptions","renditionChanged"}) @ListensFor(events={"selectAudioTrack","selectClosedCaptionTrack","on360FrameAvailable","videoDurationChanged"}) public class ExoPlayerVideoDisplayComponent extends VideoDisplayComponent
See: https://github.com/google/ExoPlayer
VideoDisplayComponent| Modifier and Type | Class and Description |
|---|---|
static interface |
ExoPlayerVideoDisplayComponent.CaptionListener
A listener for receiving notifications of timed text.
|
static interface |
ExoPlayerVideoDisplayComponent.Id3MetadataListener
Deprecated.
Use
ExoPlayerVideoDisplayComponent.MetadataListener instead. |
static interface |
ExoPlayerVideoDisplayComponent.InfoListener
A listener for debugging information.
|
static interface |
ExoPlayerVideoDisplayComponent.InternalErrorListener
Listeners for receiving error information.
|
static interface |
ExoPlayerVideoDisplayComponent.MetadataListener
Listener for receiving
Metadata parsed from the media stream. |
static interface |
ExoPlayerVideoDisplayComponent.TrackType
The list of possible Format types.
|
VideoDisplayComponent.OnSetSourceListener, VideoDisplayComponent.OnWillChangeVideoListener| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
BUFFERED_POSITION
The buffered position property of a BUFFERED_UPDATE event.
|
static java.lang.String |
EXOPLAYER_FORMAT
The key for a Format object emitted when the ExoPlayer changes rendition.
|
static java.lang.String |
IN_MANIFEST_CC_URI_STR |
static java.lang.String |
RENDITION_CHANGED
Emitted when the ExoPlayer changes the rendition
|
static java.util.ResourceBundle |
resourceBundle |
static int |
TYPE_AUDIO |
static int |
TYPE_METADATA |
static int |
TYPE_TEXT |
static int |
TYPE_VIDEO |
static java.lang.String |
UNKNOWN_CC |
captionsPath, context, fromSeekPosition, hasSurface, isFrameAvailable, mRendererConfig, nextSource, nextVideo, ON_PLAY_SEEK_THRESHOLD, playheadPosition, progressInterval, renderView, reseeking, seekPosition, updatereventEmitter, listenerTokens| Constructor and Description |
|---|
ExoPlayerVideoDisplayComponent(RenderView renderView,
EventEmitter eventEmitter) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
destroyPlayer()
Destroys the current player and releases it from memory.
|
com.google.android.exoplayer2.upstream.BandwidthMeter |
getBandwidthMeter()
Returns the current bandwidth meter.
|
BrightcoveDrmSession |
getBrightcoveDrmSession()
Gets the Brightcove Drm session if available or null otherwise.
|
com.google.android.exoplayer2.upstream.HttpDataSource.Factory |
getDataSourceFactory()
Returns the current
HttpDataSource.Factory, which is used when creating the MediaSource. |
com.google.android.exoplayer2.ExoPlayer |
getExoPlayer() |
int |
getLiveEdge()
Compute the "live edge", the largest position not within three target durations of the duration (per the HLS spec).
|
LoadControlConfig |
getLoadControlConfig()
Gets the LoadControlConfig object.
|
android.os.Handler |
getMainHandler() |
long |
getMaxBufferDurationToSwitchDown()
Deprecated.
It is not longer used for ExoPlayer v2.
|
android.media.MediaPlayer |
getMediaPlayer() |
long |
getMinBufferDurationToSwitchUp()
Deprecated.
It is not longer used for ExoPlayer v2.
|
int |
getMinBufferMs()
Deprecated.
It is not longer used for ExoPlayer v2.
|
int |
getMinRebufferMs()
Deprecated.
It is not longer used for ExoPlayer v2. Use Use
getLoadControlConfig() |
int |
getPeakBitrate()
Return the peak bitrate.
|
android.os.Looper |
getPlaybackLooper() |
long |
getPlayerCurrentPosition()
Returns the current playhead position of the underlying video player.
|
int |
getPlayerState()
Returns the ExoPlayer state if available,
or -1 if the player is null.
|
com.google.android.exoplayer2.trackselection.DefaultTrackSelector |
getTrackSelector()
Gets the DefaultTrackSelector object.
|
TrackSelectorHelper |
getTrackSelectorHelper()
Gets the TrackSelectorHelper object.
|
com.google.android.exoplayer2.Format |
getVideoFormat() |
boolean |
hasDvr()
Indicates if Live with DVR is supported.
|
protected void |
initializeListeners() |
boolean |
isInLiveEdge()
Checks the current playhead position with the live edge position and determines if it is in live edge.
|
boolean |
isLive()
Provides a default for handling live videos.
|
protected void |
openVideo(Video video,
Source source)
Creates, configures, and prepares a new instance of MediaPlayer
|
void |
setBandwidthMeter(com.google.android.exoplayer2.upstream.BandwidthMeter bandwidthMeter)
Sets the current bandwidth meter.
|
void |
setCaptionListener(ExoPlayerVideoDisplayComponent.CaptionListener listener) |
void |
setDataSourceFactory(com.google.android.exoplayer2.upstream.HttpDataSource.Factory httpDataSourceFactory)
Sets the
HttpDataSource.Factory, which is used when creating the MediaSource. |
void |
setDebugListener(ExoPlayerVideoDisplayComponent.InfoListener debugListener) |
void |
setInternalErrorListener(ExoPlayerVideoDisplayComponent.InternalErrorListener internalErrorListener) |
void |
setLoadControlConfig(LoadControlConfig loadControlConfig)
Sets the LoadControlConfig object.
|
void |
setMaxBufferDurationToSwitchDown(long maxBufferDurationToSwitchDown)
Deprecated.
It is not longer used for ExoPlayer v2.
|
void |
setMetadataListener(ExoPlayerVideoDisplayComponent.Id3MetadataListener listener)
Deprecated.
Use
setMetadataListener(MetadataListener) instead |
void |
setMetadataListener(ExoPlayerVideoDisplayComponent.MetadataListener listener) |
void |
setMinBufferDurationToSwitchUp(long minBufferDurationToSwitchUp)
Deprecated.
It is not longer used for ExoPlayer v2.
|
void |
setMinBufferMs(int minBufferMs)
Deprecated.
It is not longer used for ExoPlayer v2.
|
void |
setMinRebufferMs(int minRebufferMs)
Deprecated.
It is not longer used for ExoPlayer v2. Use
setLoadControlConfig(LoadControlConfig) |
void |
setPeakBitrate(int peakBitrate)
Sets the peak bitrate.
|
void |
setTextInformationFrameListener(TextInformationFrameListener listener)
Sets the Text Information Frame Listener.
|
void |
setTrackSelector(com.google.android.exoplayer2.trackselection.DefaultTrackSelector trackSelector) |
void |
setVideoSelectionOverrideCreator(SelectionOverrideCreator videoSelectionOverrideCreator)
Provides a creator for a
DefaultTrackSelector.SelectionOverride instance specific for the Video track. |
protected void |
startUpdater() |
protected void |
stopUpdater() |
void |
surfaceChanged(android.view.SurfaceHolder surfaceHolder,
int format,
int w,
int h) |
void |
surfaceCreated(android.view.SurfaceHolder surfaceHolder) |
void |
surfaceDestroyed(android.view.SurfaceHolder surfaceHolder) |
emitErrorEvent, emitErrorEvent, emitVideoSize, getAnalytics, getCurrentSource, getCurrentSourceOrFail, getCurrentVideo, getCurrentVideoOrFail, getHeaders, getRenderView, isCurrentVideo360Mode, onSurfaceTextureAvailable, onSurfaceTextureDestroyed, onSurfaceTextureSizeChanged, onSurfaceTextureUpdated, openCurrentVideoSource, setProgressInterval, setRendererConfig, setVideoSourceaddListener, addOnceListener, getEventEmitter, removeListener, removeListenerspublic static final java.lang.String IN_MANIFEST_CC_URI_STR
public static final java.lang.String BUFFERED_POSITION
public static final java.lang.String RENDITION_CHANGED
public static final java.lang.String EXOPLAYER_FORMAT
public static final int TYPE_VIDEO
public static final int TYPE_AUDIO
public static final int TYPE_TEXT
public static final int TYPE_METADATA
public static final java.lang.String UNKNOWN_CC
public static java.util.ResourceBundle resourceBundle
public ExoPlayerVideoDisplayComponent(RenderView renderView, EventEmitter eventEmitter)
@Nullable public BrightcoveDrmSession getBrightcoveDrmSession()
BrightcoveDrmSession will be created only when the current Source
properties has the key Source.Fields#WIDEVINE_KEY_SYSTEM@Nullable public com.google.android.exoplayer2.trackselection.DefaultTrackSelector getTrackSelector()
DefaultTrackSelector@Nullable public TrackSelectorHelper getTrackSelectorHelper()
TrackSelectorHelperpublic void setTrackSelector(@NonNull
com.google.android.exoplayer2.trackselection.DefaultTrackSelector trackSelector)
protected void initializeListeners()
initializeListeners in class VideoDisplayComponentprotected void startUpdater()
startUpdater in class VideoDisplayComponentprotected void stopUpdater()
stopUpdater in class VideoDisplayComponentpublic android.media.MediaPlayer getMediaPlayer()
getMediaPlayer in class VideoDisplayComponentpublic boolean hasDvr()
VideoDisplayComponenthasDvr in class VideoDisplayComponentTRUE iff live video with DVR capabilities is supported.public boolean isLive()
VideoDisplayComponentisLive in class VideoDisplayComponentTRUE iff live video is supported.public boolean isInLiveEdge()
VideoDisplayComponentisInLiveEdge in class VideoDisplayComponentpublic long getPlayerCurrentPosition()
VideoDisplayComponentConstants.TIME_UNSET will returned.getPlayerCurrentPosition in class VideoDisplayComponentpublic int getLiveEdge()
getLiveEdge in class VideoDisplayComponentpublic com.google.android.exoplayer2.ExoPlayer getExoPlayer()
public int getPlayerState()
Player.getPlaybackState()public void setDebugListener(ExoPlayerVideoDisplayComponent.InfoListener debugListener)
public void setCaptionListener(ExoPlayerVideoDisplayComponent.CaptionListener listener)
public void setMetadataListener(ExoPlayerVideoDisplayComponent.MetadataListener listener)
@Deprecated public void setMetadataListener(ExoPlayerVideoDisplayComponent.Id3MetadataListener listener)
setMetadataListener(MetadataListener) insteadlistener - the listenerpublic void setInternalErrorListener(ExoPlayerVideoDisplayComponent.InternalErrorListener internalErrorListener)
public void setTextInformationFrameListener(@NonNull
TextInformationFrameListener listener)
VideoDisplayComponentTextInformationFrameListener.onTextInformationFrame(TextInformationFrame, long) will be called
when the player finds an ID3 Metadata of type TextInformationFrame in the Video.
Use TextInformationFrameListener.DISABLED to disable the listener.setTextInformationFrameListener in class VideoDisplayComponentlistener - the listenerprotected void openVideo(@NonNull
Video video,
@Nullable
Source source)
VideoDisplayComponentopenVideo in class VideoDisplayComponentvideo - reference to the video to be prepared for the playback.source - reference to the source to played if any.protected void destroyPlayer()
VideoDisplayComponentdestroyPlayer in class VideoDisplayComponentMediaPlayer,
SurfaceViewpublic android.os.Looper getPlaybackLooper()
public android.os.Handler getMainHandler()
public com.google.android.exoplayer2.Format getVideoFormat()
public int getPeakBitrate()
public void setPeakBitrate(int peakBitrate)
peakBitrate - the peak bitratepublic void setVideoSelectionOverrideCreator(@NonNull
SelectionOverrideCreator videoSelectionOverrideCreator)
Provides a creator for a DefaultTrackSelector.SelectionOverride instance specific for the Video track.
This SelectionOverride is applied every time a new video is loaded, and when the setPeakBitrate(int) is set.
If you want to disable the default SelectionOverride, you may pass SelectionOverrideCreator.EMPTY, which returns
SelectionOverrideCreator.EMPTY_SELECTION_OVERRIDE and gets ignored when attempting to apply it to the DefaultTrackSelector.
public com.google.android.exoplayer2.upstream.BandwidthMeter getBandwidthMeter()
public void setBandwidthMeter(com.google.android.exoplayer2.upstream.BandwidthMeter bandwidthMeter)
@NonNull public com.google.android.exoplayer2.upstream.HttpDataSource.Factory getDataSourceFactory()
HttpDataSource.Factory, which is used when creating the MediaSource.public void setDataSourceFactory(@NonNull
com.google.android.exoplayer2.upstream.HttpDataSource.Factory httpDataSourceFactory)
HttpDataSource.Factory, which is used when creating the MediaSource.
WARNING: When creating a customized HttpDataSource.Factory, you must make sure to use the default
user agent C.HTTP_USER_AGENT to avoid losing Brightcove Analytics
and Delivery Rules support.httpDataSourceFactory - the http data source factory@Deprecated public long getMinBufferDurationToSwitchUp()
@Deprecated public void setMinBufferDurationToSwitchUp(long minBufferDurationToSwitchUp)
@Deprecated public long getMaxBufferDurationToSwitchDown()
@Deprecated public void setMaxBufferDurationToSwitchDown(long maxBufferDurationToSwitchDown)
@Deprecated public int getMinBufferMs()
@Deprecated public void setMinBufferMs(int minBufferMs)
@Deprecated public int getMinRebufferMs()
getLoadControlConfig()@Deprecated public void setMinRebufferMs(int minRebufferMs)
setLoadControlConfig(LoadControlConfig)public LoadControlConfig getLoadControlConfig()
public void setLoadControlConfig(@NonNull
LoadControlConfig loadControlConfig)
This object is used to create a LoadControl instance.
The LoadControl is used when creating an instance of the ExoPlayer.
loadControlConfig - the load control configpublic void surfaceCreated(android.view.SurfaceHolder surfaceHolder)
surfaceCreated in class VideoDisplayComponentpublic void surfaceChanged(android.view.SurfaceHolder surfaceHolder,
int format,
int w,
int h)
surfaceChanged in class VideoDisplayComponentpublic void surfaceDestroyed(android.view.SurfaceHolder surfaceHolder)
surfaceDestroyed in class VideoDisplayComponent