-
- All Implemented Interfaces:
-
com.brightcove.player.event.Component
,com.brightcove.player.playback.MediaPlayback
@Emits(events = {EventType.BUFFERED_UPDATE, EventType.COMPLETED, EventType.DID_SET_SOURCE, EventType.DID_CHANGE_LIST, EventType.DID_PLAY, EventType.DID_INTERRUPT_CONTENT, EventType.DID_RESUME_CONTENT, EventType.DID_PAUSE, EventType.DID_STOP, EventType.DID_SEEK_TO, EventType.DID_SELECT_SOURCE, EventType.ERROR, EventType.PLAY, EventType.PREBUFFER_NEXT_VIDEO, EventType.PROGRESS, EventType.SELECT_SOURCE, EventType.SET_SOURCE, EventType.SET_VIDEO, EventType.SOURCE_NOT_PLAYABLE, EventType.SOURCE_NOT_PLAYABLE, EventType.VIDEO_SIZE_KNOWN, EventType.VIDEO_DURATION_CHANGED, EventType.WILL_CHANGE_VIDEO})@ListensFor(events = {EventType.BUFFERED_UPDATE, EventType.COMPLETED, EventType.DID_PLAY, EventType.DID_SET_SOURCE, EventType.ON_FRAME_AVAILABLE, EventType.PLAY, EventType.PAUSE, EventType.PREBUFFER_NEXT_VIDEO, EventType.READY_TO_PLAY, EventType.STOP, EventType.SEEK_TO, EventType.SET_SOURCE, EventType.SET_VOLUME, EventType.VIDEO_DURATION_CHANGED, EventType.WILL_CHANGE_VIDEO, EventType.WILL_INTERRUPT_CONTENT, EventType.WILL_RESUME_CONTENT})@RestrictTo(value = RestrictTo.Scope.LIBRARY) public class MediaPlayerPlayback extends AbstractComponent implements MediaPlayback<MediaPlayer>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
MediaPlayerPlayback.OnSetSourceListener
-
Field Summary
Fields Modifier and Type Field Description private final DefaultSourceSelectionController
sourceController
private Analytics
analytics
protected int
progressInterval
private Video
currentVideo
private Source
currentSource
private final List<Video>
playlist
private int
currentIndex
public boolean
isPlayingForTesting
public final MediaPlayer.OnPreparedListener
onPreparedListener
public final MediaPlayer.OnErrorListener
onErrorListener
public final MediaPlayer.OnBufferingUpdateListener
onBufferingUpdateListener
public final MediaPlayer.OnCompletionListener
onCompletionListener
public final MediaPlayer.OnSeekCompleteListener
onSeekCompleteListener
public final MediaPlayer.OnInfoListener
onInfoListener
-
Constructor Summary
Constructors Constructor Description MediaPlayerPlayback(RenderView renderView, Context context, EventEmitter eventEmitter)
-
Method Summary
Modifier and Type Method Description DefaultSourceSelectionController
getSourceController()
The source selector which uses a delegate to select sources. Analytics
getAnalytics()
Returns the analytics component, the part of the player that monitors andtracks video playback and engagement. void
setProgressInterval(int progressInterval)
Sets the the interval in milliseconds at which to fire PROGRESS events during playback. Video
getCurrentVideo()
Get the currently playing video. Source
getCurrentSource()
Get the current source for the Video. List<Video>
getPlaylist()
Returns a immutable copy of the video list. int
getCurrentIndex()
Gets the index from the current video void
setCurrentIndex(int index)
Sets the current video to the specified index. void
openVideo(@NonNull() Video video, @Nullable() Source source)
Creates, configures, and prepares a new instance of MediaPlayback void
openCurrentVideoSource()
Prepares the player to play the current video source. void
destroyPlayer()
Destroys the current player and releases it from memory. void
setVideoSource(@Nullable() Video video, @Nullable() Source source)
Sets the video source that will be used for playback. MediaPlayer
getPlayer()
Get the player used for media playback. boolean
isPlayingAudioOnly()
Check if the player is currently playing and the media is audio-only. void
onTaskRemoved(Intent rootIntent)
This is called when the MediaPlaybackService is currentlyrunning and the user has removed a task that comes from the service's application. PlaybackNotification
getNotification()
Get the object which handles showing an on-going player notification. boolean
isPlaying()
boolean
hasDvr()
Indicates if Live with DVR is supported. boolean
isLive()
Provides a default for handling live videos. long
getLiveEdge()
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
getCurrentPosition()
Returns the current playhead position of the underlying video player. void
add(Video video)
Adds the video to the end of the video list. void
add(int index, Video video)
Adds the video to the video list at the specified index. void
addAll(Collection<Video> videos)
Add all videos in the collection to the end of the list. void
addAll(int index, Collection<Video> videos)
Inserts all videos in the collection at the specified index. Video
setVideoPath(String path)
Replaces player content with the video at the specified path. Video
setVideoPath(String videoPath, Map<String, String> languageCodeCaptionsMap)
Replace player content with the video and captions at the specified paths. Video
getVideoAt(int index)
Gets a video from the video list at the specified index void
remove(int index)
Removes the video at the specified index. void
clear()
Removes all videos from the list. int
getBufferPercentage()
Returns the buffer percentage float
getVolume()
boolean
isSourceSet()
Returns if a source has been set boolean
isCurrentVideo360Mode()
Returns true if the video is a 360 video otherwise returns false void
emitErrorEvent(String message)
Emits an error event with the message passed in the event's properties void
emitErrorEvent(String message, Exception exception)
Emits an error event including the message passedand the exception in the properties -
Methods inherited from class com.brightcove.player.event.AbstractComponent
addListener, addOnceListener, getEventEmitter, removeListener, removeListeners
-
Methods inherited from class com.brightcove.player.playback.MediaPlayback
getPlayer, openVideo, replace, setVideoSource
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
MediaPlayerPlayback
MediaPlayerPlayback(RenderView renderView, Context context, EventEmitter eventEmitter)
-
-
Method Detail
-
getSourceController
DefaultSourceSelectionController getSourceController()
The source selector which uses a delegate to select sources.
-
getAnalytics
Analytics getAnalytics()
Returns the analytics component, the part of the player that monitors andtracks video playback and engagement.
-
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
-
getCurrentVideo
Video getCurrentVideo()
Get the currently playing video.
-
getCurrentSource
Source getCurrentSource()
Get the current source for the Video.
-
getPlaylist
List<Video> getPlaylist()
Returns a immutable copy of the video list.
-
getCurrentIndex
int getCurrentIndex()
Gets the index from the current video
-
setCurrentIndex
void setCurrentIndex(int index)
Sets the current video to the specified index.
-
openVideo
void openVideo(@NonNull() Video video, @Nullable() Source source)
Creates, configures, and prepares a new instance of MediaPlayback
- Parameters:
video
- reference to the video to be prepared for the playback.source
- reference to the source to played if any.
-
openCurrentVideoSource
void openCurrentVideoSource()
Prepares the player to play the current video source.
-
destroyPlayer
void destroyPlayer()
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 andthe SurfaceView
-
setVideoSource
void setVideoSource(@Nullable() Video video, @Nullable() Source source)
Sets the video source that will be used for playback.
- Parameters:
video
- reference to the video, if any.source
- reference to the video source, if any.
-
getPlayer
MediaPlayer getPlayer()
Get the player used for media playback.
-
isPlayingAudioOnly
boolean isPlayingAudioOnly()
Check if the player is currently playing and the media is audio-only.
-
onTaskRemoved
void onTaskRemoved(Intent rootIntent)
This is called when the MediaPlaybackService is currentlyrunning and the user has removed a task that comes from the service's application.
- Parameters:
rootIntent
- The original Intent that was used to launch the task that is being removed.
-
getNotification
@Nullable() PlaybackNotification getNotification()
Get the object which handles showing an on-going player notification.
-
isPlaying
boolean isPlaying()
-
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
long getLiveEdge()
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.
-
getCurrentPosition
long getCurrentPosition()
Returns the current playhead position of the underlying video player.
If the player has not been set or initialized, TIME_UNSET will returned.
-
addAll
void addAll(Collection<Video> videos)
Add all videos in the collection to the end of the list.
- Parameters:
videos
- The videos to append.
-
addAll
void addAll(int index, Collection<Video> videos)
Inserts all videos in the collection at the specified index.
-
setVideoPath
Video setVideoPath(String path)
Replaces player content with the video at the specified path.
- Parameters:
path
- HTTP path to a video
-
setVideoPath
Video setVideoPath(String videoPath, Map<String, String> languageCodeCaptionsMap)
Replace player content with the video and captions at the specified paths.
- Parameters:
videoPath
- HTTP path to the videolanguageCodeCaptionsMap
- A map of language code to caption urls.
-
getVideoAt
Video getVideoAt(int index)
Gets a video from the video list at the specified index
-
remove
void remove(int index)
Removes the video at the specified index.
-
clear
void clear()
Removes all videos from the list.
-
getBufferPercentage
int getBufferPercentage()
Returns the buffer percentage
-
getVolume
float getVolume()
-
isSourceSet
boolean isSourceSet()
Returns if a source has been set
-
isCurrentVideo360Mode
boolean isCurrentVideo360Mode()
Returns true if the video is a 360 video otherwise returns false
-
emitErrorEvent
void emitErrorEvent(String message)
Emits an error event with the message passed in the event's properties
-
emitErrorEvent
void emitErrorEvent(String message, Exception exception)
Emits an error event including the message passedand the exception in the properties
-
-
-
-