title: Using the AVURLAsset to play a Remote Video File
body: <p>I want to use the AVURLAsset to play a video file but on a server not local file. I have read that the AVURLAsset cant be used directly for remote files .
  I read another link of stack Overflow </p>
  
  <p><a href="https://stackoverflow.com/questions/4934886/avurlasset-cannot-load-with-remote-file">AVURLAsset cannot load with remote file</a></p>
  
  <p>this link has some method to use AVURLAsset to play remote files but I am not able to understand it fully. My observer is not being called. Can someone please help me? Actually I don't want to use AVPlayer to play video for some reasons. I am grabbing frames from AVAsset and then rendering them as textures in OpenGL so I need to do this by AVURLAsset only.</p>
  
  <p>Here is code to look at</p>
  
  <pre><code>-(void) startPlayer
     { 
      NSURL *url=[NSURL fileURLWithPath:@"http://gamooz.com/wildlife.mp4"]; 
      pItem = [AVPlayerItem playerItemWithURL:url]; 
      player = [AVPlayer playerWithPlayerItem:pItem];
      [player play]; 
      pItem addObserver:self forKeyPath:@"status" options:0 context:nil]; 
     }
  
   -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:    (NSDictionary *)change context:(void *)context 
     { 
       NSLog(@"heyy"); 
       if ([keyPath isEqualToString:@"status"])
          {
            AVPlayerItem *pItemTemp = (AVPlayerItem *)object; 
            if (pItemTemp.status == AVPlayerItemStatusReadyToPlay) 
               { 
                  ///now i can use playerItem asset
                   asset = (AVURLAsset *)pItemTemp.asset; 
               }
          } 
     }
  </code></pre>
  
  <p>but the observer is never getting called. Why is that?</p>
  
  <p>Also I put the observer code in some other function and tried to check if the playerItem is ready to play </p>
  
  <pre><code> -(void) checkForPlayer
     {
    if (pItem.status == AVPlayerItemStatusReadyToPlay) 
     {
       asset = (AVURLAsset *)pItem.asset;
     }
     }
  </code></pre>
  
  <p>it is never giving status equal to ready.</p>