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

videoCodecType selection doesn't stick after switching the camera with switchCamera #235

Open
steveellis opened this issue Oct 15, 2020 · 1 comment

Comments

@steveellis
Copy link

I set the videoCodecType to .h264 in viewDidLoad the video records in h264. But If I call switchCamera then the video records as HVEC.

From what I can tell it's because the codec selection doesn't persist after the session inputs change in switchCamera and defaults back to HVEC. I thought I could just set videoCodecType either before or after switching the camera via switchCamera, but that appears to have no effect. After switching the codec is always HVEC.

It looks like configureVideoOutput (where videoCodecType comes into play) is called only in viewDidLoad, maybe it should be called in switchCamera too or at least some of its logic needs to be present in switching the camera perhaps.

Seems like a workaround for now is to persist the current camera state (front or back) and then reload the view entirely with the new state. But thought I would let you know what I'm seeing. Maybe I'm missing a different way to make it work without reloading the view. Thanks!

@steveellis
Copy link
Author

steveellis commented Oct 15, 2020

Seems like my issue may be a duplicate of this #208 or at least @ShaikBaji1506 is having the same problem of the codec not being carried over when switching cams.

I'm able to solve this by reloading the view controller entirely when switching camera and setting the desired camera using the defaultCamera property, and then calling super.viewDidLoad which applies the codec I select (.h264) to the session, but I do think it's a bug if switchCamera always ends up with HVEC so I'll leave the issue open in the hopes that it can be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant