title: Problems playing multiple sounds using AVPlayer (NOT AVAudioPlayer)
body: <p>I'm trying to play a background song in my iPhone game and also have sound effects, using the AVFoundation framework and AVPlayerItem. I've scoured the Internet for help with AVPlayerItem and AVPlayer but I'm only finding stuff about AVAudioPlayer.</p>
  
  <p>The background song plays fine, but when the character jumps, I have 2 problems:</p>
  
  <p>1) On the initial jump ([player play] inside jump method), the jump sound effect interrupts the background music.</p>
  
  <p>2) If I try to jump again, the game crashes with the error "AVPlayerItem cannot be associated with more than one instance of AVPlayer"</p>
  
  <p>My professor told me to create a new instance of AVPlayer for each sound I want to play, so I'm confused.</p>
  
  <p>I'm doing data driven design, so my sound files are listed in a .txt and then loaded into a NSDictionary.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>- (void) storeSoundNamed:(NSString *) soundName 
          withFileName:(NSString *) soundFileName
  {
      NSURL *assetURL = [[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:soundName ofType:soundFileName]];
  
      AVURLAsset *mAsset = [[AVURLAsset alloc] initWithURL:assetURL options:nil];
  
      AVPlayerItem *mPlayerItem = [AVPlayerItem playerItemWithAsset:mAsset];
  
      [soundDictionary setObject:mPlayerItem forKey:soundName];
  
      NSLog(@"Sound added.");
  }
  
  - (void) playSound:(NSString *) soundName
  {
      // from .h: @property AVPlayer *mPlayer;
      // from .m: @synthesize mPlayer = _mPlayer;       
  
      _mPlayer = [[AVPlayer alloc] initWithPlayerItem:[soundDictionary valueForKey:soundName]];
  
      [_mPlayer play];
      NSLog(@"Playing sound.");
  }
  </code></pre>
  
  <p>If I move this line from the second method into the first:</p>
  
  <pre><code>_mPlayer = [[AVPlayer alloc] initWithPlayerItem:[soundDictionary valueForKey:soundName]];
  </code></pre>
  
  <p>The game does not crash, and the background song will play perfectly, but the jump sound effect does not play, even though the console is showing "Playing sound." on each jump.</p>
  
  <p>Thank you</p>