title: How to play podcast files in iOS application
body: <p>I am working on app which contains radio and podcast. Where I am able to play live streaming radio. Also I am getting list of podcast from iTunes but don't found streaming link for songs in response. Response gives link to collection of audio files. So how to get link to actual path to sound file?</p>
  
  <p><a href="https://itunes.apple.com/search?term=song&amp;country=IN&amp;media=podcast&amp;entity=podcast" rel="nofollow noreferrer">https://itunes.apple.com/search?term=song&amp;country=IN&amp;media=podcast&amp;entity=podcast</a></p>
  
  <pre><code>   import AFNetworking
  
       class PodcastApi {
  
          fileprivate let baseUrl = URL(string: "https://itunes.apple.com/")
          /// Shared singletone object of WSApi
          static let shared : PodcastApi = {
              let instance = PodcastApi()
              return instance
          }()
  
  
          private func showNetworkActivity(){
              // Turn on network indicator in status bar
              UIApplication.shared.isNetworkActivityIndicatorVisible = true
          }
  
          private func hideNetworkActivity(){
              // Turn off network indicator in status bar
              UIApplication.shared.isNetworkActivityIndicatorVisible = false
          }
  
          private func getPath(term:String)-&gt;String{
              return "search?term=\(term)&amp;country=IN&amp;media=podcast&amp;entity=podcast"
          }
  
          func getPodcasts(term:String,completionHandler:@escaping (_ status:Bool, _ responseObject:Any)-&gt;()){
  
              if !ReachabilityManager.shared.isReachable {
                  let error = WSError()
                  error.errorTitle = "Network error"
                  error.errorDescription = "Unable to connect, please check your internet connectivity."
                  completionHandler(false,error)
                  return
              }
  
              self.showNetworkActivity()
              let sessionManager = AFHTTPSessionManager(baseURL: baseUrl, sessionConfiguration: URLSessionConfiguration.default)
              sessionManager.requestSerializer = AFJSONRequestSerializer()
              sessionManager.responseSerializer = AFJSONResponseSerializer()
              let urlPath =  getPath(term: term)
  
              sessionManager.get(urlPath, parameters: nil, progress: { progress in
  
              }, success: { task, responseObject in
  
                  self.hideNetworkActivity()
                  var podcasts = [Podcast]()
                  if let disc = responseObject as? [String:Any]{
                      podcasts.append(contentsOf: Podcast.GetPodcasts(disc: disc))
                  }
                  completionHandler(true,podcasts)
  
              }, failure: { operation, err in
                  self.hideNetworkActivity()
                  let error = WSError(error: err as NSError)
                  completionHandler(false,error)
  
              })
  
          }
  
  }
  
   Response is
  
  {
        "wrapperType": "track",
        "kind": "podcast",
        "collectionId": 415636728,
        "trackId": 415636728,
        "artistName": "Kurt Nichols",
        "collectionName": "New Song Fellowship",
        "trackName": "New Song Fellowship",
        "collectionCensoredName": "New Song Fellowship",
        "trackCensoredName": "New Song Fellowship",
        "collectionViewUrl": "https://itunes.apple.com/in/podcast/new-song-fellowship/id415636728?mt=2&amp;uo=4",
        "feedUrl": "http://lily.nowsprouting.com/newsongfellowship/podcast.php?pageID=10",
        "trackViewUrl": "https://itunes.apple.com/in/podcast/new-song-fellowship/id415636728?mt=2&amp;uo=4",
        "artworkUrl30": "http://is4.mzstatic.com/image/thumb/Music62/v4/34/b0/16/34b016de-a98f-0bc2-38ca-45ed2f22fe65/source/30x30bb.jpg",
        "artworkUrl60": "http://is4.mzstatic.com/image/thumb/Music62/v4/34/b0/16/34b016de-a98f-0bc2-38ca-45ed2f22fe65/source/60x60bb.jpg",
        "artworkUrl100": "http://is4.mzstatic.com/image/thumb/Music62/v4/34/b0/16/34b016de-a98f-0bc2-38ca-45ed2f22fe65/source/100x100bb.jpg",
        "collectionPrice": 0,
        "trackPrice": 0,
        "trackRentalPrice": 0,
        "collectionHdPrice": 0,
        "trackHdPrice": 0,
        "trackHdRentalPrice": 0,
        "releaseDate": "2015-12-04T18:00:00Z",
        "collectionExplicitness": "cleaned",
        "trackExplicitness": "cleaned",
        "trackCount": 30,
        "country": "IND",
        "currency": "INR",
        "primaryGenreName": "Christianity",
        "contentAdvisoryRating": "Clean",
        "artworkUrl600": "http://is4.mzstatic.com/image/thumb/Music62/v4/34/b0/16/34b016de-a98f-0bc2-38ca-45ed2f22fe65/source/600x600bb.jpg",
        "genreIds": [
          "1439",
          "26",
          "1314"
        ],
        "genres": [
          "Christianity",
          "Podcasts",
          "Religion &amp; Spirituality"
        ]
      }
  </code></pre>