Playback

class Playback

Methods for audio playback.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

open fun getDuration(@NonNull fileUri: Uri): Integer
Get length of the currently playing file.
Get length of a stream.
open fun getDuration(fileDescriptor: Integer): Integer
Get length of a file.
Link copied to clipboard
Get position in the currently played file.
Link copied to clipboard
Check whether playback is in progress.
Link copied to clipboard
open fun pause()
Pause playback.
Link copied to clipboard
open fun resume()
Resume playback from paused position
Link copied to clipboard
open fun seek(@IntRange(from = 0) position: Int)
Seek to a position.
Link copied to clipboard
open fun setSpeed(@IntRange(from = 1, to = 16) speed: Int)
Set playback speed.
Link copied to clipboard
open fun start(@NonNull fileUri: Uri): Boolean
open fun start(@NonNull stream: InputStream, loop: Boolean): Boolean
open fun start(@NonNull fileDescriptor: Integer, loop: Boolean): Boolean
Start a playback.
Link copied to clipboard
open fun stop()
Stop playback.