Skip to content

mobileVLCKit startRecording works but returns false and delegate returns nil for record path

IOS 13.5

Swift 5

mobileVLCKit commit f6ed0887 (3.3.13)

related to #174

I have created a project that starts a rtmp stream and then I have a button to start recording. When it starts it returns false. I ignore the false. After a few seconds of recording I press stop and then the delegate says the path is nil. I look in the folder and the file exists and is viewable. ` Program output

vlc-record-2020-06-24-09h42m10s-rtmp___192.168.3.41_live_camera1-.avi

recording file = Optional("(null)") `

attached is a zip of the 3 files needed to create the example.vlcRecordbug.zip

The project uses the all the Frameworks as suggested by the project wiki plus libc++.tbd

` class VLCPlayerView: UIView, VLCMediaPlayerDelegate { ... func mediaPlayer(_ player: VLCMediaPlayer!, recordingStoppedAtPath path: String!) { print ("recording file = (String(describing: path))") } }

struct PlayerView: UIViewRepresentable {

typealias UIViewType = VLCPlayerView
@Binding var recording: Bool
func updateUIView(_ uiView: VLCPlayerView, context: UIViewRepresentableContext<PlayerView>) {
    let dirname = getDocumentsDirectory()
    print("dirname=\(dirname)")
    if recording {
        let rc = uiView.mediaPlayer.startRecording(atPath: dirname.path)
        print ("rec started \(rc) in \(dirname.path)")

    } else {
        uiView.mediaPlayer.stopRecording()
        print(getUrlOfNewestRecording(at: dirname)?.lastPathComponent ?? "None Found")
    }
}

... } `

NOTE: I suspect the same reason that the record command returns false (incorrectly) may be the same reason that the delegate is getting NIL in the return path, even though a file was recorded.

Edited by Richard Legault
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information