Skip to content

RTSP stream is slow to start

Using MobileVLCKit in Swift, I load a live rtsp stream with:

let url = URL(string: "rtsp://192.168.1.12:8554/live")
let media = VLCMedia(url: url!)
mediaPlayer.media = media
mediaPlayer.delegate = self as? VLCMediaPlayerDelegate
mediaPlayer.drawable = self.cameraView

mediaPlayer.play()

The code is working, though the video takes up to 20-30 seconds to start. And when it does start, the image is already complete. I don't really know what's happening, but it feels like the video stream is faster to load when the camera is moving than when it is not moving.

I tried to play with some options, though I haven't found any documentation. I added:

media.addOptions([
    "network-caching": 0,
    "live-caching": 0,
    "rtp-caching": 0,
    "rtsp-caching": 0,
    "realrtsp-caching": 0
])

But my feeling is that if this has any effect at all, it would reduce the delay in the video, but not solve the slow-start, right?

Is there a way to get a quick start that would show the video stream even if the frame is not complete (I believe that the VLC Mobile app does that, from what I can observe).

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