title: AVPlayer how to manage different URL
body: <p>I'm trying to do a small radio app and I got a list of URL that I pass to AVPlayer but I can't understand how to manage different URL.</p>
  
  <p>As example if I first play this URL: <a href="http://www.example.com/file.mp3" rel="nofollow">http://www.example.com/file.mp3</a>
  then I call <a href="http://www.example.net/file2.mp3" rel="nofollow">http://www.example.net/file2.mp3</a>
  it works fine but when I select <a href="http://www.example.org/file.mp3.m3u" rel="nofollow">http://www.example.org/file.mp3.m3u</a> it doesn't load that URL and AVPlayer won't play.</p>
  
  <p>This is the code I use:</p>
  
  <pre><code>urlStream = [NSURL URLWithString:mp3URL];  
  appDelegate = [[UIApplication sharedApplication]delegate];    
  playerItem = [AVPlayerItem playerItemWithURL:urlStream];
  playerItem addObserver:self forKeyPath:@"playbackBufferEmpty" options:NSKeyValueObservingOptionNew context:nil];
  [playerItem addObserver:self forKeyPath:@"playbackLikelyToKeepUp" options:NSKeyValueObservingOptionNew context:nil];
  [appDelegate.player replaceCurrentItemWithPlayerItem:playerItem];
  </code></pre>
  
  <p>I use <code>replaceCurrentItemWithPlayerItem:playerItem</code> because if I use <code>initWithPlayerItem</code> when I choose another stream I just can't stop the previous play: so the only way to stop the playing stream and start another one is to use <code>replaceCurrentItemWithPlayerItem</code>.</p>
  
  <p>In the Apple documentation I read that <code>replaceCurrentItemWithPlayerItem</code> must have the same "compositor" as the items it replaces: what's a compositor?</p>
  
  <p>I see that what it's different between the first two streams and the third (in the example above) is the file extension.</p>
  
  <p>Any suggestion where to look for would be greatly appreciated.</p>