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

Unable to capture media #31

Closed
david-koch-pro opened this issue Mar 23, 2017 · 7 comments
Closed

Unable to capture media #31

david-koch-pro opened this issue Mar 23, 2017 · 7 comments

Comments

@david-koch-pro
Copy link

When push camera viewcontroller, I could see the following message.

Domain=AVFoundationErrorDomain Code=-11814 "Cannot Record" UserInfo={NSLocalizedRecoverySuggestion=Try recording again., NSLocalizedDescription=Cannot Record}

What should I fix?

@Awalz
Copy link
Owner

Awalz commented Mar 23, 2017

Can you provide the source code or a sample project where this reproducible? I have never encountered this error

@david-koch-pro
Copy link
Author

I've checked my source again and guessing this part has problem. (I modified if condition because original code is deprecated)

fileprivate class func deviceWithMediaType(_ mediaType: String, preferringPosition position: AVCaptureDevicePosition) -> AVCaptureDevice? {
        if let devices = AVCaptureDeviceDiscoverySession(deviceTypes: [], mediaType: mediaType, position: position).devices {
            return devices.filter({ $0.position == position }).first
        }
        return nil
    }

@Awalz
Copy link
Owner

Awalz commented Mar 23, 2017

AVCaptureDeviceDiscoverySession is only available in iOS 10. The framework supports iOS 8+. Does the issue persist if you ignore the deprecation warnings and run the source code as it?

@david-koch-pro
Copy link
Author

If I ignore the deprecation warnings, it's running well...

@david-koch-pro
Copy link
Author

I was wrong. Added deviceTypes and running well.
let devices = AVCaptureDeviceDiscoverySession(deviceTypes: [AVCaptureDeviceType.builtInWideAngleCamera], mediaType: mediaType, position: position).devices

@Awalz
Copy link
Owner

Awalz commented Mar 23, 2017

Sorry you were wrong about what? That its running well with the original source, or that that was the part of the refactored code that is giving you problems?

@david-koch-pro
Copy link
Author

Original source is running well and new code fixed for deprecation is also running well.

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