動画の最大録画時間
動画の最大録画時間を取得または設定します。SDK では分単位で扱います。
API Reference
フレームワーク
AIBuds.xcframework
プロトコル
- Swift
- Objective-C
/// The protocol for device API that supports camera.
protocol DeviceCameraAPI: DeviceAPI {
/// Maximum video recording duration (in minutes) allowed by the device.
var maxVideoRecordDuration: NSNumber? { get }
/// Sets the maximum video recording duration.
/// - Parameters:
/// - duration: The 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 setMaxVideoRecordDuration(
_ duration: Int,
completion: AIBudsCompletionHandler?
)
}/// The protocol for device API that supports camera.
@protocol AIBudsDeviceCameraAPI <AIBudsDeviceAPI>
/// Maximum video recording duration (in minutes) allowed by the device.
@property(nonatomic, readonly, strong) NSNumber *_Nullable maxVideoRecordDuration;
/// Sets the maximum video recording duration.
/// - Parameters:
/// - duration: The 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)setMaxVideoRecordDuration:(NSInteger)duration
completion:(AIBudsCompletionHandler _Nullable)completion;
@end| シンボル | 用途 |
|---|---|
maxVideoRecordDuration | 現在の最大録画時間(分)。 |
setMaxVideoRecordDuration | 最大録画時間を分単位で設定。 |
使用例
- Swift
- Objective-C
guard let device = device as? DeviceCameraAPI else { return }
print(
"Current maximum: \(device.maxVideoRecordDuration?.intValue.description ?? "Unavailable") minutes"
)
device.setMaxVideoRecordDuration(30) { success, error in
if !success { print(error?.localizedDescription ?? "Update failed") }
}id<AIBudsDeviceCameraAPI> device = (id<AIBudsDeviceCameraAPI>)self.device;
if ([device conformsToProtocol:@protocol(AIBudsDeviceCameraAPI)]) {
NSLog(@"Current maximum: %@ minutes", device.maxVideoRecordDuration);
[device setMaxVideoRecordDuration:30
completion:^(BOOL success, NSError *_Nullable error) {
if (!success)
NSLog(@"Update failed: %@", error.localizedDescription);
}];
}現在の Demo では 1...120 分のスライダーを使用しています。公開 SDK では共通の設定範囲が定義されていないため、公開 Capability が提供されるまでは Demo 固有の範囲として扱ってください。