HI I'm developing Broadcast App for that I'm using Videocore library now how can i play that streaming video in ios app i tried with the MpMoviePlayer but it won't support the rtmp stream. so is there any third party libraries available for RTMP supported Players please help me
Asked
Active
Viewed 3,399 times
3
-
Care to share any progress you've made with this? – Daniel Que Sep 22 '16 at 20:34
-
I am using VLC player for playing rtmp streaming videos. – Bittoo Sep 23 '16 at 04:49
-
Ah, I thought you were trying to playback RTMP within the app. – Daniel Que Sep 23 '16 at 06:24
-
yes now it is working fine for me. – Bittoo Sep 23 '16 at 06:57
1 Answers
0
If you already have the RTMP
live stream ready and playing as HLS then you can simply add .m3u8
after the stream name and make RTMP
link to http
. For example you have RTMP
link like this:
rtmp://XY.Y.ZX.Z/hls/chid
You have to just make the url like this:
http://XY.Y.ZX.Z/hls/chid.m3u8
and it will play smoothly in iOS. I have tried following code and it is working fine.
func setPlayer()
{
// RTMP URL rtmp://XY.Y.ZX.Z/hls/chid be transcripted like this http://XY.Y.ZX.Z/hls/chid.m3u8 it will play normally.
let videoURL = URL(string: "http://XY.Y.ZX.Z/hls/chid.m3u8")
let playerItem = AVPlayerItem(url: videoURL!)
let adID = AVMetadataItem.identifier(forKey: "X-TITLE", keySpace: .hlsDateRange)
let metadataCollector = AVPlayerItemMetadataCollector(identifiers: [adID!.rawValue], classifyingLabels: nil)
//metadataCollector.setDelegate(self, queue: DispatchQueue.main)
playerItem.add(metadataCollector)
let player = AVPlayer(playerItem: playerItem)
let playerLayer = AVPlayerLayer(player: player)
playerLayer.frame = self.view.bounds
self.view.layer.addSublayer(playerLayer)
self.player = player
player.play()
}
But it will be slow and laggy because of the high resolution video stream upload. If you make the resolution to low when uploading the video stream, it will work smooth in low bandwidth network as well.

Manab Kumar Mal
- 20,788
- 5
- 31
- 43