Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To get notification for reaching the end of an item (via <a href="http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/02_Playback.html#//apple_ref/doc/uid/TP40010188-CH3-SW7" rel="noreferrer">Apple</a>):</p> <pre><code>[[NSNotificationCenter defaultCenter] addObserver:&lt;self&gt; selector:@selector(&lt;#The selector name#&gt;) name:AVPlayerItemDidPlayToEndTimeNotification object:&lt;#A player item#&gt;]; </code></pre> <p>And to track playing you can:</p> <p>"track changes in the position of the playhead in an AVPlayer object" by using <strong>addPeriodicTimeObserverForInterval:queue:usingBlock:</strong> or <strong>addBoundaryTimeObserverForTimes:queue:usingBlock:</strong>. </p> <p>Example is from Apple:</p> <pre><code>// Assume a property: @property (retain) id playerObserver; Float64 durationSeconds = CMTimeGetSeconds([&lt;#An asset#&gt; duration]); CMTime firstThird = CMTimeMakeWithSeconds(durationSeconds/3.0, 1); CMTime secondThird = CMTimeMakeWithSeconds(durationSeconds*2.0/3.0, 1); NSArray *times = [NSArray arrayWithObjects:[NSValue valueWithCMTime:firstThird], [NSValue valueWithCMTime:secondThird], nil]; self.playerObserver = [&lt;#A player#&gt; addBoundaryTimeObserverForTimes:times queue:NULL usingBlock:^{ // Passing NULL for the queue specifies the main queue. NSString *timeDescription = (NSString *)CMTimeCopyDescription(NULL, [self.player currentTime]); NSLog(@"Passed a boundary at %@", timeDescription); [timeDescription release]; }]; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload