mapbox / mapbox-vision-ios

61 stars 26 forks source link

VisionARManager camera session results in blank gray screen #358

Closed ashif-ismail closed 3 years ago

ashif-ismail commented 3 years ago

Description

I have used the same code to setup the ARNavigation as depicted in the example repo in my development environment. 1)Xcode Version 12.5 (12E262) 2)Testing in iPhone 12 Pro

Although the app compiles and runs in the device properly, but the camera does not open up, i get only a gray screen with mapbox logo attached in the bottom right of the screen.

Please check the image pasted below

image

My code for view controller `class ViewController: UIViewController {

var videoSource: CameraVideoSource!
var visionManager: VisionManager!
var visionARManager: VisionARManager!

let visionARViewController = VisionARViewController()

override func viewDidLoad() {
    super.viewDidLoad()

    videoSource = CameraVideoSource()
    videoSource.cameraSession.connections[0].videoOrientation = .portrait
    visionManager = VisionManager.create(videoSource: videoSource)
    visionARManager = VisionARManager.create(visionManager: visionManager)

    visionARViewController.set(arManager: visionARManager)
    addARView()
}

private func addARView() {
    addChild(visionARViewController)
    view.addSubview(visionARViewController.view)
    visionARViewController.didMove(toParent: self)
}

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    visionManager.start()
    videoSource.start()
}

override func viewDidDisappear(_ animated: Bool) {
    super.viewDidDisappear(animated)
    videoSource.stop()
    visionManager.stop()
}

deinit {
    visionARManager?.destroy()
    visionManager?.destroy()
}

}`

Goal

App compiles successfully and opens up a camera session

ashif-ismail commented 3 years ago

I fixed this issue ,, the issue occured when i tried to force set the camera session orientation to portrat.. when i removed the force orientation for the camera session ... the app worked fine