Interface MediaPlayer

  • All Implemented Interfaces:

    
    public interface MediaPlayer
    
                        

    Interface 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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract ViewGroup inflate(List<String> urls) Inflates the media player with the provided video URLs and returns the view container.
      abstract Unit start() Starts video playback and related tracking components.
      abstract Unit stop() Stops video playback and pauses related tracking components.
      abstract Unit destroy() Destroys the media player and releases all associated resources.
      abstract Flow<VideoEvent> getMediaPlayerFlow() A Flow that emits VideoEvents during video playback.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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.