One Quickie


Duration of a movie file (Random->General)
Got some movie files on disk living at a particular URL? Need to know the duration of the video?
- (NSTimeInterval) timeOfVideoAtURL: (NSURL *) url {
    AVPlayerItem *movieItem = [AVPlayerItem playerItemWithURL: url];

    CMTime duration = movieItem.duration;
    Float64 seconds = CMTimeGetSeconds (duration);

    return (NSTimeInterval)seconds;

} // timeOfVideoAtURL



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com