Search code examples
iosios7avplayer

Why doesn't AVPlayer stop loading data?


When I watch my mac's network connectivity I can tell that a movie is still buffering even after I remove the view which had the AVPlayer on it.

Does anyone know how to force AVPlayer to stop loading data?


Solution

  • I figured it out.

    When you want to stop an AVPlayerItem from loading, use AVQueuePlayer's removeAllItems and then re-initialize it.

      [self.avPlayer removeAllItems];
      self.avPlayer = [AVQueuePlayer playerWithURL:[NSURL URLWithString:@""]];
      self.avPlayer = nil;
    

    This will stop the current item from loading -- it is the only way I found to accomplish this.