-
- All Implemented Interfaces:
-
com.brightcove.player.event.Component
@Emits(events = {EventType.BUFFERED_UPDATE, EventType.COMPLETED, EventType.DID_INTERRUPT_CONTENT, EventType.DID_PAUSE, EventType.DID_PLAY, EventType.DID_RESUME_CONTENT, EventType.DID_SEEK_TO, EventType.DID_SET_SOURCE, EventType.DID_STOP, EventType.ERROR, EventType.PAUSE, EventType.PLAY, EventType.PROGRESS, EventType.SOURCE_NOT_PLAYABLE, EventType.STOP, EventType.VIDEO_DURATION_CHANGED, EventType.VIDEO_SIZE_KNOWN, EventType.WILL_CHANGE_VIDEO, EventType.READY_TO_PLAY})@ListensFor(events = {EventType.COMPLETED, EventType.DID_SET_SOURCE, EventType.PAUSE, EventType.PLAY, EventType.PREBUFFER_NEXT_VIDEO, EventType.SEEK_TO, EventType.SET_SOURCE, EventType.STOP, EventType.VIDEO_DURATION_CHANGED, EventType.WILL_CHANGE_VIDEO, EventType.WILL_INTERRUPT_CONTENT, EventType.WILL_RESUME_CONTENT, EventType.READY_TO_PLAY, EventType.SET_VOLUME, EventType.DID_SET_VIDEO, EventType.ON_FRAME_AVAILABLE, EventType.DID_SEEK_TO}) public class VideoDisplayComponent extends AbstractComponent
The VideoDisplayComponent wraps the Brightcove EventEmitter around the lifecycle of the standard Android MediaPlayer API. The intended goal is that the end developer should never have to interact directly with the MediaPlayer instance, but rather only have to fire events at it via the EventEmitter.LifeCycleTo begin playing, the VideoDisplayComponent (VDC) must first receive a EventType.SET_SOURCE event, containing a valid Source parameter. Once the source is set, the VDC will emit EventType.DID_SET_SOURCE.Once set, the the VDC will respond to the following events:
- EventType.PLAY: plays the video / resumes playback if paused
- EventType.PAUSE: pauses the video
- EventType.SEEK_TO: seeks to the position
- EventType.STOP: stops the video and destroys the player
-
-
Field Summary
Fields Modifier and Type Field Description protected RenderView
renderView
protected int
progressInterval
protected boolean
shouldPlayAudioOnlyInBackground
-
Constructor Summary
Constructors Constructor Description VideoDisplayComponent(RenderView renderView, EventEmitter eventEmitter)
-
Method Summary
Modifier and Type Method Description RenderView
getRenderView()
void
setProgressInterval(int progressInterval)
Sets the the interval in milliseconds at which to fire PROGRESS events during playback. void
setShouldPlayAudioOnlyInBackground(boolean play)
Video
getCurrentVideo()
Gets reference to the video that is currently configured for playback, if any Source
getCurrentSource()
Gets reference to the video source that is currently configured for playback, if any Video
getCurrentVideoOrFail()
Gets reference to the video that is currently configured for playback, if any Source
getCurrentSourceOrFail()
Gets reference to the video source that is currently configured for playback, if any void
setRendererConfig(RendererConfig rendererConfig)
MediaPlayback<out Object>
createPlayback()
Create the MediaPlayback for the VideoDisplayComponent. boolean
hasDvr()
Indicates if Live with DVR is supported. boolean
isLive()
Provides a default for handling live videos. int
getLiveEdge()
Obtains the playhead position of the "live edge". long
getLiveEdgeLong()
Obtains the playhead position of the "live edge". boolean
isInLiveEdge()
Checks the current playhead position with the live edge position and determines if it is in live edge. long
getPlayerCurrentPosition()
Returns the current playhead position of the underlying video player. Analytics
getAnalytics()
MediaPlayer
getMediaPlayer()
void
surfaceCreated(SurfaceHolder surfaceHolder)
void
surfaceChanged(SurfaceHolder surfaceHolder, int format, int width, int height)
void
surfaceDestroyed(SurfaceHolder surfaceHolder)
void
onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height)
void
onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int width, int height)
void
onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture)
void
onSurfaceTextureUpdated(SurfaceTexture surfaceTexture)
boolean
isCurrentVideo360Mode()
boolean
shouldPlayAudioOnlyInBackground()
boolean
isCurrentMediaAudioOnly()
void
setTextInformationFrameListener(@NonNull() TextInformationFrameListener listener)
Sets the Text Information Frame Listener. -
-
Constructor Detail
-
VideoDisplayComponent
VideoDisplayComponent(RenderView renderView, EventEmitter eventEmitter)
-
-
Method Detail
-
getRenderView
RenderView getRenderView()
-
setProgressInterval
void setProgressInterval(int progressInterval)
Sets the the interval in milliseconds at which to fire PROGRESS events during playback. The default is 500ms.
- Parameters:
progressInterval
- the PROGRESS interval in milliseconds
-
setShouldPlayAudioOnlyInBackground
void setShouldPlayAudioOnlyInBackground(boolean play)
-
getCurrentVideo
@Nullable() Video getCurrentVideo()
Gets reference to the video that is currently configured for playback, if any
-
getCurrentSource
@Nullable() Source getCurrentSource()
Gets reference to the video source that is currently configured for playback, if any
-
getCurrentVideoOrFail
@NonNull() Video getCurrentVideoOrFail()
Gets reference to the video that is currently configured for playback, if any
-
getCurrentSourceOrFail
@NonNull() Source getCurrentSourceOrFail()
Gets reference to the video source that is currently configured for playback, if any
-
setRendererConfig
void setRendererConfig(RendererConfig rendererConfig)
-
createPlayback
MediaPlayback<out Object> createPlayback()
Create the MediaPlayback for the VideoDisplayComponent.
-
hasDvr
boolean hasDvr()
Indicates if Live with DVR is supported. Subclasses will override if live with DVR videos are supported.
-
isLive
boolean isLive()
Provides a default for handling live videos. Subclasses will override if live videos are supported.
-
getLiveEdge
@Deprecated() int getLiveEdge()
Obtains the playhead position of the "live edge".
-
getLiveEdgeLong
long getLiveEdgeLong()
Obtains the playhead position of the "live edge".
-
isInLiveEdge
boolean isInLiveEdge()
Checks the current playhead position with the live edge position and determines if it is in live edge.
-
getPlayerCurrentPosition
long getPlayerCurrentPosition()
Returns the current playhead position of the underlying video player.
If the player has not been set or initialized, TIME_UNSET will returned.
-
getAnalytics
Analytics getAnalytics()
-
getMediaPlayer
MediaPlayer getMediaPlayer()
-
surfaceCreated
void surfaceCreated(SurfaceHolder surfaceHolder)
-
surfaceChanged
void surfaceChanged(SurfaceHolder surfaceHolder, int format, int width, int height)
-
surfaceDestroyed
void surfaceDestroyed(SurfaceHolder surfaceHolder)
-
onSurfaceTextureAvailable
void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height)
-
onSurfaceTextureSizeChanged
void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int width, int height)
-
onSurfaceTextureDestroyed
void onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture)
-
onSurfaceTextureUpdated
void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture)
-
isCurrentVideo360Mode
boolean isCurrentVideo360Mode()
-
shouldPlayAudioOnlyInBackground
boolean shouldPlayAudioOnlyInBackground()
-
isCurrentMediaAudioOnly
boolean isCurrentMediaAudioOnly()
-
setTextInformationFrameListener
void setTextInformationFrameListener(@NonNull() TextInformationFrameListener listener)
Sets the Text Information Frame Listener.
onTextInformationFrame will be calledwhen the player finds an ID3 Metadata of type TextInformationFrame in the Video.
Use DISABLED to disable the listener.
- Parameters:
listener
- the listener
-
-
-
-