Insta360Develop / CameraSDK-iOS

iOS SDK to control Insta360 cameras.
33 stars 5 forks source link

Set Photography Options not working using SCMP #41

Open operezdev opened 1 week ago

operezdev commented 1 week ago

I'm working on an app that connects to Insta360 cameras to take panos and allow users to adjust photography settings such as white balance, ISO, HDR, exposure, and capture delay.

I've been attempting to adjust the white balance, ISO, and exposure using SCMP, but it's not working, even though the 'setPhotographyOptions' call is returning success.

Testing details

Camera: Insta360 ONE RS 1-inch 360 Camera firmware version: v2.0.11.4 Xcode version: 15.2 iOS version: 17.5.1

Sample code:

var commandManager: INSCameraAllUSBCommands

public func setISO(_ iso: Int) {
     let exposureOptions = INSCameraExposureOptions()
     exposureOptions.iso = UInt(iso)

     let photographyOptions = INSPhotographyOptions()
     photographyOptions.stillExposure = exposureOptions

     applyCameraSettings(photographyOptions: photographyOptions, photographyOptionsTypes: [.stillExposureOptions])
}

private func applyCameraSettings(photographyOptions: INSPhotographyOptions, photographyOptionsTypes: [INSPhotographyOptionsType]) {
        let optionsTypes = photographyOptionsTypes.map { NSNumber(value: $0.rawValue) }

        Task {
            do {
                try await commandManager.setPhotographyOptions(photographyOptions, for: .normal, types: optionsTypes)
                self.logger?.log("Set INSPhotography Success")
            } catch {
                self.logger?.log("Set INSPhotography Options Error: \(error)")
         }
     }
}

I've also attempted to use OSC, and it's functioning properly. However, I must use SCMP because the app I'm currently working on already has substantial work implemented using SCMP. In the documentation, you recommend using the same protocol to control the camera throughout the entire development process.

Why is setPhotographyOptions returning success, but the camera is not changing the settings?

shoaoki-arent commented 1 week ago

@operezdev Sorry to speculate since I haven't tried it, but what if the argument for of setPhotograpyOptions is something else like .normalImage or .instaPanoImage instead of .normal?

operezdev commented 6 days ago

@shoaoki-arent Hello,

Thanks for your reply. Yes, I have tried both .normalImage or .instaPanoImage but still not working.

Plus, those options seem unavailable since I'm testing with an Insta360 RS 1-inch. According to the SDK, instaPanoImage is only available for ONE X2 (@available ONE X2)

typedef NS_ENUM(NSUInteger, INSCameraFunctionMode) {
    /// 普通拍照和录像
    INSCameraFunctionModeNormal = 0,

    /// 预览流
    INSCameraFunctionModeLiveStream = 1,

    /// Timelapse for moving scenes
    INSCameraFunctionModeTimelapse = 2,

    /// interval shooting
    INSCameraFunctionModeIntervalShooting = 3,

    /// 高帧率模式
    INSCameraFunctionModeHighFrameRate = 4,

    /// burst. @available ONE X
    INSCameraFunctionModeBurst = 5,

    /// normal image. @available ONE X
    INSCameraFunctionModeNormalImage = 6,

    /// normal video. @available ONE X
    INSCameraFunctionModeNormalVideo = 7,

    /// HDR image. @available ONE X
    INSCameraFunctionModeHdrImage = 8,

    /// HDR video. @available ONE X
    INSCameraFunctionModeHdrVideo = 9,

    /// Interval video. @available GO
    INSCameraFunctionModeIntervalVideo = 10,

    /// Timelapse for non-moving scenes. @available GO
    INSCameraFunctionModeStaticTimelapse = 11,

    /// TimeShift video. @available ONE R
    INSCameraFunctionModeTimeShift = 12,

    /// Nightscape image. @available ONE R
    INSCameraFunctionModeNightscape = 13,

    /// Insta pano image. @available ONE X2
    INSCameraFunctionModeInstaPanoImage = 14,

    /// Insta pano HDR image. @available ONE X2
    INSCameraFunctionModeInstaPanoHdrImage = 15,

    /// Super video (video without flowstate). @available GO2
    INSCameraFunctionModeSuperVideo = 16,

    /// Loop recording. @available ONE R
    INSCameraFunctionModeLoopRecording = 17,

    /// Starlapse. @available GO2
    INSCameraFunctionModeStarlapse = 18,

    /// FPV. @available ONE RS
    INSCameraFunctionModeFPV = 19,

    /// Movie recording. @available ONE RS
    INSCameraFunctionModeMovieRecording = 20,

    /// Slow motion. @available ONE RS
    INSCameraFunctionModeSlowMotion = 21,

    /// selfie. @available X3
    INSCameraFunctionModeSelfie = 22,
};