メインコンテンツまでスキップ

動画の最大録画時間

動画の最大録画時間を取得または設定します。SDK では分単位で扱います。

API Reference

フレームワーク

AIBuds.xcframework

プロトコル

Swift
/// 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?
    )
}
シンボル用途
maxVideoRecordDuration現在の最大録画時間(分)。
setMaxVideoRecordDuration最大録画時間を分単位で設定。

使用例

Swift
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") }
}

現在の Demo では 1...120 分のスライダーを使用しています。公開 SDK では共通の設定範囲が定義されていないため、公開 Capability が提供されるまでは Demo 固有の範囲として扱ってください。