Giter Club home page Giter Club logo

Comments (14)

piemonte avatar piemonte commented on May 18, 2024

Hey @ranuamar,

Good find, I'll have to investigate this to see what's happening.

from pbjvision.

jaydi1288 avatar jaydi1288 commented on May 18, 2024

is there any progress on this issue?

from pbjvision.

piemonte avatar piemonte commented on May 18, 2024

I recommend not changing the audio session category while recording but once it has completed and you've received the callback.

from pbjvision.

jaydi1288 avatar jaydi1288 commented on May 18, 2024

I am having the same issue but in different scenario. If I setup PBJCameraModePhoto at start and toggle cam mode, I get the same error. "AVASSETWRITERSTATUSUNKNOWN". Can you please help on it?

from pbjvision.

 avatar commented on May 18, 2024

hey patrick, im not at all messing with the audio session category, still getting this error after calling endvideocapture. could you point me in the right direction?

from pbjvision.

 avatar commented on May 18, 2024

i think ive found a clue to the problem. for some reason the audio stream is not setup. the app has microphone access in my privacy settings and everything.

in: - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection

BOOL isAudio = (self.cameraMode != PBJCameraModePhoto) && (connection == [_captureOutputAudio connectionWithMediaType:AVMediaTypeAudio]);

is NO. ive confirmed its not in VideoMode so im guessing the (connection == [_captureOutputAudio connectionWithMediaType:AVMediaTypeAudio]) is returning nil. any clue as to why this may be? much thanks.

from pbjvision.

 avatar commented on May 18, 2024

i think ive found the problem. if you pre-setup the camera (lets say in the background for quick access) in photo mode initially. the audiosession is not setup. now when you switch to video mode, the audiosession is still not setup.

is there a way to switch between photo and video mode without destroying the camera?

from pbjvision.

piemonte avatar piemonte commented on May 18, 2024

@ranuamar ah, that's an excellent point. i integrated a PR recently to ensure we're not using audio if PBJVision is strictly used for photos (since mic isn't required). i can put some code in to check if the audio session is disabled and active if when going into video.

i can investigate not destroying the camera when switching modes, but in a lot of situations iOS cameras typically display some type of transition ie iris/blurring effects when making this change.

from pbjvision.

 avatar commented on May 18, 2024

hey patrick! thanks for the quick response. im keeping your camera persistent in the background so its quick access. i call setmode:photo just before bringing it up (i could delay the view push to get rid of the jerky transition).

from pbjvision.

 avatar commented on May 18, 2024

could you help me add that bit of code?

from pbjvision.

CristianoCastro avatar CristianoCastro commented on May 18, 2024

I had the same issue, it seems that in _setupCamera _captureDeviceAudio, _captureDeviceInputAudio and _captureOutputAudio are not being initialized if we are in photo mode.
Adding the following to _setupSession fixes it for me:

if (shouldSwitchMode) {
    if (self.cameraMode == PBJCameraModePhoto) {
        [_captureSession removeInput:_captureDeviceInputAudio];
        [_captureSession removeOutput:_captureOutputAudio];
    }
    //start fix
    else if(!_captureDeviceAudio && !_captureDeviceInputAudio && !_captureOutputAudio){
        NSError *error = nil;
        _captureDeviceAudio = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
        _captureDeviceInputAudio = [AVCaptureDeviceInput deviceInputWithDevice:_captureDeviceAudio error:&error];
        if (error) {
            DLog(@"error setting up audio input (%@)", error);
        }

        _captureOutputAudio = [[AVCaptureAudioDataOutput alloc] init];
        [_captureOutputAudio setSampleBufferDelegate:self queue:_captureVideoDispatchQueue];
    }
    //end fix

from pbjvision.

piemonte avatar piemonte commented on May 18, 2024

@CristianoCastro thanks for the help

from pbjvision.

CristianoCastro avatar CristianoCastro commented on May 18, 2024

You are welcome :)
And thank you for this great library ;)

Transmitted from space

On 27/11/2013, at 19:51, Patrick Piemonte [email protected] wrote:

@CristianoCastro thanks for the help


Reply to this email directly or view it on GitHub.

from pbjvision.

 avatar commented on May 18, 2024

thanks cristiano!

from pbjvision.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.