CloudMediaSurfaceController


abstract class CloudMediaSurfaceController
kotlin.Any
   ↳ android.provider.CloudMediaProvider.CloudMediaSurfaceController

Manages rendering the preview of media items on given instances of Surface.

The methods of this class are meant to be asynchronous, and should not block by performing any heavy operation.

Note that a single CloudMediaSurfaceController instance would be responsible for rendering multiple media items associated with multiple surfaces.

Summary

Public constructors

Public methods
abstract Unit

Changes the configuration parameters for the CloudMediaSurfaceController.

abstract Unit

Indicates destruction of this CloudMediaSurfaceController object.

abstract Unit
onMediaPause(surfaceId: Int)

Pauses the playback of the media associated with the given surface id.

abstract Unit
onMediaPlay(surfaceId: Int)

Start playing the preview of the media associated with the given surface id.

abstract Unit
onMediaSeekTo(surfaceId: Int, timestampMillis: Long)

Seeks the media associated with the given surface id to specified timestamp.

abstract Unit

Creates any player resource(s) needed for rendering.

abstract Unit

Releases any player resource(s) used for rendering.

abstract Unit
onSurfaceChanged(surfaceId: Int, format: Int, width: Int, height: Int)

Indicates structural changes (format or size) in the Surface for rendering.

abstract Unit
onSurfaceCreated(surfaceId: Int, surface: Surface, mediaId: String)

Indicates creation of the given Surface with given surfaceId for rendering the preview of a media item with given mediaId.

abstract Unit
onSurfaceDestroyed(surfaceId: Int)

Indicates destruction of a Surface with given surfaceId.

Public constructors

CloudMediaSurfaceController

CloudMediaSurfaceController()

Public methods

onConfigChange

abstract fun onConfigChange(config: Bundle): Unit

Changes the configuration parameters for the CloudMediaSurfaceController.

Parameters
config Bundle: the updated config to change to. This can include config changes for the following: This value cannot be null.

onDestroy

abstract fun onDestroy(): Unit

Indicates destruction of this CloudMediaSurfaceController object.

This CloudMediaSurfaceController object should no longer be in use after this method has been called.

Note that it is possible for this method to be called directly without onPlayerRelease being called, hence you should release any resources associated with this CloudMediaSurfaceController object, or perform any cleanup required in this method.

onMediaPause

abstract fun onMediaPause(surfaceId: Int): Unit

Pauses the playback of the media associated with the given surface id.

Parameters
surfaceId Int: id which uniquely identifies the Surface for rendering

onMediaPlay

abstract fun onMediaPlay(surfaceId: Int): Unit

Start playing the preview of the media associated with the given surface id. If playback had previously been paused, playback will continue from where it was paused. If playback had been stopped, or never started before, playback will start at the beginning.

Parameters
surfaceId Int: id which uniquely identifies the Surface for rendering

onMediaSeekTo

abstract fun onMediaSeekTo(
    surfaceId: Int,
    timestampMillis: Long
): Unit

Seeks the media associated with the given surface id to specified timestamp.

Parameters
surfaceId Int: id which uniquely identifies the Surface for rendering
timestampMillis Long: the timestamp in milliseconds from the start to seek to Value is a non-negative duration in milliseconds.

onPlayerCreate

abstract fun onPlayerCreate(): Unit

Creates any player resource(s) needed for rendering.

onPlayerRelease

abstract fun onPlayerRelease(): Unit

Releases any player resource(s) used for rendering.

onSurfaceChanged

abstract fun onSurfaceChanged(
    surfaceId: Int,
    format: Int,
    width: Int,
    height: Int
): Unit

Indicates structural changes (format or size) in the Surface for rendering.

This method is always called at least once, after onSurfaceCreated.

Parameters
surfaceId Int: id which uniquely identifies the Surface for rendering
format Int: the new PixelFormat of the surface
width Int: the new width of the Surface
height Int: the new height of the Surface

See Also

    onSurfaceCreated

    abstract fun onSurfaceCreated(
        surfaceId: Int,
        surface: Surface,
        mediaId: String
    ): Unit

    Indicates creation of the given Surface with given surfaceId for rendering the preview of a media item with given mediaId.

    This is called immediately after the surface is first created. Implementations of this should start up whatever rendering code they desire.

    Note that the given media item remains associated with the given surface id till the Surface is destroyed.

    Parameters
    surfaceId Int: id which uniquely identifies the Surface for rendering
    surface Surface: instance of the Surface on which the media item should be rendered This value cannot be null.
    mediaId String: id which uniquely identifies the media to be rendered This value cannot be null.

    See Also

      onSurfaceDestroyed

      abstract fun onSurfaceDestroyed(surfaceId: Int): Unit

      Indicates destruction of a Surface with given surfaceId.

      This is called immediately before a surface is being destroyed. After returning from this call, you should no longer try to access this surface.

      Parameters
      surfaceId Int: id which uniquely identifies the Surface for rendering

      See Also