Package com.amazonaws.ivs.broadcast
Class DeviceDiscovery
- java.lang.Object
-
- com.amazonaws.ivs.broadcast.DeviceDiscovery
-
- All Implemented Interfaces:
Releasable
public class DeviceDiscovery extends java.lang.Object implements Releasable
Use this class to discover local devices, such as microphones or cameras, to attach to the SDK. When you are no longer using any of the devices returned, you must callrelease()to make sure resources are cleaned up properly. Oncerelease()is called, the devices that have been returned may stop working, and are no longer valid for attaching to a Broadcast or Stage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDeviceDiscovery.OnDevicesChangedListenerA listener which notifies when the list of devices changes
-
Constructor Summary
Constructors Constructor Description DeviceDiscovery(android.content.Context context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddOnDevicesChangedListener(DeviceDiscovery.OnDevicesChangedListener listener)Add a listener to be notified about device changesCustomAudioSourcecreateAudioInputSource(int channels, BroadcastConfiguration.AudioSampleRate sampleRate, AudioDevice.Format format)Create an audio input for a custom source.CustomImageSourcecreateImageInputSource(BroadcastConfiguration.Vec2 size)Create an image input for a custom source.protected voidfinalize()java.util.List<Device>listLocalDevices()List available devices for use without attaching to either Stage or Broadcast session.voidrelease()Release the resources associated with this device discovery session.voidremoveOnDevicesChangedListener(DeviceDiscovery.OnDevicesChangedListener listener)Removes a previously added device change listener
-
-
-
Method Detail
-
addOnDevicesChangedListener
public void addOnDevicesChangedListener(@NonNull DeviceDiscovery.OnDevicesChangedListener listener)Add a listener to be notified about device changes- Parameters:
listener- The listener to add
-
removeOnDevicesChangedListener
public void removeOnDevicesChangedListener(@NonNull DeviceDiscovery.OnDevicesChangedListener listener)Removes a previously added device change listener- Parameters:
listener- The listener to remove
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
release
public void release()
Release the resources associated with this device discovery session.- Specified by:
releasein interfaceReleasable
-
listLocalDevices
public java.util.List<Device> listLocalDevices()
List available devices for use without attaching to either Stage or Broadcast session.- Returns:
- a list of
Devices representing attached devices such as cameras, microphones, and screen recording sessions. Note that if theManifest.permission.CAMERApermission is not granted, no cameras will be returned. Similarly if theManifest.permission.RECORD_AUDIOpermission is not granted, no microphones will be returned.
-
createImageInputSource
public CustomImageSource createImageInputSource(BroadcastConfiguration.Vec2 size)
Create an image input for a custom source. This should only be used if you intend to generate and feed image data to the SDK manually.- Returns:
- A
SurfaceSourcethat represents as Surface and can receive your samples. - Throws:
BroadcastException- if creating the image input source failed
-
createAudioInputSource
public CustomAudioSource createAudioInputSource(int channels, BroadcastConfiguration.AudioSampleRate sampleRate, AudioDevice.Format format)
Create an audio input for a custom source. This should only be used if you intend to generate and feed pcm audio data to the SDK manually.- Parameters:
channels- The number of audio channels.sampleRate- The sampling rate for the PCM audio.format- The sample format.- Returns:
- An
AudioDevicethat represents as Surface and can receive your samples. - Throws:
BroadcastException- if the parameters are invalid
-
-