title: AVPlayer & AVAudioPlayer not playing audio from URL
body: <p>I have trying to play audio from URL. I tried both AVPlayer and AVAudioPlayer but none of them worked.</p>
  
  <p>Here is the <a href="http://www.noiseaddicts.com/samples_1w72b820/2514.mp3" rel="nofollow noreferrer">URL</a> which I am trying to play.</p>
  
  <p>Here is the code I am using.</p>
  
  <pre><code> // AVPlayer Code
   self.avPlayerItem = AVPlayerItem.init(url: urlOfAudio)
   self.avPlayer = AVPlayer.init(playerItem: avPlayerItem)
   self.avPlayer.volume = 1.0
   self.avPlayer.play()
  
   // AVAudioPlayer
   if let url = URL.init(string: escapeCharactorString){
        do {
             self.playerReference = try AVAudioPlayer.init(contentsOf: url)
             guard let player = playerReference else { 
                 return
             }                    
             player.volume = 1.0
             player.prepareToPlay()
             player.numberOfLoops = -1                    
             player.play() 
        } catch let error {
  
        }
    }
  </code></pre>
  
  <p>None of them worked for me. 
  Please let me know where I am going wrong in it.</p>