AVCaptureMovieFileOutput - no active/enabled connections

1,686 views
Skip to first unread message

Jonas Bruun Nielsen

unread,
May 25, 2013, 1:06:18 PM5/25/13
to rubym...@googlegroups.com

In RubyMotion, I'm using AVFoundation for screencapture in an attempt to implement this snippet from the Mac Developer Library. The program should capture video from the screen and write to a .mov file.

I don't quite understand why I'm getting this error:

* -[AVCaptureMovieFileOutput startRecordingToOutputFileURL:recordingDelegate:] - no active/enabled connections.

The simple code is:

# Setup recording pipeline
@session = AVCaptureSession.alloc.init
@session.sessionPreset = AVCaptureSessionPresetMedium
input
= AVCaptureScreenInput.alloc.initWithDisplayID(KCGDirectMainDisplay)
@session.addInput(input)
movieFileOutput
= AVCaptureMovieFileOutput.alloc.init
if @session.canAddOutput(movieFileOutput)
 
@session.addOutput(movieFileOutput)
else
 
Logger.error "Could not add ouput #{movieFileOutput}"
end
@session.startRunning()


# Delete exisiting file
fileManager
= NSFileManager.defaultManager
path
= "~/Desktop/video.mov"
if fileManager.fileExistsAtPath(path)
  err
= Pointer.new(:object)
 
unless fileManager.defaultManager.removeItemAtPath(path, error:err)
   
Logger.error "Can't delete existing movie"
 
end
end


# Start recording
movieFileOutput
.startRecordingToOutputFileURL(NSURL.fileURLWithPath(path), recordingDelegate:self) # <--- Problem

What am I doing incorrect?

Jonas Bruun Nielsen

unread,
Jun 22, 2013, 5:00:11 AM6/22/13
to rubym...@googlegroups.com
Hey guys

I would really appreciate any input on this. I've confirmed it to work with the exact same procedure in Objective-C. 
Let me know, if I can provide any other information. 

Thanks,
Jonas

Jonas Bruun Nielsen

unread,
Jun 23, 2013, 8:01:45 AM6/23/13
to rubym...@googlegroups.com
Here's a sample app explaining the problem:

I also submitted a support ticket to the RubyMotion team. Hopefully they can help clear out the issue.

Jonas Bruun Nielsen

unread,
Jun 24, 2013, 1:55:31 PM6/24/13
to rubym...@googlegroups.com
Thanks to the lovely Joffrey from the RubyMotion team, the problem is now solved. 
For someone coming across this thread in the future, the issue was using the wrong constant for main display id. Correct is CGMainDisplayID().
Reply all
Reply to author
Forward
0 new messages