Class AbstractPlayerListener

  • All Implemented Interfaces:
    PlayerListener
    Direct Known Subclasses:
    MultiControllerPlaylist

    public abstract class AbstractPlayerListener
    extends Object
    implements PlayerListener
    Abstract implementation of the PlayerListener. All methods of the the PlayerListener are implemented with empty bodies and you can extend this class if you only need to implement a subset of the callbacks. Using this abstract class instead of the interface might also simplify updates of the API.

    *NOTE* that all listener methods are invoked on the UI/main thread of your applications. You can directly interact with UI components from within the implementation of you listener.

    Since:
    1.1.0
    • Constructor Detail

      • AbstractPlayerListener

        public AbstractPlayerListener()
    • Method Detail

      • onSeekTo

        public void onSeekTo​(long newPosition)
        Description copied from interface: PlayerListener
        This callback is invoked when the position of the video playback is actively changed by the PlayerController.
        Specified by:
        onSeekTo in interface PlayerListener
        Parameters:
        newPosition - the new position in microseconds
      • onVideoSizeChanged

        public void onVideoSizeChanged​(int width,
                                       int height,
                                       float pixelWidthHeightRatio)
        Description copied from interface: PlayerListener
        Invoked each time there's a change in the size of the video being rendered.
        Specified by:
        onVideoSizeChanged in interface PlayerListener
        Parameters:
        width - The video width in pixels.
        height - The video height in pixels.
        pixelWidthHeightRatio - The width to height ratio of each pixel. For the normal case of square pixels this will be equal to 1.0. Different values are indicative of anamorphic content.
      • onSeekRangeChanged

        public void onSeekRangeChanged​(long startTimeMs,
                                       long endTimeMs)
        Description copied from interface: PlayerListener
        Event triggered when the seek range changed
        Specified by:
        onSeekRangeChanged in interface PlayerListener
        Parameters:
        startTimeMs - the possible seek start time in milliseconds
        endTimeMs - the possible seek end time in milliseconds
      • onPlaybackPositionChanged

        public void onPlaybackPositionChanged​(long playbackPositionMs)
        Description copied from interface: PlayerListener
        Event triggered when the playback position changed.

        Note that for performance reasons, this is triggered at most once per second, hence you will only see when seconds changing during playback.
        Specified by:
        onPlaybackPositionChanged in interface PlayerListener
        Parameters:
        playbackPositionMs - the current playback position in milliseconds
      • onDisplayChanged

        public void onDisplayChanged​(DisplayInfo displayInfo,
                                     boolean canPlay)
        Description copied from interface: PlayerListener
        Callback triggered when the underlying screen information changes. This is triggered for example when a secondary display is connected. The passed canPlay parameter indicates weather playback can be resumed based on the current display and the secondary display configuration of the player controller (see PlayerController.getSecondaryDisplay()
        Specified by:
        onDisplayChanged in interface PlayerListener
        Parameters:
        displayInfo - the current display information
        canPlay - True if playback can be started or resumed with the current display configuration
      • onDurationChanged

        public void onDurationChanged​(long durationUs)
        Description copied from interface: PlayerListener
        Callback triggered when the stream duration has been refreshed.
        Specified by:
        onDurationChanged in interface PlayerListener
        Parameters:
        durationUs - Duration in microseconds
      • onSpeedChanged

        public void onSpeedChanged​(float speed)
        Description copied from interface: PlayerListener
        Callback triggered when the playback speed is changed.
        Specified by:
        onSpeedChanged in interface PlayerListener
        Parameters:
        speed - Playback speed
      • onFullyBuffered

        public void onFullyBuffered()
        Description copied from interface: PlayerListener
        Invoked when all the remaining content has been buffered. From this point onwards no more network activity is required to finish playing the current media.
        Specified by:
        onFullyBuffered in interface PlayerListener