Class ExoPlayerVideoDisplayComponent
- All Implemented Interfaces:
Component
See: https://github.com/google/ExoPlayer
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A listener for receiving notifications of timed text.static interface
Deprecated.static interface
A listener for debugging information.static interface
Listeners for receiving error information.static interface
Listener for receivingMetadata
parsed from the media stream.static @interface
The list of possible Format types. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The buffered position property of a BUFFERED_UPDATE event.static final String
The key for a Format object emitted when the ExoPlayer changes rendition.static final String
static final String
Emitted when the ExoPlayer changes the renditionstatic ResourceBundle
static final int
static final int
static final int
static final int
static final String
Fields inherited from class com.brightcove.player.display.VideoDisplayComponent
captionsPath, context, fromSeekPosition, hasSurface, isFrameAvailable, mRendererConfig, nextSource, nextVideo, ON_PLAY_SEEK_THRESHOLD, playheadPosition, playheadPositionLong, progressInterval, renderView, reseeking, seekPosition, shouldPlayAudioOnlyInBackground, updater
Fields inherited from class com.brightcove.player.event.AbstractComponent
eventEmitter, listenerTokens
-
Constructor Summary
ConstructorDescriptionExoPlayerVideoDisplayComponent
(RenderView renderView, EventEmitter eventEmitter) -
Method Summary
Modifier and TypeMethodDescriptionCreate the MediaPlayback for theVideoDisplayComponent
.protected void
Destroys the current player and releases it from memory.boolean
com.google.android.exoplayer2.upstream.BandwidthMeter
Returns the current bandwidth meter.Deprecated.Gets reference to the video source that is currently configured for playback, if anyGets reference to the video that is currently configured for playback, if anycom.google.android.exoplayer2.upstream.HttpDataSource.Factory
Returns the currentHttpDataSource.Factory
, which is used when creating theMediaSource
.com.google.android.exoplayer2.DefaultRenderersFactory
Gets the DefaultRenderersFactory object.com.google.android.exoplayer2.ExoPlayer
Gets the ExoPlayer Drm session if available or null otherwise.int
Deprecated.long
Compute the "live edge" as a long datatype, the largest position not within three target durations of the duration (per the HLS spec).Gets the LoadControlConfig object.android.os.Handler
long
Deprecated.It is not longer used for ExoPlayer v2.android.media.MediaPlayer
long
Deprecated.It is not longer used for ExoPlayer v2.int
Deprecated.It is not longer used for ExoPlayer v2.int
Deprecated.It is not longer used for ExoPlayer v2.int
Return the peak bitrate.Get the current playback.android.os.Looper
long
Returns the current playhead position of the underlying video player.int
Returns the ExoPlayer state if available, or -1 if the player is null.com.google.android.exoplayer2.trackselection.DefaultTrackSelector
Gets the DefaultTrackSelector object.Gets the TrackSelectorHelper object.boolean
com.google.android.exoplayer2.Format
boolean
hasDvr()
Indicates if Live with DVR is supported.protected void
boolean
boolean
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.Called when theVideoDisplayComponent
is initialized.protected void
Creates, configures, and prepares a new instance of MediaPlayervoid
setAllowHlsChunklessPreparation
(boolean allowHlsChunklessPreparation) The value of this field in the HlsMediaSource defaults to true in ExoPlayer 2.17.0 Override it here to false if your HLS delivery includes 608/708 captionsvoid
setBandwidthMeter
(com.google.android.exoplayer2.upstream.BandwidthMeter bandwidthMeter) Sets the current bandwidth meter.void
void
setDataSourceFactory
(com.google.android.exoplayer2.upstream.HttpDataSource.Factory httpDataSourceFactory) Sets theHttpDataSource.Factory
, which is used when creating theMediaSource
.void
setDebugListener
(ExoPlayerVideoDisplayComponent.InfoListener debugListener) void
setDefaultRenderersFactory
(com.google.android.exoplayer2.DefaultRenderersFactory defaultRenderersFactory) 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
Deprecated.UsesetMetadataListener(Id3MetadataListener)
insteadvoid
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.void
setPeakBitrate
(int peakBitrate) Sets the peak bitrate.void
Sets the Text Information Frame Listener.void
setTrackSelector
(com.google.android.exoplayer2.trackselection.DefaultTrackSelector trackSelector) void
setUseDrmSessionsForClearContent
(boolean useDrmSessionsForClearContent) Whether to use the DRM session with clear content sections in the media (e.g.void
setVideoDisplayProperties
(Map<String, String> videoDisplayProperties) void
setVideoSelectionOverrideCreator
(SelectionOverrideCreator videoSelectionOverrideCreator) Deprecated.protected void
setVideoSource
(Video video, Source source) Sets the video source that will be used for playback.void
setVideoTrackSelectionOverrideCreator
(TrackSelectionOverrideCreator videoTrackSelectionOverrideCreator) Provides a creator for aTrackSelectionOverrides.TrackSelectionOverride
instance specific for the Video track.void
surfaceChanged
(android.view.SurfaceHolder surfaceHolder, int format, int w, int h) void
surfaceCreated
(android.view.SurfaceHolder surfaceHolder) void
surfaceDestroyed
(android.view.SurfaceHolder surfaceHolder) Methods inherited from class com.brightcove.player.display.VideoDisplayComponent
emitErrorEvent, emitErrorEvent, emitVideoSize, getAnalytics, getCurrentSourceOrFail, getCurrentVideoOrFail, getHeaders, getRenderView, isCurrentVideo360Mode, onSurfaceTextureAvailable, onSurfaceTextureDestroyed, onSurfaceTextureSizeChanged, onSurfaceTextureUpdated, setProgressInterval, setRendererConfig, setShouldPlayAudioOnlyInBackground, shouldPlayAudioOnlyInBackground
Methods inherited from class com.brightcove.player.event.AbstractComponent
addListener, addOnceListener, getEventEmitter, removeListener, removeListeners
-
Field Details
-
BUFFERED_POSITION
The buffered position property of a BUFFERED_UPDATE event.- See Also:
-
RENDITION_CHANGED
Emitted when the ExoPlayer changes the rendition- See Also:
-
EXOPLAYER_FORMAT
The key for a Format object emitted when the ExoPlayer changes rendition.- See Also:
-
IN_MANIFEST_CC_URI_STR
- See Also:
-
UNKNOWN_CC
- See Also:
-
TYPE_VIDEO
public static final int TYPE_VIDEO- See Also:
-
TYPE_AUDIO
public static final int TYPE_AUDIO- See Also:
-
TYPE_TEXT
public static final int TYPE_TEXT- See Also:
-
TYPE_METADATA
public static final int TYPE_METADATA- See Also:
-
resourceBundle
-
-
Constructor Details
-
ExoPlayerVideoDisplayComponent
-
-
Method Details
-
getBrightcoveDrmSession
Deprecated.Deprecates. Instead use {getExoPlayerDrmSessionManager()
} -
getExoPlayerDrmSessionManager
Gets the ExoPlayer Drm session if available or null otherwise. TheExoPlayerDrmSessionManager
will be created only when the currentSource
properties has the keySource.Fields.WIDEVINE_KEY_SYSTEM
- Returns:
- the drm session manager
-
getWidevineMediaDrmCallback
-
onCreatePlayback
Description copied from class:VideoDisplayComponent
Called when theVideoDisplayComponent
is initialized.- Overrides:
onCreatePlayback
in classVideoDisplayComponent
- Returns:
- The media playback for the component.
-
createPlayback
Description copied from class:VideoDisplayComponent
Create the MediaPlayback for theVideoDisplayComponent
.- Overrides:
createPlayback
in classVideoDisplayComponent
- Returns:
- A new instance of
MediaPlayback
.
-
getPlayback
Description copied from class:VideoDisplayComponent
Get the current playback.- Overrides:
getPlayback
in classVideoDisplayComponent
- Returns:
- The
MediaPlayback
for thisVideoDisplayComponent
.
-
getCurrentVideo
Description copied from class:VideoDisplayComponent
Gets reference to the video that is currently configured for playback, if any- Overrides:
getCurrentVideo
in classVideoDisplayComponent
- Returns:
- null or reference to the video
-
getCurrentSource
Description copied from class:VideoDisplayComponent
Gets reference to the video source that is currently configured for playback, if any- Overrides:
getCurrentSource
in classVideoDisplayComponent
- Returns:
- null or reference to the video source
-
setVideoSource
Description copied from class:VideoDisplayComponent
Sets the video source that will be used for playback.- Overrides:
setVideoSource
in classVideoDisplayComponent
- Parameters:
video
- reference to the video, if any.source
- reference to the video source, if any.
-
getTrackSelector
@Nullable public com.google.android.exoplayer2.trackselection.DefaultTrackSelector getTrackSelector()Gets the DefaultTrackSelector object.- Returns:
- the track selector
- See Also:
-
DefaultTrackSelector
-
getTrackSelectorHelper
Gets the TrackSelectorHelper object.- Returns:
- the track selector helper
- See Also:
-
setTrackSelector
public void setTrackSelector(@NonNull com.google.android.exoplayer2.trackselection.DefaultTrackSelector trackSelector) -
initializeListeners
protected void initializeListeners()- Overrides:
initializeListeners
in classVideoDisplayComponent
-
getMediaPlayer
public android.media.MediaPlayer getMediaPlayer()- Overrides:
getMediaPlayer
in classVideoDisplayComponent
-
hasDvr
public boolean hasDvr()Description copied from class:VideoDisplayComponent
Indicates if Live with DVR is supported. Subclasses will override if live with DVR videos are supported.- Overrides:
hasDvr
in classVideoDisplayComponent
- Returns:
TRUE
iff live video with DVR capabilities is supported.
-
isLive
public boolean isLive()Description copied from class:VideoDisplayComponent
Provides a default for handling live videos. Subclasses will override if live videos are supported.- Overrides:
isLive
in classVideoDisplayComponent
- Returns:
TRUE
iff live video is supported.
-
isInLiveEdge
public boolean isInLiveEdge()Description copied from class:VideoDisplayComponent
Checks the current playhead position with the live edge position and determines if it is in live edge.- Overrides:
isInLiveEdge
in classVideoDisplayComponent
- Returns:
- true if in live edge.
-
getPlayerCurrentPosition
public long getPlayerCurrentPosition()Description copied from class:VideoDisplayComponent
Returns the current playhead position of the underlying video player.If the player has not been set or initialized,
Constants.TIME_UNSET
will returned.- Overrides:
getPlayerCurrentPosition
in classVideoDisplayComponent
- Returns:
- the current playhead position.
-
getLiveEdge
Deprecated.Deprecated. Instead usegetLiveEdgeLong()
- Overrides:
getLiveEdge
in classVideoDisplayComponent
- Returns:
- 0. Subclasses should override to provide a value within three target durations of the maximum position.
-
getExoPlayer
public com.google.android.exoplayer2.ExoPlayer getExoPlayer() -
getLiveEdgeLong
public long getLiveEdgeLong()Compute the "live edge" as a long datatype, the largest position not within three target durations of the duration (per the HLS spec).- Overrides:
getLiveEdgeLong
in classVideoDisplayComponent
- Returns:
- -1 if the video is not live. Otherwise the largest position that is three target durations away from the duration.
-
getPlayerState
public int getPlayerState()Returns the ExoPlayer state if available, or -1 if the player is null.- Returns:
- the player state
- See Also:
-
Player.getPlaybackState()
-
setDebugListener
-
setCaptionListener
-
setMetadataListener
-
getMetadataListener
-
getId3MetadataListener
-
setMetadataListener
@Deprecated public void setMetadataListener(ExoPlayerVideoDisplayComponent.Id3MetadataListener listener) Deprecated.UsesetMetadataListener(Id3MetadataListener)
instead- Parameters:
listener
- the listener
-
setInternalErrorListener
public void setInternalErrorListener(ExoPlayerVideoDisplayComponent.InternalErrorListener internalErrorListener) -
setTextInformationFrameListener
Description copied from class:VideoDisplayComponent
Sets the Text Information Frame Listener.TextInformationFrameListener.onTextInformationFrame(TextInformationFrame, long)
will be called when the player finds an ID3 Metadata of typeTextInformationFrame
in the Video.Use
TextInformationFrameListener.DISABLED
to disable the listener.- Overrides:
setTextInformationFrameListener
in classVideoDisplayComponent
- Parameters:
listener
- the listener
-
openVideo
Description copied from class:VideoDisplayComponent
Creates, configures, and prepares a new instance of MediaPlayer- Overrides:
openVideo
in classVideoDisplayComponent
- Parameters:
video
- reference to the video to be prepared for the playback.source
- reference to the source to played if any.
-
destroyPlayer
protected void destroyPlayer()Description copied from class:VideoDisplayComponent
Destroys the current player and releases it from memory. This seems wasteful, but helps to mitigate working with the complex state machines that are the MediaPlayer and the SurfaceView- Overrides:
destroyPlayer
in classVideoDisplayComponent
- See Also:
-
MediaPlayer
SurfaceView
-
getPlaybackLooper
public android.os.Looper getPlaybackLooper() -
getMainHandler
public android.os.Handler getMainHandler() -
getVideoFormat
public com.google.android.exoplayer2.Format getVideoFormat() -
getPeakBitrate
public int getPeakBitrate()Return the peak bitrate. -
setPeakBitrate
public void setPeakBitrate(int peakBitrate) Sets the peak bitrate. Set 0 to set the default bitrate.- Parameters:
peakBitrate
- the peak bitrate
-
setVideoSelectionOverrideCreator
@Deprecated public void setVideoSelectionOverrideCreator(@NonNull SelectionOverrideCreator videoSelectionOverrideCreator) Deprecated.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 thesetPeakBitrate(int)
is set.If you want to disable the default SelectionOverride, you may pass
SelectionOverrideCreator.EMPTY
, which returnsSelectionOverrideCreator.EMPTY_SELECTION_OVERRIDE
and gets ignored when attempting to apply it to theDefaultTrackSelector
. -
setVideoTrackSelectionOverrideCreator
public void setVideoTrackSelectionOverrideCreator(@NonNull TrackSelectionOverrideCreator videoTrackSelectionOverrideCreator) Provides a creator for a
TrackSelectionOverrides.TrackSelectionOverride
instance specific for the Video track. This TrackSelectionOverride is applied every time a new video is loaded, and when thesetPeakBitrate(int)
is set.If you want to disable the default TrackSelectionOverride, you may pass
TrackSelectionOverrideCreator.EMPTY
, which returnsTrackSelectionOverrideCreator.EMPTY_TRACK_SELECTION_OVERRIDES
and gets ignored when attempting to apply it to theDefaultTrackSelector
. -
getBandwidthMeter
public com.google.android.exoplayer2.upstream.BandwidthMeter getBandwidthMeter()Returns the current bandwidth meter. If null, a default bandwidth meter will be used. -
setBandwidthMeter
public void setBandwidthMeter(com.google.android.exoplayer2.upstream.BandwidthMeter bandwidthMeter) Sets the current bandwidth meter. -
getDataSourceFactory
@NonNull public com.google.android.exoplayer2.upstream.HttpDataSource.Factory getDataSourceFactory()Returns the currentHttpDataSource.Factory
, which is used when creating theMediaSource
. -
setDataSourceFactory
public void setDataSourceFactory(@NonNull com.google.android.exoplayer2.upstream.HttpDataSource.Factory httpDataSourceFactory) Sets theHttpDataSource.Factory
, which is used when creating theMediaSource
. WARNING: When creating a customized HttpDataSource.Factory, you must make sure to use the default user agentC.HTTP_USER_AGENT
to avoid losing Brightcove Analytics and Delivery Rules support.- Parameters:
httpDataSourceFactory
- the http data source factory
-
getMinBufferDurationToSwitchUp
Deprecated.It is not longer used for ExoPlayer v2.Returns the minimum duration of media that needs to be buffered for a switch to a higher quality variant to be considered. -
setMinBufferDurationToSwitchUp
Deprecated.It is not longer used for ExoPlayer v2.Sets the minimum duration of media that needs to be buffered for a switch to a higher quality variant to be considered. -
getMaxBufferDurationToSwitchDown
Deprecated.It is not longer used for ExoPlayer v2.Returns the maximum duration of media that needs to be buffered for a switch to a lower quality variant to be considered. -
setMaxBufferDurationToSwitchDown
Deprecated.It is not longer used for ExoPlayer v2.Sets the maximum duration of media that needs to be buffered for a switch to a lower quality variant to be considered. -
getMinBufferMs
Deprecated.It is not longer used for ExoPlayer v2.Returns the minimum duration of data that must be buffered for playback to start or resume following a user action such as a seek. -
setMinBufferMs
Deprecated.It is not longer used for ExoPlayer v2.Sets the minimum duration of data that must be buffered for playback to start or resume following a user action such as a seek. -
getMinRebufferMs
Deprecated.It is not longer used for ExoPlayer v2. Use UsegetLoadControlConfig()
-
setMinRebufferMs
Deprecated.It is not longer used for ExoPlayer v2. UsesetLoadControlConfig(LoadControlConfig)
-
getLoadControlConfig
Gets the LoadControlConfig object.- Returns:
- the load control config
-
setLoadControlConfig
Sets the LoadControlConfig object.This object is used to create a
LoadControl
instance. TheLoadControl
is used when creating an instance of the ExoPlayer.- Parameters:
loadControlConfig
- the load control config
-
surfaceCreated
public void surfaceCreated(android.view.SurfaceHolder surfaceHolder) - Overrides:
surfaceCreated
in classVideoDisplayComponent
-
surfaceChanged
public void surfaceChanged(android.view.SurfaceHolder surfaceHolder, int format, int w, int h) - Overrides:
surfaceChanged
in classVideoDisplayComponent
-
surfaceDestroyed
public void surfaceDestroyed(android.view.SurfaceHolder surfaceHolder) - Overrides:
surfaceDestroyed
in classVideoDisplayComponent
-
isCurrentMediaAudioOnly
public boolean isCurrentMediaAudioOnly()- Overrides:
isCurrentMediaAudioOnly
in classVideoDisplayComponent
-
getVideoDisplayProperties
-
setVideoDisplayProperties
-
getAllowHlsChunklessPreparation
public boolean getAllowHlsChunklessPreparation()- Returns:
- Whether to allow HLS chunkless preparation in ExoPlayer
-
setAllowHlsChunklessPreparation
public void setAllowHlsChunklessPreparation(boolean allowHlsChunklessPreparation) The value of this field in the HlsMediaSource defaults to true in ExoPlayer 2.17.0 Override it here to false if your HLS delivery includes 608/708 captions -
getUseDrmSessionsForClearContent
public boolean getUseDrmSessionsForClearContent()- Returns:
- Whether to use the DRM session with clear content sections in the media (e.g. for DRM content with clear stitched-in ads)
-
setUseDrmSessionsForClearContent
public void setUseDrmSessionsForClearContent(boolean useDrmSessionsForClearContent) Whether to use the DRM session with clear content sections in the media (e.g. for DRM content with clear stitched-in ads) -
getDefaultRenderersFactory
@Nullable public com.google.android.exoplayer2.DefaultRenderersFactory getDefaultRenderersFactory()Gets the DefaultRenderersFactory object.- Returns:
- the DefaultRenderersFactory
- See Also:
-
DefaultRenderersFactory
-
setDefaultRenderersFactory
public void setDefaultRenderersFactory(@NonNull com.google.android.exoplayer2.DefaultRenderersFactory defaultRenderersFactory)
-
ExoPlayerVideoDisplayComponent.MetadataListener
instead.