setSurface

abstract fun setSurface(surface: Surface?)

Sets the Surface onto which video will be rendered. The caller is responsible for tracking the lifecycle of the surface, and must clear the surface by calling setSurface(null) if the surface is destroyed.

If the surface is held by a SurfaceHolder then it's recommended to pass it instead to the player to track the lifecycle of the surface automatically.

Persists across playback sessions.


abstract fun setSurface(surfaceHolder: SurfaceHolder?)

Sets the SurfaceHolder that holds the Surface onto which video will be rendered. The player tracks the life cycle of the surface automatically.

Persists across playback sessions.