@UnstableApi
public interface TimeBar

Known direct subclasses
DefaultTimeBar

A time bar that shows a current position, buffered position, duration and ad markers.


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.

Summary

Nested types

public interface TimeBar.OnScrubListener

Listener for scrubbing events.

Public methods

abstract void

Adds a listener for scrubbing events.

abstract long

Returns the preferred delay in milliseconds of media time after which the time bar position should be updated.

abstract void

Removes a listener for scrubbing events.

abstract void
setAdGroupTimesMs(
    @Nullable long[] adGroupTimesMs,
    @Nullable boolean[] playedAdGroups,
    int adGroupCount
)

Sets the times of ad groups and whether each ad group has been played.

abstract void
setBufferedPosition(long bufferedPosition)

Sets the buffered position.

abstract void
setDuration(long duration)

Sets the duration.

abstract void
setEnabled(boolean enabled)
abstract void

Sets the position increment for key presses and accessibility actions, as a number of increments that divide the duration of the media.

abstract void

Sets the position increment for key presses and accessibility actions, in milliseconds.

abstract void
setPosition(long position)

Sets the current position.

Public methods

addListener

abstract void addListener(TimeBar.OnScrubListener listener)

Adds a listener for scrubbing events.

Parameters
TimeBar.OnScrubListener listener

The listener to add.

getPreferredUpdateDelay

abstract long getPreferredUpdateDelay()

Returns the preferred delay in milliseconds of media time after which the time bar position should be updated.

Returns
long

Preferred delay, in milliseconds of media time.

removeListener

abstract void removeListener(TimeBar.OnScrubListener listener)

Removes a listener for scrubbing events.

Parameters
TimeBar.OnScrubListener listener

The listener to remove.

setAdGroupTimesMs

abstract 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
@Nullable long[] 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.

@Nullable boolean[] 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.

int adGroupCount

The number of ad groups.

setBufferedPosition

abstract void setBufferedPosition(long bufferedPosition)

Sets the buffered position.

Parameters
long bufferedPosition

The current buffered position to show, in milliseconds.

setDuration

abstract void setDuration(long duration)

Sets the duration.

Parameters
long duration

The duration to show, in milliseconds.

setEnabled

abstract void setEnabled(boolean enabled)
See also
isEnabled

setKeyCountIncrement

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

Parameters
int count

The number of increments that divide the duration of the media.

setKeyTimeIncrement

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

Parameters
long time

The time increment, in milliseconds.

setPosition

abstract void setPosition(long position)

Sets the current position.

Parameters
long position

The current position to show, in milliseconds.