-
Notifications
You must be signed in to change notification settings - Fork 0
Core Volume Control Get Support
Mr.P edited this page Aug 29, 2026
·
2 revisions
Read the device's volume-setting capability and currently available volume levels.
- The device is connected and ready.
- The device conforms to
DeviceVolumeControlAPI.
AIBuds.xcframework
import AIBuds#import <AIBuds/AIBuds-Swift.h>
#import <AIBuds/AIBuds.h>/// The protocol for device volume control API.
protocol DeviceVolumeControlAPI: DeviceAPI {
/// The device's volume-set capability.
var volumeSetCapability: VolumeSetCapability { get }
/// Current volumes information of the device, or `nil` if unavailable.
var volumesInfo: VolumesInfoModel? { get }
}/// The protocol for device volume control API.
@protocol AIBudsDeviceVolumeControlAPI <AIBudsDeviceAPI>
/// The device's volume-set capability.
@property(nonatomic, readonly) enum AIBudsVolumeSetCapability volumeSetCapability;
/// Current volumes information of the device, or `nil` if unavailable.
@property(nonatomic, readonly, strong) AIBudsVolumesInfoModel *_Nullable volumesInfo;
@end| Property | Type | Description |
|---|---|---|
volumeSetCapability |
VolumeSetCapability |
The volume-setting capability. |
volumesInfo |
VolumesInfoModel? |
Current volume values, or nil when unavailable. |
| Value | Meaning in the current SDK |
|---|---|
.none |
Volume setting is unavailable. |
.common |
System-prompt, media, and in-call channels can be set. |
.advanced |
The current snapshot can also report local-playback volume; no public local-playback setter is currently available. |
| Property | Type | Range | Description |
|---|---|---|---|
systemPromptVolume |
NSNumber? |
0–100 | Current system-prompt volume. |
mediaVolume |
NSNumber? |
0–100 | Current media-playback volume. |
callVolume |
NSNumber? |
0–100 | Current in-call volume. |
localPlaybackVolume |
NSNumber? |
0–100 | Current local-playback volume; read-only through the current public API. |
import AIBuds
guard let device = device as? DeviceVolumeControlAPI else {
print("Device does not support volume control")
return
}
print("Capability: \(device.volumeSetCapability)")
if let volumes = device.volumesInfo {
print("System prompt: \(volumes.systemPromptVolume?.intValue.description ?? "Unavailable")")
print("Media: \(volumes.mediaVolume?.intValue.description ?? "Unavailable")")
print("Call: \(volumes.callVolume?.intValue.description ?? "Unavailable")")
print("Local playback: \(volumes.localPlaybackVolume?.intValue.description ?? "Unavailable")")
}#import <AIBuds/AIBuds-Swift.h>
#import <AIBuds/AIBuds.h>
id<AIBudsDeviceVolumeControlAPI> device = (id<AIBudsDeviceVolumeControlAPI>)self.device;
if ([device conformsToProtocol:@protocol(AIBudsDeviceVolumeControlAPI)]) {
AIBudsVolumesInfoModel *volumes = device.volumesInfo;
NSLog(@"System prompt: %@", volumes.systemPromptVolume);
NSLog(@"Media: %@", volumes.mediaVolume);
NSLog(@"Call: %@", volumes.callVolume);
NSLog(@"Local playback: %@", volumes.localPlaybackVolume);
}These properties have no completion handler. Handle unsupported protocol conformance, a nil model, and individual nil channel values without inventing defaults.
-
Keep Optional Values Optional: Do not present
nilas zero. -
Use Capability for UI Decisions: Hide all write controls for
.none. -
Observe Updates: Refresh from the
didVolumesChangeddelegate callback when live values are required.
- The SDK exposes synchronous properties rather than
getVolumeControlSupportor aResult-based query. - Local-playback volume is currently readable but not independently writable.
AIBuds SDK documentation · Full documentation · API Reference
- Introduction
- Getting Started
- Core Concepts
-
Core Features
- Basic Features
- Device Info
- Find Device
- Physical Operations
- Work Mode
- Work Status
- Wear Detection
- Volume Control
- Music Control
- TWS
- Equalizer
- ANC
- Audio
- Camera
- Remote Camera
- File Import
- Teleprompter
- Segment Navigation
- Live Streaming
- Device Applications
- OTA
- Camera OTA
- Service Auth
- AI Services
- Voice Assistant
- Logging
- Advanced Topics
- Releases
- Troubleshooting