The RTC software development kit (SDK) provides features to detect and manage devices. Before you join a channel, verify that your hardware devices are working correctly. This topic describes the methods for device detection and management.
Overview
RTC SDK allows you to call internal methods to detect and manage devices. For example, you can query the information about devices, detect whether the camera works as expected, detect whether the audio device can record and play audio files, switch between front and rear cameras, or change audio devices (microphone and speaker).
Methods
The following are common methods for device detection and management. For more information, see AliEngine.
- GetCameraList: Retrieves the list of cameras.
Return valueAliEngineDeviceInfoList* GetCameraList();Go back to the camera list.
- GetCurrentCameraName: Retrieves the name of the current camera.
Return valueString GetCurrentCameraName();The name of the current camera.
- SetCurrentCameraName: Selects a camera.
Parametersint SetCurrentCameraName(const char* cameraName);
Return valueName Type Description cameraName const char* The name of the camera. A value of 0 indicates that the method call is successful. Other values indicate that the method call failed.
- IsCameraOn: Checks whether the camera is on.
Return valuebool IsCameraOn();true indicates that the camera is on. false indicates that the camera is off.
- GetAudioCaptureList: Retrieves the list of audio capture devices.
Return valueAliEngineDeviceInfoList* GetAudioCaptureList();The list of audio capture devices.
- GetCurrentAudioCaptureName: Retrieves the name of the current audio capture device.
Return valueString GetCurrentAudioCaptureName();The name of the current audio capture device.
- SetCurrentAudioCaptureName: Selects an audio capture device.
Parametersint SetCurrentAudioCaptureName(const char* captureName);
Return valueName Type Description captureName const char* The name of the audio capture device. A value of 0 indicates that the method call is successful. Other values indicate that the method call failed.
- GetAudioPlayerList: Retrieves the list of audio playback devices.
Return valueAliEngineDeviceInfoList* GetAudioPlayerList();The list of audio playback devices.
- GetCurrentAudioPlayerName: Retrieves the name of the current audio playback device.
Return valueString GetCurrentAudioPlayerName();The name of the current audio playback device.
- SetCurrentAudioPlayerName: Selects an audio playback device.
Parametersint SetCurrentAudioPlayerName(const char* playerName);
Return valueName Type Description playerName const char* The name of the audio playback device. A value of 0 indicates that the method call is successful. Other values indicate that the method call failed.