TimeBar
@UnstableApi
interface TimeBar
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 |
|---|
interface TimeBar.OnScrubListenerListener for scrubbing events. |
Public functions |
|
|---|---|
Unit |
addListener(listener: TimeBar.OnScrubListener!)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 |
removeListener(listener: TimeBar.OnScrubListener!)Removes a listener for scrubbing events. |
Unit |
setAdGroupTimesMs(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 |
setKeyCountIncrement(count: Int)Sets the position increment for key presses and accessibility actions, as a number of increments that divide the duration of the media. |
Unit |
setKeyTimeIncrement(time: Long)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<Long>?,
playedAdGroups: BooleanArray<Boolean>?,
adGroupCount: Int
): Unit
Sets the times of ad groups and whether each ad group has been played.
| Parameters | |
|---|---|
adGroupTimesMs: LongArray<Long>? |
An array where the first |
playedAdGroups: BooleanArray<Boolean>? |
An array where the first |
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. |
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. |