The Real-Time Communication (RTC) SDK provides features for device detection and management. You can check if your hardware devices are working correctly before you join a channel. This topic describes how to use these features.
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 reference.
- getCameraList: Retrieves the list of cameras (Mac only).
- (NSArray<AliRtcDeviceInfo *> *_Nullable)getCameraList; - getCurrentCamera: Retrieves the name of the current camera (Mac only).
- (NSString *_Nullable)getCurrentCamera; - setCurrentCamera: Sets the camera by its name (Mac only).
Parameters- (void)setCurrentCamera:(NSString *_Nonnull)camera;Name Type Description camera NSString *_Nonnull The name of the camera device to set. - getAudioCaptures: Retrieves the list of audio recording devices in the system (Mac only).
- (NSArray<AliRtcDeviceInfo *> *_Nullable)getAudioCaptures; - getCurrentAudioCapture: Retrieves the name of the current audio recording device (Mac only).
- (NSString *_Nullable)getCurrentAudioCapture; - setCurrentAudioCapture: Sets the audio recording device by its name (Mac only).
Parameters- (void)setCurrentAudioCapture:(NSString *_Nonnull)capture;Name Type Description capture NSString *_Nonnull The name of the audio recording device to set. - getAudioRenderers: Retrieves the list of speakers in the system (Mac only).
- (NSArray<AliRtcDeviceInfo *> *_Nullable)getAudioRenderers; - getCurrentAudioRenderer: Retrieves the name of the current speaker (Mac only).
- (NSString *_Nullable)getCurrentAudioRenderer; - setCurrentAudioRenderer: Sets the speaker by its name (Mac only).
Parameters- (void)setCurrentAudioRenderer:(NSString *_Nonnull)renderer;Name Type Description renderer NSString *_Nonnull The name of the speaker device to set.
该文章对您有帮助吗?