CloudMediaProvider.CloudMediaSurfaceController

public static abstract class CloudMediaProvider.CloudMediaSurfaceController
extends Object

java.lang.Object
   ↳ 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

CloudMediaSurfaceController()

Public methods

abstract void onConfigChange(Bundle config)

Changes the configuration parameters for the CloudMediaSurfaceController.

abstract void onDestroy()

Indicates destruction of this CloudMediaSurfaceController object.

abstract void onMediaPause(int surfaceId)

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

abstract void onMediaPlay(int surfaceId)

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

abstract void onMediaSeekTo(int surfaceId, long timestampMillis)

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

abstract void onPlayerCreate()

Creates any player resource(s) needed for rendering.

abstract void onPlayerRelease()

Releases any player resource(s) used for rendering.

abstract void onSurfaceChanged(int surfaceId, int format, int width, int height)

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

abstract void onSurfaceCreated(int surfaceId, Surface surface, String mediaId)

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

abstract void onSurfaceDestroyed(int surfaceId)

Indicates destruction of a Surface with given surfaceId.

Inherited methods

Public constructors

CloudMediaSurfaceController

Added in API level 33
Also in R Extensions 3
public CloudMediaSurfaceController ()

Public methods

onConfigChange

Added in API level 33
Also in R Extensions 3
public abstract void onConfigChange (Bundle config)

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

Added in API level 33
Also in R Extensions 3
public abstract void onDestroy ()

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

Added in API level 33
Also in R Extensions 3
public abstract void onMediaPause (int surfaceId)

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

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

onMediaPlay

Added in API level 33
Also in R Extensions 3
public abstract void onMediaPlay (int surfaceId)

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

Added in API level 33
Also in R Extensions 3
public abstract void onMediaSeekTo (int surfaceId, 
                long timestampMillis)

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

Added in API level 33
Also in R Extensions 3
public abstract void onPlayerCreate ()

Creates any player resource(s) needed for rendering.

onPlayerRelease

Added in API level 33
Also in R Extensions 3
public abstract void onPlayerRelease ()

Releases any player resource(s) used for rendering.

onSurfaceChanged

Added in API level 33
Also in R Extensions 3
public abstract void onSurfaceChanged (int surfaceId, 
                int format, 
                int width, 
                int height)

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

This method is always called at least once, after onSurfaceCreated(int, Surface, String).

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

onSurfaceCreated

Added in API level 33
Also in R Extensions 3
public abstract void onSurfaceCreated (int surfaceId, 
                Surface surface, 
                String mediaId)

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.

onSurfaceDestroyed

Added in API level 33
Also in R Extensions 3
public abstract void onSurfaceDestroyed (int surfaceId)

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