-
Notifications
You must be signed in to change notification settings - Fork 6
Description
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
- Connect to an Insta360 camera that is in a 360-degree capture mode.
- Initialize
INSCameraSessionPlayerto display the live preview. - Implement a minimal
INSCameraSessionPlayerDataSourceto provide the necessary configurations. - 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:
contentMode: SettingrenderModelType.contentModeto.contain,.fitCamera, and.fitScreen. None of these fixed the initial zoom.mediaOffset: Using the raw, unmodifiedmediaOffsetdirectly fromINSCameraManager.shared().currentCamera?.settings.mediaOffsetto ensure there are no calculation errors. The issue remained.cropInfo/windowCropInfo: Ensured that no manual cropping is being applied viarenderModelType.cropInfo. The issue is present even whenwindowCropInfois ignored.- Stabilization (
preferredStabMode): Cycled through different stabilization modes (.flowState,.still, etc.). This did not affect the initial zoom state. - 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 closedistance. I attempted to set these values manually after initialization, but I could not find the correct API properties (e.g.,player.render.camera.xfovis 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.