Package com.amazonaws.ivs.broadcast
Class SurfaceSource
- java.lang.Object
- 
- com.amazonaws.ivs.broadcast.Device
- 
- com.amazonaws.ivs.broadcast.ImageDevice
- 
- com.amazonaws.ivs.broadcast.SurfaceSource
 
 
 
- 
- Direct Known Subclasses:
- CameraSource,- CustomImageSource
 
 public class SurfaceSource extends ImageDevice 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 alsoSession.createImageInputSource()
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class com.amazonaws.ivs.broadcast.ImageDeviceImageDevice.FrameCallback, ImageDevice.Rotation
 - 
Nested classes/interfaces inherited from class com.amazonaws.ivs.broadcast.DeviceDevice.Descriptor
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected android.content.Contextcontextprotected longhandleprotected booleanshouldRotateOnConfigurationChanges
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedSurfaceSource(android.content.Context context, android.view.Surface inputSurface, android.graphics.SurfaceTexture inputSurfaceTexture, android.os.Handler handler, java.lang.String tag, long handle)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Device.DescriptorgetDescriptor()protected longgetHandle()android.view.SurfacegetInputSurface()Retrieving this Surface can be done from any thread, but API calls on the Surface may not be thread safe.ImagePreviewSurfaceTargetgetPreviewSurfaceTarget(BroadcastConfiguration.AspectMode aspectMode)ImagePreviewSurfaceViewgetPreviewSurfaceView(BroadcastConfiguration.AspectMode aspectMode)ImagePreviewViewgetPreviewTextureView(BroadcastConfiguration.AspectMode aspectMode)java.lang.StringgetTag()booleanisValid()voidrotateOnConfigurationChanges(boolean enable)Enables/disables rotations of this ImageDevice when the physical device is rotated.protected voidsetInputSurface(android.view.Surface inputSurface, android.graphics.SurfaceTexture inputSurfaceTexture)voidsetOnFrameCallback(ImageDevice.FrameCallback callback)Set a callback to receive information about image frames as they move through this device.voidsetRotation(float rotation)Sets the rotation of the ImageDevice.voidsetSize(int width, int height)Set the size of the surfacebooleanwillRotateOnConfigurationChanges()- 
Methods inherited from class com.amazonaws.ivs.broadcast.ImageDevicegetPreviewSurfaceTarget, getPreviewSurfaceView, getPreviewTextureView, getPreviewView, getPreviewView, setRotation
 
- 
 
- 
- 
- 
Method Detail- 
getInputSurface@Nullable public android.view.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
 
 - 
setSizepublic void setSize(int width, int height)Set the size of the surface- Parameters:
- width- width in pixels
- height- height in pixels
 
 - 
getDescriptorpublic Device.Descriptor getDescriptor() - Specified by:
- getDescriptorin class- Device
 
 - 
getPreviewTextureViewpublic ImagePreviewView getPreviewTextureView(BroadcastConfiguration.AspectMode aspectMode) - Specified by:
- getPreviewTextureViewin class- ImageDevice
 
 - 
getPreviewSurfaceViewpublic ImagePreviewSurfaceView getPreviewSurfaceView(BroadcastConfiguration.AspectMode aspectMode) - Specified by:
- getPreviewSurfaceViewin class- ImageDevice
 
 - 
getPreviewSurfaceTargetpublic ImagePreviewSurfaceTarget getPreviewSurfaceTarget(BroadcastConfiguration.AspectMode aspectMode) - Specified by:
- getPreviewSurfaceTargetin class- ImageDevice
 
 - 
setOnFrameCallbackpublic void setOnFrameCallback(@Nullable ImageDevice.FrameCallback callback)Description copied from class:ImageDeviceSet a callback to receive information about image frames as they move through this device. This will be called on the main thread.- Specified by:
- setOnFrameCallbackin class- ImageDevice
- Parameters:
- callback- A callback lambda that takes a- ImageDeviceFrame.
 
 - 
setRotationpublic void setRotation(float rotation) Description copied from class:ImageDeviceSets the rotation of the ImageDevice.- Specified by:
- setRotationin class- ImageDevice
- Parameters:
- rotation- Rotation in radians
 
 - 
rotateOnConfigurationChangespublic void rotateOnConfigurationChanges(boolean enable) Description copied from class:ImageDeviceEnables/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.- Specified by:
- rotateOnConfigurationChangesin class- ImageDevice
- Parameters:
- enable- Whether this device should rotate on configuration changes (e.g. when the physical device is rotated).
 
 - 
willRotateOnConfigurationChangespublic boolean willRotateOnConfigurationChanges() - Specified by:
- willRotateOnConfigurationChangesin class- ImageDevice
- Returns:
- Whether this ImageDevice will rotate on configuration changes.
 
 - 
getHandleprotected long getHandle() 
 - 
setInputSurfaceprotected void setInputSurface(@Nullable android.view.Surface inputSurface, @Nullable android.graphics.SurfaceTexture inputSurfaceTexture)
 
- 
 
-