0

I want to stream sound from URL. I used various cocoacontrols to implement it and also used AVPlayer to stream audio but all works in the same manner that they load complete audio at once and then play which takes lots of time in case of large audio files. So I want to stream my sound from URL as other online players do like other music app (Gaana or Savan).

Thanks in advance.

Amit Pandey
  • 156
  • 2
  • 11
  • https://www.cocoawithlove.com/2010/03/streaming-mp3aac-audio-again.html , download the source from the [github](https://github.com/mattgallagher/AudioStreamer) and put your stream url in the demo app and see if that works for you – Inder Kumar Rathore Feb 08 '17 at 10:33
  • https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=audio+streamer+for+ios+github – kb920 Feb 08 '17 at 10:41

1 Answers1

0

You can use this function to play audio file but don't forgot to import AVFoundation

   func playRemoteFile() {

       let fileUrl = "http://yourweburl/file.mp3"
       let url = NSURL(string: fileUrl)

       var myPlayer = AVPlayer(URL: url)
       myPlayer.play()
   }

Or check this link for some awesome library in github
MusicPlayer
InteractivePlayerView
bpolat-Musical Player

Or check this link Link

Community
  • 1
  • 1
Abdul Karim
  • 4,359
  • 1
  • 40
  • 55
  • Thanks for the answer, but I worked with this but it is not streaming my audio link, it loads complete audio at the start and then play due to witch in case of large audio links it takes lots of time in playing. – Amit Pandey Feb 09 '17 at 11:15
  • Have you checked the links ..? – Abdul Karim Feb 09 '17 at 17:50
  • Yes, I check them all but nothing is working like what i want. If you think any of them is working as same can you please explain me how it is working. – Amit Pandey Feb 10 '17 at 12:36