title: Trouble playing a video with AVFoundation
body: <p>I am trying to create an AVPlayer that will display a video file. </p>
  
  <p>This is the code I have so far:</p>
  
  <pre><code>- (IBAction) player {
         NSURL* m = [[NSBundle mainBundle] URLForResource:@"Cache" withExtension:@"mov"];
         AVURLAsset* asset = [AVURLAsset URLAssetWithURL:m options:nil];
         AVPlayerItem* item = [AVPlayerItem playerItemWithAsset:asset];
         AVPlayer* p = [AVPlayer playerWithPlayerItem:item];
         self.player = p;
         AVPlayerLayer* lay = [AVPlayerLayer playerLayerWithPlayer:p];
         lay.frame = CGRectMake(10, 76, 303, 265);
         [self.view.layer addSublayer:lay];
         [p play];
  }
  </code></pre>
  
  <p>I have already linked to <code>AVFoundation.framework</code> and <code>CoreMedia.framework</code> and I have imported <code>&lt;AVFoundation/AVFoundation.h&gt;</code>.  </p>
  
  <p>First of all, I am getting an error that says <code>property 'player' not found on object of type 'ViewController*</code> (for the line <code>self.player = p;</code>). What do I need to do to get this to run?</p>
  
  <p>Also after the error is fixed, will this code work correctly to display the video?</p>
  
  <p>Thanks in advance  </p>