public class

SurfaceSource

extends ImageDevice
java.lang.Object
   ↳ com.amazonaws.ivs.broadcast.Device
     ↳ com.amazonaws.ivs.broadcast.ImageDevice
       ↳ com.amazonaws.ivs.broadcast.SurfaceSource
Known Direct Subclasses

Class Overview

An image source backed by an Android Surface. This may be used with inputs such as a Camera2 producer, OpenGL ES or Vulkan, or a MediaProjection. See also createImageInputSource()

Summary

Fields
protected TypedLambda<Boolean> checkThread
protected Context context
protected long handle
protected boolean shouldRotateOnConfigurationChanges
Protected Constructors
SurfaceSource(Context context, Surface inputSurface, SurfaceTexture inputSurfaceTexture, Handler handler, String tag, long handle)
Public Methods
Device.Descriptor getDescriptor()
Surface getInputSurface()
Retrieving this Surface can be done from any thread, but API calls on the Surface may not be thread safe.
ImagePreviewView getPreviewView()
Gets a ImagePreviewView that will display a preview of this device's contents.
ImagePreviewView getPreviewView(BroadcastConfiguration.AspectMode aspectMode)
String getTag()
boolean isValid()
synchronized void rotateOnConfigurationChanges(boolean enable)
Enables/disables rotations of this ImageDevice when the physical device is rotated.
synchronized void setRotation(float rotation)
Sets the rotation of the ImageDevice.
void setSize(int width, int height)
Set the size of the surface
synchronized boolean willRotateOnConfigurationChanges()
Protected Methods
long getHandle()
[Expand]
Inherited Methods
From class com.amazonaws.ivs.broadcast.ImageDevice
From class com.amazonaws.ivs.broadcast.Device
From class java.lang.Object

Fields

protected TypedLambda<Boolean> checkThread

protected Context context

protected long handle

protected boolean shouldRotateOnConfigurationChanges

Protected Constructors

protected SurfaceSource (Context context, Surface inputSurface, SurfaceTexture inputSurfaceTexture, Handler handler, String tag, long handle)

Public Methods

public Device.Descriptor getDescriptor ()

public Surface getInputSurface ()

Retrieving this Surface can be done from any thread, but API calls on the Surface may not be thread safe.

Returns
  • The input surface to be attached to some image producer such as a camera or opengl context

public ImagePreviewView getPreviewView ()

Gets a ImagePreviewView that will display a preview of this device's contents. Warning: Using many ImagePreviewViews at once may result in performance degradation.

public ImagePreviewView getPreviewView (BroadcastConfiguration.AspectMode aspectMode)

public String getTag ()

public boolean isValid ()

public synchronized void rotateOnConfigurationChanges (boolean enable)

Enables/disables rotations of this ImageDevice when the physical device is rotated. When this is enabled, the image source will be rotated to match configuration changes. This is often useful with camera devices, for example. When this is disabled, the image source will not be rotated to match configuration changes. This is often useful for custom image sources or if the camera ought to be locked to a particular orientation to match the application.

Parameters
enable Whether this device should rotate on configuration changes (e.g. when the physical device is rotated).

public synchronized void setRotation (float rotation)

Sets the rotation of the ImageDevice.

Parameters
rotation Rotation in radians

public void setSize (int width, int height)

Set the size of the surface

Parameters
width width in pixels
height height in pixels

public synchronized boolean willRotateOnConfigurationChanges ()

Returns
  • Whether this ImageDevice will rotate on configuration changes.

Protected Methods

protected long getHandle ()