Interface TimeBar

  • All Known Implementing Classes:
    DefaultTimeBar

    public interface TimeBar
    Interface for time bar views that can display a playback position, buffered position, duration and ad markers, and that have a listener for scrubbing (seeking) events.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  TimeBar.OnScrubListener
      Listener for scrubbing events.
    • Method Detail

      • addListener

        void addListener​(TimeBar.OnScrubListener listener)
        Adds a listener for scrubbing events.
        Parameters:
        listener - The listener to add.
      • removeListener

        void removeListener​(TimeBar.OnScrubListener listener)
        Removes a listener for scrubbing events.
        Parameters:
        listener - The listener to remove.
      • setKeyTimeIncrement

        void setKeyTimeIncrement​(long time)
        Sets the position increment for key presses and accessibility actions, in milliseconds.

        Clears any increment specified in a preceding call to setKeyCountIncrement(int).

        Parameters:
        time - The time increment, in milliseconds.
      • setKeyCountIncrement

        void setKeyCountIncrement​(int count)
        Sets the position increment for key presses and accessibility actions, as a number of increments that divide the duration of the media. For example, passing 20 will cause key presses to increment/decrement the position by 1/20th of the duration (if known).

        Clears any increment specified in a preceding call to setKeyTimeIncrement(long).

        Parameters:
        count - The number of increments that divide the duration of the media.
      • setPosition

        void setPosition​(long position)
        Sets the current position.
        Parameters:
        position - The current position to show, in milliseconds.
      • setBufferedPosition

        void setBufferedPosition​(long bufferedPosition)
        Sets the buffered position.
        Parameters:
        bufferedPosition - The current buffered position to show, in milliseconds.
      • setDuration

        void setDuration​(long duration)
        Sets the duration.
        Parameters:
        duration - The duration to show, in milliseconds.
      • getPreferredUpdateDelay

        long getPreferredUpdateDelay()
        Returns the preferred delay in milliseconds of media time after which the time bar position should be updated.
        Returns:
        Preferred delay, in milliseconds of media time.
      • setAdGroupTimesMs

        void setAdGroupTimesMs​(@Nullable
                               long[] adGroupTimesMs,
                               @Nullable
                               boolean[] playedAdGroups,
                               int adGroupCount)
        Sets the times of ad groups and whether each ad group has been played.
        Parameters:
        adGroupTimesMs - An array where the first adGroupCount elements are the times of ad groups in milliseconds. May be null if there are no ad groups.
        playedAdGroups - An array where the first adGroupCount elements indicate whether the corresponding ad groups have been played. May be null if there are no ad groups.
        adGroupCount - The number of ad groups.