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

Tapping on the "1.0x" button doesn't do anything #54

Closed
mathieut opened this issue Aug 23, 2021 · 12 comments
Closed

Tapping on the "1.0x" button doesn't do anything #54

mathieut opened this issue Aug 23, 2021 · 12 comments

Comments

@mathieut
Copy link

I started running the sample code, and realized that tapping on "1.0x" to change cameras doesn't do anything (just refreshes the current view).

@eonist
Copy link
Owner

eonist commented Aug 23, 2021

Works on my iPhone 11 Pro max.

Try to see if the handlers in this file gets called on your setup:
https://github.com/eonist/HybridCamera/blob/master/Sources/HybridCamera/HybridCamView/HybridCamView%2BHandler.swift

Remember you have to try this on an actual device. since it needs to use the camera etc

@mathieut
Copy link
Author

The function gets called when the app starts, and every time I tap on the lens/zoom button, the same thing happens:

zoomSwitcher.onSwitch: 1 deviceType: AVCaptureDeviceType(_rawValue: AVCaptureDeviceTypeBuiltInWideAngleCamera)
zoomSwitcher.onSwitch: 1 deviceType: AVCaptureDeviceType(_rawValue: AVCaptureDeviceTypeBuiltInWideAngleCamera)

I'm on iOS 14.7.1 and iPhone 12 Pro.

@eonist
Copy link
Owner

eonist commented Aug 27, 2021

Right.
in this file: https://github.com/eonist/HybridCamera/blob/master/Sources/HybridCamera/HybridCamView/HybridCamView%2BHandler.swift

On these lines:

Swift.print("zoomSwitcher.onSwitch: \(focalType.rawValue) deviceType: \(deviceType)")
try? self.camView.toggleCameraPosition(for: self.topBar.flipButton.toggle ? .front : .back, deviceType: deviceType)

change the try? to:

do {
   try self.camView.toggleCameraPosition(for: self.topBar.flipButton.toggle ? .front : .back, deviceType: deviceType)
}
catch {
    print(error) // see what error you get
}

@mathieut
Copy link
Author

mathieut commented Aug 30, 2021

I'm not getting any error:

Swift.print("⚠️️ zoomSwitcher.onSwitch: \(focalType.rawValue) deviceType: \(deviceType)")
//try? self.camView.toggleCameraPosition(for: self.topBar.flipButton.toggle ? .front : .back, deviceType: deviceType)
         do {
            try self.camView.toggleCameraPosition(for: self.topBar.flipButton.toggle ? .front : .back, deviceType: deviceType)
         }
         catch {
            print("⚠️️ ERROR Asked:")
            print(error) // see what error you get
         }

This is what I see in the UI on my iPhone 12 Pro:
IMG_4CF0FA4EA433-1

But this is working fine on my old iPhone XS and I am seeing both 1.0x and 2.0x buttons in the UI.

@eonist
Copy link
Owner

eonist commented Aug 31, 2021

Right. The lib doesn't support iPhone 12 yet. Needs an update here to support iPhone 12 here:

https://github.com/eonist/ZoomSwitcherKit/blob/2f686c2aa53715c82f5e7ff109edf6907c52c99f/Sources/ZoomSwitcherKit/BackCameraType/BackCameraType%2BExtension.swift#L36

I guess iPhone 12 has the same camera setup as iPhone 11. So should be just an update to device enum and adding it in the case.

Feel free to add a PR.

@mathieut
Copy link
Author

mathieut commented Sep 1, 2021

I created a PR. I couldn't test it in HybridCamera until it is accepted so I am not 100% that it will work.

@eonist
Copy link
Owner

eonist commented Sep 2, 2021

Looks good to me 👌

@eonist
Copy link
Owner

eonist commented Sep 2, 2021

For another time: You can always point the SPM dep to your own fork, when testing new stuff etc.

@eonist
Copy link
Owner

eonist commented Sep 2, 2021

Thanks

@mathieut mathieut closed this as completed Sep 4, 2021
@eonist
Copy link
Owner

eonist commented Sep 4, 2021

Btw. I would include ZoomKit as a local dependency. I didn't know this was possible before. But it would simplify things. Just a suggestion ✌️

@mathieut
Copy link
Author

mathieut commented Sep 4, 2021

What's the benefit of this?

@eonist
Copy link
Owner

eonist commented Sep 5, 2021

You can make edits directly to the sub module.

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

2 participants