The RTC SDK provides features for device detection and management. Before you join a channel, check that your hardware devices work correctly. This topic describes how to detect and manage devices on macOS.
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 the AliRtcEngine API.
getCameraList: Retrieves the list of cameras (macOS only).
- (NSArray<AliRtcDeviceInfo *> *_Nullable)getCameraList;getCurrentCamera: Retrieves the name of the current camera (macOS only).
- (NSString *_Nullable)getCurrentCamera;setCurrentCamera: Sets the camera by name (macOS only).
- (void)setCurrentCamera:(NSString *_Nonnull)camera;Parameters
Name
Type
Description
camera
NSString *_Nonnull
The name of the camera device to set.
getAudioCaptures: Retrieves the list of audio capture devices in the system (macOS only).
- (NSArray<DingRtcDeviceInfo *> *_Nullable)getAudioCaptures;getCurrentAudioCaptureID: Retrieves the ID of the current audio capture device (macOS only).
- (NSString *_Nullable)getCurrentAudioCaptureID;setCurrentAudioCaptureWithID: Sets the audio capture device by ID (macOS only).
- (void)setCurrentAudioCaptureWithID:(NSString *_Nonnull)captureID;Parameters
Name
Type
Description
Capture
NSString *_Nonnull
The ID of the audio capture device to set.
getAudioRenderers: Retrieves the list of playback devices in the system (macOS only).
- (NSArray<DingRtcDeviceInfo *> *_Nullable)getAudioRenderers;getCurrentAudioRendererID: Retrieves the ID of the current playback device (macOS only).
- (NSString *_Nullable)getCurrentAudioRendererID;setCurrentAudioRendererWithID: Sets the playback device by ID (macOS only).
- (void)setCurrentAudioRendererWithID:(NSString *_Nonnull)rendererID;Parameters
Name
Type
Description
rendererID
NSString *_Nonnull
The ID of the playback device to set.