Comments (14)
Hey @ranuamar,
Good find, I'll have to investigate this to see what's happening.
from pbjvision.
is there any progress on this issue?
from pbjvision.
I recommend not changing the audio session category while recording but once it has completed and you've received the callback.
from pbjvision.
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.
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.
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.
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.
@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.
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.
could you help me add that bit of code?
from pbjvision.
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.
@CristianoCastro thanks for the help
from pbjvision.
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.
thanks cristiano!
from pbjvision.
Related Issues (20)
- Separate Mirroring Modes for Preview vs Capture? HOT 1
- PBJMediaWriter crash on endVideoCapture HOT 2
- iOS 10 issues HOT 1
- iPhone 7
- Flip camera while recording causes audio sync issues HOT 3
- - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection HOT 2
- Library create problem for ios 10 HOT 3
- Upgraded library not working HOT 1
- refactor device management to address reported issues
- How capture slow-mo with PBJVision ? HOT 4
- Frame loss at capturing start HOT 2
- Deployment target HOT 2
- PBJVisionUtilities convertToPointOfInterestFromViewCoordinates changes HOT 1
- on ios7.x crash help me thx
- Cannot remove an observer
- Text in capture video HOT 3
- Capture from both cameras simultaneously HOT 1
- Capturing a photo is not working, but video is
- fetch video PHAsset - by PBJMediaWriter.outputURL ("tmp")
- Does anyone have a sample Swift Project using this?? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pbjvision.