Advanced features

Beyond the core audio controls, the Video SDK for macOS offers several advanced audio features.

Select an audio device

Desktop setups often have several microphones and speakers attached. Enumerate them with getMicList and getSpeakerList, then activate one with selectMic or selectSpeaker.

let audioHelper = ZMVideoSDK.shared()?.getAudioHelper()
// Enumerate devices.
let micList = audioHelper?.getMicList()
let speakerList = audioHelper?.getSpeakerList()
// Activate a specific device by ID and name.
audioHelper?.selectMic("micDeviceID", deviceName: "micDeviceName")
audioHelper?.selectSpeaker("speakerDeviceID", deviceName: "speakerDeviceName")
ZMVideoSDKAudioHelper *audioHelper = [[ZMVideoSDK sharedVideoSDK] getAudioHelper];
// Enumerate devices.
NSArray<ZMVideoSDKMicDevice *> *micList = [audioHelper getMicList];
NSArray<ZMVideoSDKSpeakerDevice *> *speakerList = [audioHelper getSpeakerList];
// Activate a specific device by ID and name.
[audioHelper selectMic:@"micDeviceID" deviceName:@"micDeviceName"];
[audioHelper selectSpeaker:@"speakerDeviceID" deviceName:@"speakerDeviceName"];

Subscribe to raw audio data

To access raw audio frames, subscribe through the ZMVideoSDKAudioHelper. After subscribing, the SDK delivers audio frames to your delegate's raw-data callbacks.

let audioHelper = ZMVideoSDK.shared()?.getAudioHelper()
audioHelper?.subscribe()
// When you no longer need raw audio:
audioHelper?.unSubscribe()
ZMVideoSDKAudioHelper *audioHelper = [[ZMVideoSDK sharedVideoSDK] getAudioHelper];
[audioHelper subscribe];
// When you no longer need raw audio:
[audioHelper unSubscribe];

For the raw audio callbacks and how to process mixed, per-user, and shared audio, see Receive raw data.