@Emits(events={"bufferedUpdate","completed","didInterruptContent","didPause","didPlay","didResumeContent","didSeekTo","didSetSource","didStop","error","pause","play","progress","sourceNotPlayable","stop","videoDurationChanged","videoSizeKnown","willChangeVideo","readyToPlay"}) @ListensFor(events={"completed","didSetSource","pause","play","prebufferNextVideo","seekTo","setSource","stop","videoDurationChanged","willChangeVideo","willInterruptContent","willResumeContent","readyToPlay","setVolume","didSetVideo","on360FrameAvailable","didSeekTo"}) public class VideoDisplayComponent extends AbstractComponent
MediaPlayer
,
Source
,
AbstractComponent
,
EventEmitter
,
EventType
Modifier and Type | Class and Description |
---|---|
protected class |
VideoDisplayComponent.OnSetSourceListener |
protected class |
VideoDisplayComponent.OnWillChangeVideoListener |
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
captionsPath |
protected android.content.Context |
context |
protected long |
fromSeekPosition |
protected boolean |
hasSurface |
protected boolean |
isFrameAvailable |
protected RendererConfig |
mRendererConfig |
protected Source |
nextSource |
protected Video |
nextVideo |
protected static int |
ON_PLAY_SEEK_THRESHOLD |
protected int |
playheadPosition
Deprecated.
|
protected long |
playheadPositionLong |
protected int |
progressInterval |
protected RenderView |
renderView |
protected boolean |
reseeking |
protected long |
seekPosition |
protected java.util.concurrent.ScheduledFuture<?> |
updater |
eventEmitter, listenerTokens
Constructor and Description |
---|
VideoDisplayComponent(RenderView renderView,
EventEmitter eventEmitter) |
Modifier and Type | Method and Description |
---|---|
protected void |
destroyPlayer()
Destroys the current player and releases it from memory.
|
protected void |
emitErrorEvent(java.lang.String message) |
protected void |
emitErrorEvent(java.lang.String message,
java.lang.Exception exception) |
protected void |
emitVideoSize(int width,
int height) |
Analytics |
getAnalytics() |
Source |
getCurrentSource()
Gets reference to the video source that is currently configured for playback, if any
|
Source |
getCurrentSourceOrFail()
Gets reference to the video source that is currently configured for playback, if any
|
Video |
getCurrentVideo()
Gets reference to the video that is currently configured for playback, if any
|
Video |
getCurrentVideoOrFail()
Gets reference to the video that is currently configured for playback, if any
|
protected static java.util.Map<java.lang.String,java.lang.String> |
getHeaders(Video video,
Source source) |
int |
getLiveEdge()
Deprecated.
|
long |
getLiveEdgeLong()
Obtains the playhead position of the "live edge".
|
android.media.MediaPlayer |
getMediaPlayer() |
long |
getPlayerCurrentPosition()
Returns the current playhead position of the underlying video player.
|
RenderView |
getRenderView() |
boolean |
hasDvr()
Indicates if Live with DVR is supported.
|
protected void |
initializeListeners() |
boolean |
isCurrentVideo360Mode() |
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.
|
void |
onSurfaceTextureAvailable(android.graphics.SurfaceTexture surfaceTexture,
int width,
int height) |
void |
onSurfaceTextureDestroyed(android.graphics.SurfaceTexture surfaceTexture) |
void |
onSurfaceTextureSizeChanged(android.graphics.SurfaceTexture surfaceTexture,
int width,
int height) |
void |
onSurfaceTextureUpdated(android.graphics.SurfaceTexture surfaceTexture) |
protected void |
openCurrentVideoSource()
Prepares the player to play the current video source.
|
protected void |
openVideo(Video video,
Source source)
Creates, configures, and prepares a new instance of MediaPlayer
|
void |
setProgressInterval(int progressInterval)
Sets the the interval in milliseconds at which to fire PROGRESS events during playback.
|
void |
setRendererConfig(RendererConfig rendererConfig) |
void |
setTextInformationFrameListener(TextInformationFrameListener listener)
Sets the Text Information Frame Listener.
|
protected void |
setVideoSource(Video video,
Source source)
Sets the video source that will be used for playback.
|
protected void |
startUpdater() |
protected void |
stopUpdater() |
void |
surfaceChanged(android.view.SurfaceHolder surfaceHolder,
int format,
int width,
int height) |
void |
surfaceCreated(android.view.SurfaceHolder surfaceHolder) |
void |
surfaceDestroyed(android.view.SurfaceHolder surfaceHolder) |
addListener, addOnceListener, getEventEmitter, removeListener, removeListeners
protected static final int ON_PLAY_SEEK_THRESHOLD
protected boolean isFrameAvailable
protected RenderView renderView
protected long fromSeekPosition
protected android.content.Context context
protected java.util.concurrent.ScheduledFuture<?> updater
protected boolean hasSurface
protected long seekPosition
protected boolean reseeking
@Deprecated protected int playheadPosition
protected long playheadPositionLong
protected Video nextVideo
protected Source nextSource
protected java.lang.String captionsPath
protected int progressInterval
protected RendererConfig mRendererConfig
public VideoDisplayComponent(RenderView renderView, EventEmitter eventEmitter)
protected void setVideoSource(@Nullable Video video, @Nullable Source source)
video
- reference to the video, if any.source
- reference to the video source, if any.@Nullable public Video getCurrentVideo()
@Nullable public Source getCurrentSource()
@NonNull public Video getCurrentVideoOrFail()
java.lang.IllegalStateException
- if there is no video configured.@NonNull public Source getCurrentSourceOrFail()
java.lang.IllegalStateException
- if there is no source configured.public void setRendererConfig(RendererConfig rendererConfig)
public boolean hasDvr()
TRUE
iff live video with DVR capabilities is supported.public boolean isLive()
TRUE
iff live video is supported.@Deprecated public int getLiveEdge()
public long getLiveEdgeLong()
public boolean isInLiveEdge()
public long getPlayerCurrentPosition()
Constants.TIME_UNSET
will returned.public void setProgressInterval(int progressInterval)
progressInterval
- the PROGRESS interval in millisecondsprotected void initializeListeners()
protected void startUpdater()
protected void stopUpdater()
public Analytics getAnalytics()
public RenderView getRenderView()
public android.media.MediaPlayer getMediaPlayer()
protected void openCurrentVideoSource()
protected void openVideo(@NonNull Video video, @Nullable Source source)
video
- reference to the video to be prepared for the playback.source
- reference to the source to played if any.java.lang.NullPointerException
- if video is null.protected static java.util.Map<java.lang.String,java.lang.String> getHeaders(Video video, Source source)
protected void destroyPlayer()
MediaPlayer
,
SurfaceView
protected void emitVideoSize(int width, int height)
public void surfaceCreated(android.view.SurfaceHolder surfaceHolder)
public void surfaceChanged(android.view.SurfaceHolder surfaceHolder, int format, int width, int height)
public void surfaceDestroyed(android.view.SurfaceHolder surfaceHolder)
public void onSurfaceTextureAvailable(android.graphics.SurfaceTexture surfaceTexture, int width, int height)
public void onSurfaceTextureSizeChanged(android.graphics.SurfaceTexture surfaceTexture, int width, int height)
public void onSurfaceTextureDestroyed(android.graphics.SurfaceTexture surfaceTexture)
public void onSurfaceTextureUpdated(android.graphics.SurfaceTexture surfaceTexture)
protected void emitErrorEvent(java.lang.String message)
protected void emitErrorEvent(java.lang.String message, java.lang.Exception exception)
public boolean isCurrentVideo360Mode()
public void setTextInformationFrameListener(@NonNull TextInformationFrameListener listener)
TextInformationFrameListener.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.listener
- the listener