title: IOS AVPlayer won't play video
body: <p>I'm trying to play a video usingso I got some code from a tutorial but it won't work.</p>
  
  <p>Here's the code I use : </p>
  
  <pre><code>- (void) viewDidAppear:(BOOL)animated
  {
      avAsset = [AVAsset assetWithURL:[NSURL URLWithString:filePath]];
      avPlayerItem =[avPlayerItem initWithAsset:avAsset];
      avPlayer = [AVPlayer playerWithPlayerItem:avPlayerItem];
      avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:avPlayer];
      [avPlayerLayer setFrame:self.view.frame];
      [self.view.layer addSublayer:avPlayerLayer];
      [avPlayer seekToTime:kCMTimeZero];
      [avPlayer play];
  
  }
  </code></pre>
  
  <p>I don't know what's wrong it doesn't give ny errors it just gives black screen.
  Thanks.</p>