Latest 5.7.1
License MIT
Platforms ios 7.0, requires ARC
Authors , , , , , , ,


VIMVideoPlayer is a simple wrapper around the AVPlayer and AVPlayerLayer classes.


Add the VIMVideoPlayerView and VIMVideoPlayer classes to your project.

Do this by including this repo as a git submodule or by using cocoapods:

# Add this to your podfile
target 'MyTarget' do
    pod 'VIMVideoPlayer', ‘{version_number}’


Create a new VIMVideoPlayerView and add it to your view hierarchy:

#import "VIMVideoPlayerView.h"


- (void)viewDidLoad
    [super viewDidLoad];

    self.videoPlayerView = [[VIMVideoPlayerView alloc] init];
    self.videoPlayerView.translatesAutoresizingMaskIntoConstraints = NO;
    self.videoPlayerView.delegate = self;

    [self.videoPlayerView setVideoFillMode:AVLayerVideoGravityResizeAspect];
    [self.videoPlayerView.player enableTimeUpdates];
    [self.videoPlayerView.player enableAirplay];

    [self.view addSubview:self.videoPlayerView];

    NSDictionary *views = NSDictionaryOfVariableBindings(_videoPlayerView);
    [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[_videoPlayerView]-0-|" options:0   metrics:nil views:views]];
    [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[_videoPlayerView]-0-|" options:0   metrics:nil views:views]];

Play a video:

// Using an NSURL

NSURL *URL = ...; 
[self.videoPlayerView.player setURL:URL];
[self.videoPlayerView.player play];

  Note: This must be a URL to an actual video resource (e.g. or .m3u8 etc.),
  It cannot be a URL to a web page (e.g.,
  See below for info on using VIMVideoPlayer to play Vimeo videos.

// Using an AVPlayerItem

AVPlayerItem *playerItem = ...;
[self.videoPlayerView.player setPlayerItem:playerItem];
[self.videoPlayerView.player play];

// Or using an AVAsset

AVAsset *asset = ...;
[self.videoPlayerView.player setAsset:asset];
[self.videoPlayerView.player play];

Optionally implement the VIMVideoPlayerViewDelegate protocol methods:

@protocol VIMVideoPlayerViewDelegate <NSObject>

- (void)videoPlayerViewIsReadyToPlayVideo:(VIMVideoPlayerView *)videoPlayerView;
- (void)videoPlayerViewDidReachEnd:(VIMVideoPlayerView *)videoPlayerView;
- (void)videoPlayerView:(VIMVideoPlayerView *)videoPlayerView timeDidChange:(CMTime)cmTime;
- (void)videoPlayerView:(VIMVideoPlayerView *)videoPlayerView loadedTimeRangeDidChange:(float)duration;
- (void)videoPlayerView:(VIMVideoPlayerView *)videoPlayerView didFailWithError:(NSError *)error;


See VIMVideoPlayer.h for additional configuration options.

Playing Vimeo Videos

Vimeo Pro members can access playback URLs for Vimeo videos using the Vimeo API. Playback URLs are only included in the response object if the requesting account is a Vimeo Pro account.

If you have a Vimeo Pro account, when you make a request to the Vimeo API for a video object the response object will contain a list of video files. These represent the various resolution video files available for this particular video. Each has a link. You can use the string value keyed to link to create an NSURL. You can pass this NSURL to VIMVideoPlayer for playback.

Check out this Stack Overflow question for additional info.

You can use the Vimeo iOS SDK to interact with the Vimeo API.

For full documentation on the Vimeo API go here.


VIMVideoPlayer is available under the MIT license. See the LICENSE file for more info.


Tweet at us here: @vimeoapi

Post on Stackoverflow with the tag vimeo-ios

Get in touch here

Latest podspec

    "name": "FVIMVideoPlayer",
    "version": "5.7.1",
    "summary": "A simple wrapper around the AVPlayer and AVPlayerLayer classes.",
    "description": "VIMVideoPlayer is a simple wrapper around the AVPlayer and AVPlayerLayer classes. Check out the README for details. And the Pegasus project for a demo.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": ""
    "authors": {
        "Alfie Hanssen": "[email protected]",
        "Rob Huebner": "[email protected]",
        "Gavin King": "[email protected]",
        "Kashif Muhammad": "[email protected]",
        "Andrew Whitcomb": "[email protected]",
        "Stephen Fredieu": "[email protected]",
        "Rahul Kumar": "[email protected]",
        "Yongliang Wang": "[email protected]"
    "social_media_url": "",
    "platforms": {
        "ios": "7.0"
    "source": {
        "git": "",
        "tag": "5.7.1"
    "source_files": [
    "exclude_files": "VIMVideoPlayer/Exclude",
    "resources": "VIMVideoPlayer/*.png",
    "requires_arc": true

Pin It on Pinterest

Share This