-
Notifications
You must be signed in to change notification settings - Fork 0
Core Camera Record Video
Mr.P edited this page Aug 29, 2026
·
2 revisions
Request the connected device to start or stop video recording.
- The device is connected, has available storage, and conforms to
DeviceCameraAPI.
/// The protocol for device API that supports camera.
protocol DeviceCameraAPI: DeviceAPI {
/// Requests to start video recording.
/// - Parameters:
/// - completion: A closure that is called when the operation completes.
/// - success: `true` if the operation was successful; otherwise `false`.
/// - statusCode: The status code returned by the device. `nil` if the operation failed.
/// - error: An `NSError` object that describes the error that occurred, or `nil` if the operation was successful.
func requestVideoRecording(_ completion: AIBudsStatusCodeCompletionHandler?)
/// Requests to stop the current video recording session.
/// - Parameters:
/// - completion: A closure that is called when the operation completes.
/// - success: `true` if the operation was successful; otherwise `false`.
/// - statusCode: The status code returned by the device. `nil` if the operation failed.
/// - error: An `NSError` object that describes the error that occurred, or `nil` if the operation was successful.
func requestStopVideoRecording(_ completion: AIBudsStatusCodeCompletionHandler?)
}/// The protocol for device API that supports camera.
@protocol AIBudsDeviceCameraAPI <AIBudsDeviceAPI>
/// Requests to start video recording.
/// - Parameters:
/// - completion: A closure that is called when the operation completes.
/// - success: `true` if the operation was successful; otherwise `false`.
/// - statusCode: The status code returned by the device. `nil` if the operation failed.
/// - error: An `NSError` object that describes the error that occurred, or `nil` if the
/// operation was successful.
- (void)requestVideoRecordingWithCompletion:(AIBudsStatusCodeCompletionHandler _Nullable)completion;
/// Requests to stop the current video recording session.
/// - Parameters:
/// - completion: A closure that is called when the operation completes.
/// - success: `true` if the operation was successful; otherwise `false`.
/// - statusCode: The status code returned by the device. `nil` if the operation failed.
/// - error: An `NSError` object that describes the error that occurred, or `nil` if the
/// operation was successful.
- (void)requestStopVideoRecordingWithCompletion:
(AIBudsStatusCodeCompletionHandler _Nullable)completion;
@end| Method | Purpose |
|---|---|
requestVideoRecording |
Start video recording. |
requestStopVideoRecording |
Stop video recording. |
guard let device = device as? DeviceCameraAPI else { return }
device.requestVideoRecording { success, statusCode, error in
guard success else {
print(error?.localizedDescription ?? "Video recording failed to start")
return
}
print("Video recording started: \(statusCode?.stringValue ?? "Unavailable")")
}
device.requestStopVideoRecording { success, _, error in
if !success { print(error?.localizedDescription ?? "Video recording failed to stop") }
}id<AIBudsDeviceCameraAPI> device = (id<AIBudsDeviceCameraAPI>)self.device;
if ([device conformsToProtocol:@protocol(AIBudsDeviceCameraAPI)]) {
[device requestVideoRecordingWithCompletion:^(
BOOL success, NSNumber *_Nullable statusCode, NSError *_Nullable error) {
if (!success)
NSLog(@"Start failed: %@", error.localizedDescription);
}];
[device requestStopVideoRecordingWithCompletion:^(
BOOL success, NSNumber *_Nullable statusCode, NSError *_Nullable error) {
if (!success)
NSLog(@"Stop failed: %@", error.localizedDescription);
}];
}The callbacks report device command status and do not return a video path or resolution. The current public API does not provide per-request resolution selection.
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