title: HTTP live stream AVAsset
body: <p>I am implementing a n HTTP live streaming player with OSX using avplayer. 
  I am able to stream it properly seek and get duration timing etc.
  Now i want to take screen shots and process the frames from it using OpenCV.
  I went for using AVASSetImageGenerator. But there is no audio and video tracks with the AVAsset which is associated with player.currentItem.</p>
  
  <p>The tracks are appearing in player.currentItem.tracks.
  So i am not able to sue AVAssetGenerator. Can anybody help to find out a solution to extract screenshots and individual frames in such a scenario?</p>
  
  <p>Please find the code below how i am initiating an HTTP live stream</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>NSURL* url = [NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"];
  playeritem = [AVPlayerItem playerItemWithURL:url];
  
  [playeritem addObserver:self forKeyPath:@"status" options:0 context:AVSPPlayerStatusContext];
  [self setPlayer:[AVPlayer playerWithPlayerItem:playeritem]];
  [self addObserver:self forKeyPath:@"player.rate" options:NSKeyValueObservingOptionNew context:AVSPPlayerRateContext];
  [self addObserver:self forKeyPath:@"player.currentItem.status" options:NSKeyValueObservingOptionNew context:AVSPPlayerItemStatusContext];
  AVPlayerLayer *newPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:[self player]];
  [newPlayerLayer setFrame:[[[self playerView] layer] bounds]];
  [newPlayerLayer setAutoresizingMask:kCALayerWidthSizable | kCALayerHeightSizable];
  [newPlayerLayer setHidden:YES];
  [[[self playerView] layer] addSublayer:newPlayerLayer];
  [self setPlayerLayer:newPlayerLayer];
  [self addObserver:self forKeyPath:@"playerLayer.readyForDisplay" options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew context:AVSPPlayerLayerReadyForDisplay];
  [self.player play];    
  </code></pre>
  
  <p>Following is how i am checking whether video track is present with the Asset</p>
  
  <pre><code>case AVPlayerItemStatusReadyToPlay:
  
                  [self setTimeObserverToken:[[self player] addPeriodicTimeObserverForInterval:CMTimeMake(1, 10) queue:dispatch_get_main_queue() usingBlock:^(CMTime time) {
                      [[self timeSlider] setDoubleValue:CMTimeGetSeconds(time)];
                      NSLog(@"%f,%f,%f",[self currentTime],[self duration],[[self player] rate]);
                      AVPlayerItem *item = playeritem;
                      if(item.status == AVPlayerItemStatusReadyToPlay)
                      {
                      AVAsset *asset = (AVAsset *)item.asset;
                      long audiotracks = [[asset tracks] count];
                      long videotracks = [[asset availableMediaCharacteristicsWithMediaSelectionOptions]count];
  
                      NSLog(@"Track info Audio = %ld,Video=%ld",audiotracks,videotracks);
                      }
                  }]];
  
  
  
                  AVPlayerItem *item = self.player.currentItem;
                  if(item.status != AVPlayerItemStatusReadyToPlay)
                      return;
                  AVURLAsset *asset = (AVURLAsset *)item.asset;
                  long audiotracks = [[asset tracksWithMediaType:AVMediaTypeAudio]count];
                  long videotracks = [[asset tracksWithMediaType:AVMediaTypeVideo]count];
  
                  NSLog(@"Track info Audio = %ld,Video=%ld",audiotracks,videotracks);
  </code></pre>