-
public interface MediaPlayback<Player>
Plays media using the specified player.
-
-
Method Summary
Modifier and Type Method Description abstract Player
getPlayer()
Get the player used for media playback. abstract Video
getCurrentVideo()
Get the currently playing video. abstract Source
getCurrentSource()
Get the current source for the Video. abstract void
setVideoSource(Video video, Source source)
Sets the video source that will be used for playback. abstract boolean
isPlayingAudioOnly()
Check if the player is currently playing and the media is audio-only. abstract Analytics
getAnalytics()
Returns the analytics component, the part of the player that monitors andtracks video playback and engagement. abstract DefaultSourceSelectionController
getSourceController()
The source selector which uses a delegate to select sources. abstract 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. abstract PlaybackNotification
getNotification()
Get the object which handles showing an on-going player notification. abstract void
openVideo(Video video, Source source)
Creates, configures, and prepares a new instance of MediaPlayback abstract void
destroyPlayer()
Destroys the current player and releases it from memory. abstract List<Video>
getPlaylist()
Returns a immutable copy of the video list. abstract boolean
isPlaying()
abstract void
add(Video video)
Adds the video to the end of the video list. abstract void
add(int index, Video video)
Adds the video to the video list at the specified index. abstract void
addAll(Collection<Video> videos)
Add all videos in the collection to the end of the list. abstract void
addAll(int index, Collection<Video> videos)
Inserts all videos in the collection at the specified index. void
replace(int index, Video video)
Removes and replaces the video at the specified index. abstract Video
setVideoPath(String path)
Replaces player content with the video at the specified path. abstract Video
setVideoPath(String videoPath, Map<String, String> languageCodeCaptionsMap)
Replace player content with the video and captions at the specified paths. abstract Video
getVideoAt(int index)
Gets a video from the video list at the specified index abstract int
getCurrentIndex()
Gets the index from the current video abstract void
setCurrentIndex(int index)
Sets the current video to the specified index. abstract void
remove(int index)
Removes the video at the specified index. abstract void
clear()
Removes all videos from the list. abstract int
getBufferPercentage()
Returns the buffer percentage abstract float
getVolume()
abstract boolean
isSourceSet()
Returns if a source has been set abstract boolean
hasDvr()
Indicates if the current stream is a live video with DVR. abstract boolean
isLive()
Indicates whether the current stream is a live video. abstract long
getLiveEdge()
Obtains the playhead position of the "live edge". abstract boolean
isInLiveEdge()
Checks the current playhead position with the live edge position and determines if it is within range of the live edge. abstract long
getCurrentPosition()
Returns the current playhead position of the underlying video player. abstract void
setProgressInterval(int progressInterval)
Sets the the interval in milliseconds at which to fire PROGRESS events during playback. abstract void
openCurrentVideoSource()
Prepares the player to play the current video source. abstract void
emitErrorEvent(String message)
Emits an error event with the message passed in the event's properties abstract void
emitErrorEvent(String message, Exception exception)
Emits an error event including the message passedand the exception in the properties abstract boolean
isCurrentVideo360Mode()
Returns true if the video is a 360 video otherwise returns false -
-
Method Detail
-
getCurrentVideo
abstract Video getCurrentVideo()
Get the currently playing video.
-
getCurrentSource
abstract Source getCurrentSource()
Get the current source for the Video.
-
setVideoSource
abstract void setVideoSource(Video video, 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.
-
isPlayingAudioOnly
abstract boolean isPlayingAudioOnly()
Check if the player is currently playing and the media is audio-only.
-
getAnalytics
abstract Analytics getAnalytics()
Returns the analytics component, the part of the player that monitors andtracks video playback and engagement.
-
getSourceController
abstract DefaultSourceSelectionController getSourceController()
The source selector which uses a delegate to select sources.
-
onTaskRemoved
abstract 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
abstract PlaybackNotification getNotification()
Get the object which handles showing an on-going player notification.
-
openVideo
abstract void openVideo(Video video, 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.
-
destroyPlayer
abstract void destroyPlayer()
Destroys the current player and releases it from memory.This helps to manage working with the complex state machines that are the MediaPlayer andthe SurfaceView
-
getPlaylist
abstract List<Video> getPlaylist()
Returns a immutable copy of the video list.
-
isPlaying
abstract boolean isPlaying()
-
add
abstract void add(int index, Video video)
Adds the video to the video list at the specified index.
-
addAll
abstract void addAll(Collection<Video> videos)
Add all videos in the collection to the end of the list.
- Parameters:
videos
- The videos to append.
-
addAll
abstract void addAll(int index, Collection<Video> videos)
Inserts all videos in the collection at the specified index.
-
replace
void replace(int index, Video video)
Removes and replaces the video at the specified index.
- Parameters:
index
- The index to replace a media item.video
- The video to replace
-
setVideoPath
abstract Video setVideoPath(String path)
Replaces player content with the video at the specified path.
- Parameters:
path
- HTTP path to a video
-
setVideoPath
abstract 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
abstract Video getVideoAt(int index)
Gets a video from the video list at the specified index
-
getCurrentIndex
abstract int getCurrentIndex()
Gets the index from the current video
-
setCurrentIndex
abstract void setCurrentIndex(int index)
Sets the current video to the specified index.
-
remove
abstract void remove(int index)
Removes the video at the specified index.
-
clear
abstract void clear()
Removes all videos from the list.
-
getBufferPercentage
abstract int getBufferPercentage()
Returns the buffer percentage
-
getVolume
abstract float getVolume()
-
isSourceSet
abstract boolean isSourceSet()
Returns if a source has been set
-
hasDvr
abstract boolean hasDvr()
Indicates if the current stream is a live video with DVR.
-
isLive
abstract boolean isLive()
Indicates whether the current stream is a live video.
-
getLiveEdge
abstract long getLiveEdge()
Obtains the playhead position of the "live edge".
-
isInLiveEdge
abstract boolean isInLiveEdge()
Checks the current playhead position with the live edge position and determines if it is within range of the live edge.
-
getCurrentPosition
abstract 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.
-
setProgressInterval
abstract 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
-
openCurrentVideoSource
abstract void openCurrentVideoSource()
Prepares the player to play the current video source.
-
emitErrorEvent
abstract void emitErrorEvent(String message)
Emits an error event with the message passed in the event's properties
-
emitErrorEvent
abstract void emitErrorEvent(String message, Exception exception)
Emits an error event including the message passedand the exception in the properties
-
isCurrentVideo360Mode
abstract boolean isCurrentVideo360Mode()
Returns true if the video is a 360 video otherwise returns false
-
-
-
-