Skip to content

[Bug] 360 Live Preview is Severely Zoomed-In on Initial Load #64

@7wilightxdev

Description

@7wilightxdev

Hello Insta360 SDK Team and community,

I am experiencing an issue where the 360 live preview from the camera is displayed in a severely zoomed-in state by default when using the iOS SDK. It seems only a small fraction of the full spherical view is visible.

This issue occurs even in a minimal implementation, and I've been unable to resolve it by adjusting the common configuration parameters.


Steps to Reproduce

  1. Connect to an Insta360 camera that is in a 360-degree capture mode.
  2. Initialize INSCameraSessionPlayer to display the live preview.
  3. Implement a minimal INSCameraSessionPlayerDataSource to provide the necessary configurations.
  4. Run the application and observe the live preview.

Expected Behavior

The renderView should display a full, interactive 360-degree spherical preview, allowing the user to pan around the entire scene, similar to the preview on the camera's own screen.


Actual Behavior

The preview starts in a heavily zoomed-in state. The user can interact with the view (e.g., pinch to zoom), and the gestures are recognized correctly. However, they are modifying an already incorrect, zoomed-in initial state.

For example, a "pinch close" (zoom in) gesture correctly results in a further zoom-in, as confirmed by the following log:
InputEvent::TouchPinching xfov distance 1.461112 0.346723 -> 1.457327 0.345881

This confirms that gesture handling is working, but the initial camera state is the root problem.


Environment

  • Camera Model: Insta360 X4
  • SDK Version: v1.8.2_build4

Minimal Code Example to Reproduce

Even with the following minimal code in a new UIViewController, the issue persists.

import UIKit
import INSCameraSDK
import INSCoreMedia

class MinimalPreviewController: UIViewController, INSCameraSessionPlayerDataSource, INSCameraSessionPlayerDelegate {

    var player: INSCameraSessionPlayer?

    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = .black
        
        player = INSCameraSessionPlayer()
        player?.dataSource = self
        player?.delegate = self

        if let renderView = player?.renderView {
            renderView.frame = self.view.bounds
            renderView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
            self.view.addSubview(renderView)
        }
    }

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        startPreview()
    }

    func startPreview() {
        guard INSCameraManager.shared().cameraState == .connected else { return }

        player?.startRunning { error in
            if let error = error {
                print("Failed to start player: \(error)")
            } else {
                print("Player started successfully.")
            }
        }
    }

    // MARK: - INSCameraSessionPlayerDataSource

    func updateRenderModelType(to player: INSCameraSessionPlayer, renderModelType: INSRenderModelType) -> INSRenderModelType {
        renderModelType.displayType = .sphereStitch
        renderModelType.contentMode = .contain
        return renderModelType
    }

    func updateOffset(to player: INSCameraSessionPlayer) -> String? {
        // Using the original, unmodified offset from the camera
        return INSCameraManager.shared().currentCamera?.settings.mediaOffset
    }

    func updateStabilizerParam(to player: INSCameraSessionPlayer) -> INSRealtimeStabilizerParam {
        let param = INSRealtimeStabilizerParam()
        param.preferredStabMode = .flowState
        if let offset = self.updateOffset(to: player) {
            param.offset = offset
        }
        return param
    }
}

Diagnostics & What I've Tried

Based on a thorough debugging process, I have already tried the following solutions without success:

  1. contentMode: Setting renderModelType.contentMode to .contain, .fitCamera, and .fitScreen. None of these fixed the initial zoom.
  2. mediaOffset: Using the raw, unmodified mediaOffset directly from INSCameraManager.shared().currentCamera?.settings.mediaOffset to ensure there are no calculation errors. The issue remained.
  3. cropInfo / windowCropInfo: Ensured that no manual cropping is being applied via renderModelType.cropInfo. The issue is present even when windowCropInfo is ignored.
  4. Stabilization (preferredStabMode): Cycled through different stabilization modes (.flowState, .still, etc.). This did not affect the initial zoom state.
  5. Initial Virtual Camera State: My current hypothesis is that the player's virtual camera is being initialized with a very narrow Field of View (xfov) or a very close distance. I attempted to set these values manually after initialization, but I could not find the correct API properties (e.g., player.render.camera.xfov is not available).

Could you please advise on the correct way to set the initial FOV and distance for the live preview's virtual camera, or suggest any other potential causes for this initial zoomed-in state that I might have missed?

Thank you for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions