-
Notifications
You must be signed in to change notification settings - Fork 0
Core Audio Max Recording Duration
Mr.P edited this page Aug 25, 2026
·
2 revisions
Read or set the maximum audio recording duration allowed by the connected device. The SDK expresses this value in minutes.
- The device is connected and ready.
- The device conforms to
DeviceAudioRecordingAPI. -
maxAudioRecordDurationis notnilbefore showing an existing value.
AIBuds.xcframework
import AIBuds#import <AIBuds/AIBuds.h>
#import <AIBuds/AIBuds-Swift.h>/// The protocol for device API that supports audio recording.
protocol DeviceAudioRecordingAPI: DeviceAPI {
/// Maximum audio recording duration (in minutes) allowed by the device.
var maxAudioRecordDuration: NSNumber? { get }
/// Sets the maximum audio recording duration (in minutes) allowed by the device.
/// - Parameters:
/// - duration: The desired maximum recording duration in minutes.
/// - completion: A closure that is called when the operation completes.
/// - success: `true` if the operation was successful; otherwise `false`.
/// - error: An `NSError` object that describes the error that occurred, or `nil` if the operation was successful.
func setMaxAudioRecordDuration(
_ duration: Int,
completion: AIBudsCompletionHandler?
)
}/// The protocol for device API that supports audio recording.
@protocol AIBudsDeviceAudioRecordingAPI <AIBudsDeviceAPI>
/// Maximum audio recording duration (in minutes) allowed by the device.
@property (nonatomic, readonly, strong) NSNumber * _Nullable maxAudioRecordDuration;
/// Sets the maximum audio recording duration (in minutes) allowed by the device.
/// - Parameters:
/// - duration: The desired maximum recording duration in minutes.
/// - completion: A closure that is called when the operation completes.
/// - success: `true` if the operation was successful; otherwise `false`.
/// - error: An `NSError` object that describes the error that occurred, or `nil` if the operation was successful.
- (void)setMaxAudioRecordDuration:(NSInteger)duration
completion:(AIBudsCompletionHandler _Nullable)completion;
@end| Symbol | Purpose |
|---|---|
maxAudioRecordDuration |
Current maximum duration in minutes, or nil when unavailable. |
setMaxAudioRecordDuration |
Set the maximum duration in minutes. |
The current SDK Demo uses a 1...120 minute slider. The public SDK does not yet document a universal legal range, so treat those limits as the current Demo convention.
import AIBuds
guard let device = device as? DeviceAudioRecordingAPI else {
print("Device does not support audio recording")
return
}
if let minutes = device.maxAudioRecordDuration?.intValue {
print("Current maximum: \(minutes) minutes")
}
// 30 minutes follows the range used by the current SDK Demo.
device.setMaxAudioRecordDuration(30) { success, error in
if !success {
print(error?.localizedDescription ?? "Failed to update the duration")
}
}#import <AIBuds/AIBuds.h>
#import <AIBuds/AIBuds-Swift.h>
id<AIBudsDeviceAudioRecordingAPI> device =
(id<AIBudsDeviceAudioRecordingAPI>)self.device;
if ([device conformsToProtocol:@protocol(AIBudsDeviceAudioRecordingAPI)]) {
NSLog(@"Current maximum: %@ minutes", device.maxAudioRecordDuration);
// 30 minutes follows the range used by the current SDK Demo.
[device setMaxAudioRecordDuration:30 completion:^(BOOL success, NSError * _Nullable error) {
if (!success) {
NSLog(@"Failed to update the duration: %@", error.localizedDescription);
}
}];
}If the update fails, restore the displayed value from maxAudioRecordDuration. The SDK currently does not publish the supported duration range, so keep the Demo range isolated and replace it when a public device capability becomes available.
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