ApiVideoPlayerController

class ApiVideoPlayerController(context: Context, initialVideoOptions: VideoOptions? = null, initialAutoplay: Boolean = false, listener: ApiVideoPlayerController.Listener? = null, looper: Looper = Looper.myLooper() ?: Looper.getMainLooper(), notificationController: ApiVideoPlayerNotificationController? = ApiVideoPlayerNotificationController( context ))

The api.video player controller class.

Parameters

context

the application context

initialVideoOptions

initial video options

initialAutoplay

initial autoplay: true to play the video immediately, false otherwise

listener

a ApiVideoPlayerController.Listener to listen to player events

looper

the looper where call to the player are executed. By default, it is the current looper or the main looper.

Constructors

Link copied to clipboard
constructor(context: Context, initialVideoOptions: VideoOptions? = null, initialAutoplay: Boolean = false, listener: ApiVideoPlayerController.Listener? = null, playerView: ApiVideoExoPlayerView, looper: Looper = Looper.myLooper() ?: Looper.getMainLooper(), notificationController: ApiVideoPlayerNotificationController? = ApiVideoPlayerNotificationController( context ))

Creates a new controller with an ApiVideoExoPlayerView.

constructor(context: Context, initialVideoOptions: VideoOptions? = null, initialAutoplay: Boolean = false, listener: ApiVideoPlayerController.Listener? = null, playerView: PlayerView, looper: Looper = Looper.myLooper() ?: Looper.getMainLooper(), notificationController: ApiVideoPlayerNotificationController? = ApiVideoPlayerNotificationController( context ))

Creates a new controller with a media3 PlayerView.

constructor(context: Context, initialVideoOptions: VideoOptions? = null, initialAutoplay: Boolean = false, listener: ApiVideoPlayerController.Listener? = null, surfaceView: SurfaceView, looper: Looper = Looper.myLooper() ?: Looper.getMainLooper(), notificationController: ApiVideoPlayerNotificationController? = ApiVideoPlayerNotificationController( context ))

Creates a new controller with a SurfaceView.

constructor(context: Context, initialVideoOptions: VideoOptions? = null, initialAutoplay: Boolean = false, listener: ApiVideoPlayerController.Listener? = null, surface: Surface, looper: Looper = Looper.myLooper() ?: Looper.getMainLooper(), notificationController: ApiVideoPlayerNotificationController? = ApiVideoPlayerNotificationController( context ))

Creates a new controller with a Surface.

constructor(context: Context, initialVideoOptions: VideoOptions? = null, initialAutoplay: Boolean = false, listener: ApiVideoPlayerController.Listener? = null, looper: Looper = Looper.myLooper() ?: Looper.getMainLooper(), notificationController: ApiVideoPlayerNotificationController? = ApiVideoPlayerNotificationController( context ))

Creates a new controller without a view.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
interface Listener

Listener for player events

Properties

Link copied to clipboard

Gets/Sets the autoplay state

Link copied to clipboard

Gets/sets the current video position in seconds

Link copied to clipboard

Gets/sets the video duration in seconds

Link copied to clipboard

Gets if the current playing video is a live stream

Link copied to clipboard

Gets/Sets the looping state

Link copied to clipboard

Mutes/unmutes the device

Link copied to clipboard

Gets if player is playing

Link copied to clipboard
Link copied to clipboard

Set/get the video options.

Link copied to clipboard

Gets the video size

Link copied to clipboard

Gets/Sets the audio volume

Functions

Link copied to clipboard

Add a listener to the player

Link copied to clipboard
fun pause()

Pauses the video

Link copied to clipboard
fun play()

Plays the video

Link copied to clipboard
fun release()

Releases the player

Link copied to clipboard

Remove a listener

Link copied to clipboard
fun seek(offset: Float)

Sets the video position to a time in milliseconds from the current time.

Link copied to clipboard
fun setPlayerView(playerView: PlayerView)
fun setPlayerView(view: ApiVideoExoPlayerView): <Error class: unknown class>

Sets the player view

Link copied to clipboard
fun setSurface(surface: Surface)

Sets the player view

Link copied to clipboard
fun setSurfaceView(surfaceView: SurfaceView)

Sets the player view

Link copied to clipboard
fun stop()

Stops the video

Link copied to clipboard
fun switchTargetView(oldPlayerView: PlayerView, newPlayerView: PlayerView)
fun switchTargetView(oldPlayerView: ApiVideoExoPlayerView, newPlayerView: ApiVideoExoPlayerView): <Error class: unknown class>