How to play RMTP audio url in AVAudioPlayer Swift -
i looking great way implement audio streaming using rmtp url in avaudioplayer. ways make possible? or suggestions?
thanks
update 1: code included
so here code:
let queue : dispatch_queue_t = dispatch_get_global_queue(dispatch_queue_priority_default, 0) dispatch_async(queue, { () -> void in if let songdata = nsdata(contentsofurl: url) { if let player = avaudioplayer(data: songdata, error: nil) { dispatch_async(dispatch_get_main_queue(), { () -> void in self.audioplayer = player self.audioplayer!.delegate = self if let starttime = startingtime { self.audioplayer?.currenttime = starttime } self.audioplayer!.preparetoplay() self.audioplayer!.play() self.delegate?.mmplayermanagerdelegate_playerstartedplaying() }) } } else { dispatch_async(dispatch_get_main_queue(), { () -> void in if appdelegate.biscuruserlistener == false { //=> call delegate self.delegate?.mmplayermanagerdelegate_preparenextsongtoplay() } }) } })
and url here:
- "rtmplocation" : "rtmp://limelight-fmstream-42.musicnet.com/a4396/e1",
- "rtmpresource" : "mp4:/spl/114/602/883/spl_029.mp4?e=1435348059&h=8b4b2fd16683faa9bda9b4bab6d79705",
Comments
Post a Comment