/AVPlayerCacheSupport

iOS音频边播放边缓存

Primary LanguageObjective-C

AVPlayerCacheSupport

An easy way to add cache for AVPlayer.

Features

  • Cache http streaming data For AVPlayer
  • Support both audio & video http streaming (except m3u or other playlist format, e.g. HTTP Live Streaming, take a look at this post)
  • Byte range access & cache
  • Simple API
  • Cache management

Install

Drag the folder named AVPlayerCacheSupport into your project.

Usage

Before

AVPlayerItem *item = [AVPlayerItem playerItemWithURL:url];
self.player = [[AVPlayer alloc] initWithPlayerItem:playerItem];

Now, with cache support

#import "AVPlayerItem+MCCacheSupport.h"

AVPlayerItem *item = [AVPlayerItem mc_playerItemWithRemoteURL:url];
self.player = [[AVPlayer alloc] initWithPlayerItem:playerItem];

Requries

  • iOS 7.0+ or MacOSX 10.9+

License

MIT

Demo

Sitting on WWDC 2015 sample code AVFoundationQueuePlayer-iOS.