title: Playing a live TuneIn Radio URL iOS Swift
body: <p>I am working on an app which is intended to play life radio by using TuneIn URLs. In TuneIn, there is an http get request in the API which provides a JSON with all the URL and its bitrates. </p>
  
  <p>So
      <a href="http://opml.radiotime.com/Tune.ashx?id=s150147&amp;formats=aac,mp3&amp;render=json" rel="nofollow noreferrer">http://opml.radiotime.com/Tune.ashx?id=s150147&amp;formats=aac,mp3&amp;render=json</a>  </p>
  
  <p>will return</p>
  
  <pre><code>{ "head": { "status": "200"}, "body": [
   { "element" : "audio", 
  "url": "http://player.absoluteradio.co.uk/tunein.php?i=a664.aac",
  "reliability": 95,
  "bitrate": 64,
  "media_type": "aac",
  "position": 0,
  "player_width": 529,
  "player_height": 716,
  "guide_id": "e89279187",
  "is_direct": false }, { "element" : "audio", 
  "url": "http://player.absoluteradio.co.uk/tunein.php?i=a6low.mp3",
  "reliability": 78,
  "bitrate": 48,
  "media_type": "mp3",
  "position": 0,
  "player_width": 529,
  "player_height": 716,
  "guide_id": "e89279188",
  "is_direct": false }, { "element" : "audio", 
  "url": "http://player.absoluteradio.co.uk/tunein.php?i=a624.aac",
  "reliability": 29,
  "bitrate": 24,
  "media_type": "aac",
  "position": 0,
  "player_width": 529,
  "player_height": 716,
  "guide_id": "e89279186",
  "is_direct": false }] }
  </code></pre>
  
  <p>My first approach was to setup an AVPlayer with one of the URLs given but it didn't play. </p>
  
  <p>Furthermore, If you copy and paste a URL in a chrome browser it starts downloading a file that takes forever.</p>
  
  <p>Inspecting with wireshark, I finally found that the streaming URL is a different one and it is provided with the Header on the first time you request a file.</p>
  
  <p>I know that has been done on android by intercepting the headers but, Is is possible to do the same on iOS? </p>
  
  <p>I have been looking some libraries and <strong>MobileVLCKit</strong> seems a candidate but not sure how I am risking the possibility of my app getting rejected.</p>
  
  <p>Since, streaming is very popular action nowadays, Can I achieve that in an "Apple way"  </p>
  
  <p>Thank you</p>