iOSKit: AVFoundation: Record video

  1. 3 months ago

    Dan B

    Aug 10 Pre-Release Testers, Xojo Pro

    Hi,

    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?

  2. Jérémie L

    Aug 10 Pre-Release Testers, Xojo Pro Europe (France)

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

  3. Dan B

    Aug 10 Pre-Release Testers, Xojo Pro

    Hi Jérémie,

    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).

  4. Jérémie L

    Aug 11 Pre-Release Testers, Xojo Pro Europe (France)

    Sorry can't help with that.

  5. Dan B

    Aug 11 Pre-Release Testers, Xojo Pro

    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:

    https://developer.apple.com/documentation/avfoundation/avcapturefileoutputrecordingdelegate

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

    Any help is appreciated :-)

  6. Jason K

    Aug 11 Pre-Release Testers
    Edited 3 months ago

    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.

    Edit:
    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 :(

  7. Dan B

    Aug 11 Pre-Release Testers, Xojo Pro

    Thanks Jason,

    Good to know.

or Sign Up to reply!