TouchTrackViewModel

class TouchTrackViewModel(    mediaDuration: LiveData<Duration>,     isSeekActionSupported: LiveData<Boolean>,     viewModelCoroutineScope: CoroutineScope,     launchSeekAction: (SeekAction) -> Unit)

View model for a touch track control used in MediaPlaybackViewModel.

Contains callbacks to support touch and tracking controls. Can be used with a TtSmoothSeekBar.

When mediaDuration is available and seeking is currently supported for the media being played, isSeekingAvailable will be true, signaling that it is possible for the user to seek.

Parameters

mediaDuration

The media duration. Duration.ZERO if unknown or unavailable.

isSeekActionSupported

A LiveData set to true when SeekAction is made available by current media source, and set to false otherwise.

viewModelCoroutineScope

The ViewModel CoroutineScope.

launchSeekAction

Callback for launching a SeekAction with the new position.

Constructors

Link copied to clipboard
fun TouchTrackViewModel(    mediaDuration: LiveData<Duration>,     isSeekActionSupported: LiveData<Boolean>,     viewModelCoroutineScope: CoroutineScope,     launchSeekAction: (SeekAction) -> Unit)

Properties

Link copied to clipboard
val isSeekingAvailable: LiveData<Boolean>

Set to true if seeking is available, otherwise it is set to false.

Link copied to clipboard
val onProgressChanged: (Double) -> Unit

Called when the progress level has changed due to a user interaction. The progress value is provided as a fraction in range 0.0, 1.0.

Functions

Link copied to clipboard
fun onStartTrackingTouch()

Called when the user starts tracking.

Link copied to clipboard
fun onStopTrackingTouch()

Called when the user stops tracking the seekbar.