@UnstableApi
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

Listener for scrubbing events.

Public functions

Unit

Adds a listener for scrubbing events.

Long

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

Unit

Removes a listener for scrubbing events.

Unit
setAdGroupTimesMs(
    adGroupTimesMs: LongArray?,
    playedAdGroups: BooleanArray?,
    adGroupCount: Int
)

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

Unit
setBufferedPosition(bufferedPosition: Long)

Sets the buffered position.

Unit
setDuration(duration: Long)

Sets the duration.

Unit
setEnabled(enabled: Boolean)
Unit

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

Unit

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

Unit
setPosition(position: Long)

Sets the current position.

Public functions

addListener

fun addListener(listener: TimeBar.OnScrubListener!): Unit

Adds a listener for scrubbing events.

Parameters
listener: TimeBar.OnScrubListener!

The listener to add.

getPreferredUpdateDelay

fun getPreferredUpdateDelay(): Long

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

fun removeListener(listener: TimeBar.OnScrubListener!): Unit

Removes a listener for scrubbing events.

Parameters
listener: TimeBar.OnScrubListener!

The listener to remove.

setAdGroupTimesMs

fun setAdGroupTimesMs(
    adGroupTimesMs: LongArray?,
    playedAdGroups: BooleanArray?,
    adGroupCount: Int
): Unit

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

Parameters
adGroupTimesMs: LongArray?

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: BooleanArray?

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: Int

The number of ad groups.

setBufferedPosition

fun setBufferedPosition(bufferedPosition: Long): Unit

Sets the buffered position.

Parameters
bufferedPosition: Long

The current buffered position to show, in milliseconds.

setDuration

fun setDuration(duration: Long): Unit

Sets the duration.

Parameters
duration: Long

The duration to show, in milliseconds.

setEnabled

fun setEnabled(enabled: Boolean): Unit
See also
isEnabled

setKeyCountIncrement

fun setKeyCountIncrement(count: Int): Unit

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
count: Int

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

setKeyTimeIncrement

fun setKeyTimeIncrement(time: Long): Unit

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

Clears any increment specified in a preceding call to setKeyCountIncrement.

Parameters
time: Long

The time increment, in milliseconds.

setPosition

fun setPosition(position: Long): Unit

Sets the current position.

Parameters
position: Long

The current position to show, in milliseconds.