AVFoundation (AVPlayer) supported formats? No .vob or .mpg containers?

The AVURLAsset class has a static methods that you can query for supported video UTIs: + (NSArray *)audiovisualTypes On 10.9.1 it returns these system defined UTIs: public.mpeg public.mpeg-2-video public.avi public.aifc-audio public.aac-audio public.mpeg-4 public.au-audio public.aiff-audio public.mp2 public.3gpp2 public.ac3-audio public.mp3 public.mpeg-2-transport-stream public.3gpp public.mpeg-4-audio Here is an explanation of system UTIs. So it seems that at least the … Read more

Avoiding blurriness at start & end of video (even after using setPreferredVideoStabilizationMode:AVCaptureVideoStabilizationModeAuto)?

Video is blurry by its nature. 24 or 30 frames per second video will always have some blur in the shot because that’s the way our eyes are tricked into believing the pictures are actually moving. The longer shutter speed allows the camera to give the impression of motion. Photos use a much shorter shutter … Read more

Play video on UITableViewCell when it is completely visible

You can use -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { isScrolling = NO; [homeTabl reloadData]; } -(void)scrollViewWillBeginDragging:(UIScrollView *)aScrollView { isScrolling = YES; [homeTabl reloadData]; index = -1; } And in cellForRowatindexpath if (fullvisible && index == indexPath.row) { if (!isScrolling) { NSLog(@”video index—%d”,indexPath.row); if (index == indexPath.row) { NSLog(@”video index—%d”,indexPath.row); cell.videoActivity.hidden = NO; // if (index == indexPath.row) { … Read more

AVPlayer And Local Files

I decided to answer my own question because I felt like there is very little documentation on how to use the Apple provided AVPlayer for both local and stream (over http) files. To help understand the solution, I put together a sample project on GitHub in Objective-C and Swift The code below is Objective-C but … Read more

AVPlayer streaming progress

I am just working on this, and so far have the following: – (NSTimeInterval) availableDuration; { NSArray *loadedTimeRanges = [[self.player currentItem] loadedTimeRanges]; CMTimeRange timeRange = [[loadedTimeRanges objectAtIndex:0] CMTimeRangeValue]; Float64 startSeconds = CMTimeGetSeconds(timeRange.start); Float64 durationSeconds = CMTimeGetSeconds(timeRange.duration); NSTimeInterval result = startSeconds + durationSeconds; return result; }

How can I check if my AVPlayer is buffering?

You can observe the values of your player.currentItem: playerItem.addObserver(self, forKeyPath: “playbackBufferEmpty”, options: .New, context: nil) playerItem.addObserver(self, forKeyPath: “playbackLikelyToKeepUp”, options: .New, context: nil) playerItem.addObserver(self, forKeyPath: “playbackBufferFull”, options: .New, context: nil) then override public func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) { if object is AVPlayerItem { switch keyPath { case “playbackBufferEmpty”: … Read more