Dhaval Soni
Dhaval Soni

Reputation: 11

How to play RTSP stream in iOS using mobile vlc kit?

I am trying to play RTSP url in iOS app using MobileVLCKit , But it's not working.

let mediaPlayer = VLCMediaPlayer()
    mediaPlayer.drawable = self.movieView  
    let url = URL(string:"rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov")
    let media = VLCMedia(url: url!)
    mediaPlayer.media = media
    self.mediaPlayer!.play()

this given url is working sample url , still i can't play it with shared code.

Upvotes: 1

Views: 4229

Answers (1)

Anuran Barman
Anuran Barman

Reputation: 1676

I also had this problem. There is one possibility that the URL you are streaming from does not have HTTPS support so you have to do ATS configuration change to make that happen:

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>

Another problem is make sure you set the delegate of the VLCMediaPlayer to your ViewController. I don't know why it does not work without that. You have to set the delegate first before setting any other property.

    mediaPlayer.delegate = self
    mediaPlayer.drawable = self.videoView
    mediaPlayer.media = VLCMedia(url: URL(string: "https://streams.videolan.org/streams/mp4/Mr_MrsSmith-h264_aac.mp4")!)
    mediaPlayer.play()

Upvotes: 1

Related Questions