Interface MediaPlayer
-
- All Implemented Interfaces:
public interface MediaPlayerInterface defining the contract for media player implementations.
This interface provides the essential operations for video playback including content loading, playback control, and lifecycle management. Implementations should handle video rendering, progress tracking, and event emission.
-
-
Method Summary
Modifier and Type Method Description abstract ViewGroupinflate(List<String> urls)Inflates the media player with the provided video URLs and returns the view container. abstract Unitstart()Starts video playback and related tracking components. abstract Unitstop()Stops video playback and pauses related tracking components. abstract Unitdestroy()Destroys the media player and releases all associated resources. abstract Flow<VideoEvent>getMediaPlayerFlow()A Flow that emits VideoEvents during video playback. -
-
Method Detail
-
inflate
abstract ViewGroup inflate(List<String> urls)
Inflates the media player with the provided video URLs and returns the view container.
This method prepares the video player for playback by loading the video content from the provided URLs and creating the necessary view hierarchy.
- Parameters:
urls- List of video URLs to load, typically ordered by preference- Returns:
The ViewGroup containing the inflated media player view
-
start
abstract Unit start()
Starts video playback and related tracking components.
This method initiates video playback and begins emitting relevant events through the mediaPlayerFlow. Should be called after successful inflation.
-
stop
abstract Unit stop()
Stops video playback and pauses related tracking components.
This method pauses video playback and stops emitting playback events. The player remains in a state where it can be resumed with start.
-
destroy
abstract Unit destroy()
Destroys the media player and releases all associated resources.
This method should be called when the media player is no longer needed. After calling destroy, the player instance should not be used again.
-
getMediaPlayerFlow
abstract Flow<VideoEvent> getMediaPlayerFlow()
A Flow that emits VideoEvents during video playback. Events include play, pause, progress updates, quartile milestones, and completion.
-
-
-
-