1

I have a POST request where I have to post parameters (track_id , track_name) to url to get a mp3 file content. Now How can i get this mp3 file streaming in AVPlayer?

I know how to stream in AVplayer with an url like :

   var player: AVPlayer?
   player = AVPlayer(URL: trackURL)
   player?.play()

But here my URL won't have any content unless I provide its required parameters (track_id , track_name). How can i set the URL with these 2 parameters?

1 Answers1

-1

You need to have the url path to the mp3 resource at the time of initialization. Make the POST request first and then initialize the player with the URL that you get in response.

Max
  • 1,143
  • 7
  • 7