Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Switching from back to front camera black screen #228

Open
Ludotrico opened this issue Aug 4, 2020 · 0 comments
Open

[BUG] Switching from back to front camera black screen #228

Ludotrico opened this issue Aug 4, 2020 · 0 comments
Labels

Comments

@Ludotrico
Copy link

Ludotrico commented Aug 4, 2020

I have found that switching cameras (calling method flipCaptureDevicePosition) from back to front is quite problematic in .video only when you choose a video configuration preset that is not supported in the front camera hardware such as .hd1920x1080.

I have tested on a couple devices (iPhone SE, X, iPad Air) and switching from back camera to front results in a black screen and no output if you switch to an unsupported preset.

Replicate:

        nextLevel.delegate = self
        nextLevel.videoDelegate = self
        
        nextLevel.captureMode = .video
        nextLevel.videoStabilizationMode = .off
        nextLevel.frameRate = 120
        nextLevel.flashMode = .off
        nextLevel.torchMode = .off
    
        
        // video configuration
        nextLevel.videoConfiguration.maximumCaptureDuration =  CMTime(seconds: 60, preferredTimescale: 1)
        nextLevel.videoConfiguration.aspectRatio = .instagramStories
        nextLevel.videoConfiguration.preset = .hd1920x1080   <- NOT SUPPORTED IN FRONT CAMERA
        nextLevel.videoConfiguration.maxKeyFrameInterval = 50
        

        nextLevel.enableBackgroundAudio()
        nextLevel.automaticallyConfiguresApplicationAudioSession = false

        try! nextLevel.start()

Suggestion:

Before switching to the front camera, the capture session's video configuration preset should be automatically switched to .high. When switching to the back camera, the preset should go back to what was set.

I have checked other Swift Camera libraries, namely Swifty Cam, and they do the aforementioned. Any suggestions on how to do this and catch up with our competitor?

@piemonte piemonte added the bug label Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants