iOSKit: AVFoundation: Record video


I’m trying to record video (without have ing a preview) in my iOS app.

So based on the RecordPlayAudioView example in iOS Kit i’ve tried to record video instead.

So far without any success so I wonder if it is doable at all using AVFoundation?

Are you trying to record a video of your app in the simulator ?
Or is this a feature your users will need ?

Hi Jrmie,

I want to record video with the camera that is in the phone: I’m writing a simple timer that I’m trying get to record video while displaying the time (I don’t want to show a video preview while displaying the time).

Sorry can’t help with that.

Hi again Dear forum.

I suck at writing Declares.

I think I’m stuck with declaring a Delegate:

I’m using this from iOSKit:

declare sub startRecordingToOutputFileURL_ lib AVFoundationLib selector "startRecordingToOutputFileURL:recordingDelegate:" (obj_id as ptr, outputFileURL as ptr, del as ptr) startRecordingToOutputFileURL_(self, outputFileURL, del)

The delegate del should be this delegate:

but it isn’t declared in the iOSKit and I’m clueless.

Any help is appreciated :slight_smile:

Hi Dan,

That delegate (and a lot of the video recording classes) aren’t included in iOSKit because they are not thread safe within Xojo. Would you be able to try passing nil for the delegate and see what happens? If that doesn’t work some tricks may be possible to make it work.

To add to what I said, most of AVFoundation is actually unsafe and there is just a small amount of safe classes included in iOSKit from the monster of a framework provided by Apple. Until Xojo supports real threading or some way to call into the framework safely without crashing your app, many of these classes may not be possible to use in Xojo :frowning:

Thanks Jason,

Good to know.