• This repository has been archived on 26/Aug/2021
  • Stars
    star
    281
  • Rank 141,755 (Top 3 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 9 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Deprecated: Please use [PlayerKit]( https://github.com/vimeo/PlayerKit) instead.

⚠️⚠️⚠️ This library has been deprecated and will be removed in the future. Use PlayerKit instead. ⚠️⚠️⚠️

VIMVideoPlayer

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

Setup

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', {CURRENT_POD_VERSION}
end

Usage

Create a new VIMVideoPlayerView instance or set up an @IBOutlet:

@IBOutlet weak var videoPlayerView: VIMVideoPlayerView!

...

override func viewDidLoad()
{
    // Configure the player as needed
    self.videoPlayerView.player.looping = true
    self.videoPlayerView.player.disableAirplay()
    self.videoPlayerView.setVideoFillMode(AVLayerVideoGravityResizeAspectFill)
    
    self.videoPlayerView.delegate = self
}

Play a video:

// Using an NSURL

if let path = NSBundle.mainBundle().pathForResource("waterfall", ofType: "mp4")
{
    self.videoPlayerView.player.setURL(NSURL(fileURLWithPath: path))
}
else
{
    // Video file not found!
}

/* 
  Note: This must be a URL to an actual video resource (e.g. http://website.com/video.mp4 or .m3u8 etc.),
  It cannot be a URL to a web page (e.g. https://vimeo.com/67069182),
  See below for info on using VIMVideoPlayer to play Vimeo videos.
*/

// Using an AVPlayerItem

let playerItem: AVPlayerItem = ...
self.videoPlayerView.player.setPlayerItem(playerItem)
self.videoPlayerView.player.play()

// Or using an AVAsset

let asset: AVAsset = ...
self.videoPlayerView.player.setAsset(asset)
self.videoPlayerView.player.play()

Optionally implement the VIMVideoPlayerViewDelegate protocol methods:

protocol VIMVideoPlayerViewDelegate 
{    
    optional func videoPlayerViewIsReadyToPlayVideo(videoPlayerView: VIMVideoPlayerView!)
    optional func videoPlayerViewDidReachEnd(videoPlayerView: VIMVideoPlayerView!)
    optional func videoPlayerView(videoPlayerView: VIMVideoPlayerView!, timeDidChange cmTime: CMTime)
    optional func videoPlayerView(videoPlayerView: VIMVideoPlayerView!, loadedTimeRangeDidChange duration: Float)
    optional func videoPlayerViewPlaybackBufferEmpty(videoPlayerView: VIMVideoPlayerView!)
    optional func videoPlayerViewPlaybackLikelyToKeepUp(videoPlayerView: VIMVideoPlayerView!)
    optional func videoPlayerView(videoPlayerView: VIMVideoPlayerView!, didFailWithError error: NSError!)
}

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.

Found an Issue?

Please file it in the git issue tracker.

Want to Contribute?

If you'd like to contribute, please follow our guidelines found in CONTRIBUTING.md.

License

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

Questions?

Tweet at us here: @vimeoapi.

Post on Stackoverflow with the tag vimeo-ios.

Get in touch here.

Interested in working at Vimeo? We're hiring!

More Repositories

1

psalm

A static analysis tool for finding errors in PHP applications
PHP
5,435
star
2

player.js

Interact with and control an embedded Vimeo Player.
JavaScript
1,413
star
3

graph-explorer

A graphite dashboard powered by structured metrics
Python
1,060
star
4

php-mysql-engine

A MySQL engine written in pure PHP
PHP
544
star
5

player-api

Examples for our JavaScript and ActionScript player APIs.
450
star
6

vimeo.php

Official PHP library for the Vimeo API.
PHP
445
star
7

laravel

A Vimeo bridge for Laravel
PHP
384
star
8

stag-java

Speedy Type Adapter Generation
Java
351
star
9

vimeo.js

Official Node.js library for the Vimeo API.
JavaScript
263
star
10

vimeo-oembed-examples

Some examples of how to use our oEmbed endpoint
HTML
237
star
11

vimeo.py

Official Python library for the Vimeo API.
Python
210
star
12

vimeo-unity-sdk

Easily stream your Vimeo videos into Unity or record and publish out to Vimeo.
C#
208
star
13

graphite-influxdb

An influxdb backend for Graphite-web and graphite-api
Python
198
star
14

vimeo-php-lib

Our official PHP library for the Advanced API.
PHP
180
star
15

tailgate

Tailgate is a nodejs app to pipe `tail -F` into websockets. It's a very simple way to have real-time access to your logs.
JavaScript
164
star
16

ABLincoln

A library for online experiments.
PHP
154
star
17

PlayerKit

Swift
154
star
18

vimeo-networking-java

The Vimeo Java (Android) SDK
Kotlin
122
star
19

py-money

Money class for Python 3
Python
121
star
20

vimeo-threejs-player

A plugin for streaming video from Vimeo to WebGL/VR/AR apps
JavaScript
88
star
21

tattletale.js

A utility to send console logs over XHR for server-side processing.
JavaScript
87
star
22

VimeoNetworking

The Vimeo API iOS SDK
Swift
83
star
23

vimeo-depth-player

A WebVR volumetric video renderer that uses color-depth based videos hosted on Vimeo.
JavaScript
83
star
24

aframe-vimeo-component

Stream Vimeo videos into WebVR.
JavaScript
81
star
25

simple-black-box

A simple black-box behavior testing framework
Shell
68
star
26

pentagon

Vault <-> Kubernetes Secrets
Go
59
star
27

VimeoUpload

The Vimeo iOS Upload SDK
Swift
59
star
28

whisper-to-influxdb

migrate (import) graphite data from whisper to influxdb
Go
58
star
29

smoketcp

Smokeping like tcp connectivity tester, reports to statsd. written in Golang
Go
58
star
30

VIMNetworking

The Vimeo iOS SDK
Objective-C
58
star
31

libvmod-boltsort

A fast Varnish module for sorting query string parameters.
C
58
star
32

vimeo-depth-viewer

OpenGL application for viewing depth and color video streams from Intel RealSense cameras
C++
52
star
33

iris

Vimeo Design System
TypeScript
50
star
34

carbon-tagger

native tag-based metrics for graphite/carbon
Go
50
star
35

go-util

Small reusable Go functions.
Go
44
star
36

Blueprint

aka How We Collaborate
41
star
37

graphite-api-influxdb-docker

docker image with graphite-api and graphite-influxdb
Shell
39
star
38

go-magic

Go Bindings for libmagic and an idiomatic API for getting a file's MIME type.
Go
39
star
39

rollup-plugin-bundle-size

A rollup plugin to show the size of the generated bundle(s).
JavaScript
29
star
40

vimeo-maxmsp

Play and manipulate Vimeo videos in Max/MSP and Jitter
Max
24
star
41

openapi

An OpenAPI specification for the Vimeo API.
17
star
42

VIMDeeplink

Simple Objc and Swift wrappers around the Vimeo iOS deeplink API
Swift
17
star
43

puppet-diamond

diamond module for puppet
Puppet
15
star
44

nagios-cloudwatch-plugin

AWS CloudWatch check Nagios plugin
Python
14
star
45

elevator

Validate and patch AV1 levels
Rust
12
star
46

puppet-statsd

statsd module for puppet
Puppet
11
star
47

VIMUpload

This library has been deprecated, use VimeoUpload instead
Objective-C
11
star
48

go-hammer

Go
10
star
49

VIMObjectMapper

An automatic JSON to model object converter
Objective-C
10
star
50

babel-plugin-transform-i18n

A Babel transform plugin to replace strings with their translations.
JavaScript
10
star
51

dials

Dials is an extensible configuration package for Go.
Go
9
star
52

go-clocks

A convenient package providing a Clock abstraction in Go
Go
9
star
53

go-taglog

Based on, and compatible with, the Go standard log package, but also provides additional functionality and features such as tagging.
Go
8
star
54

leaderelection

Go
8
star
55

ios-labs-staffpicks

An iOS Labs sample project
Swift
7
star
56

zendesk-ticket-history

JavaScript
7
star
57

grouplogger

Go
6
star
58

netstorage

go client for the new Akamai Netstorage http api
Go
6
star
59

caps

Go package to read/write popular video caption formats(mostly a port of pycaption)
Go
6
star
60

Uniform

Swift
6
star
61

alog

Another Go Logging Package
Go
5
star
62

vimeo-live-player-examples

Example application for using Vimeo Live M3U8 links with third-party players
HTML
5
star
63

graph-explorer-docker

Shell
5
star
64

eslint-config-player

ESLint config for all player team projects.
JavaScript
5
star
65

go-iccjpeg

A small utility package to extract ICC profiles from JPEGs.
Go
4
star
66

graphite-go

Go
4
star
67

go-retry

A small package for doing comprehensive retries.
Go
4
star
68

go-imgparse

A small go library to efficiently parse the resolution of various image format streams.
Go
4
star
69

vimeo-deeplink-android

A helper library to deep link into the official Vimeo Android App
Java
3
star
70

payment-gateway-logger

PHP
3
star
71

av1stats

An AV1 stream analysis CLI tool
Rust
3
star
72

omnipay-bluesnap

BlueSnap driver for the Omnipay PHP payment processing library
PHP
3
star
73

genepool

A golang package for building generic workpools in a standardized way
Go
2
star
74

omnipay-vindicia

Vindicia driver for the Omnipay PHP payment processing library
PHP
2
star
75

VimeoCommon

1
star
76

k8swatcher

Convenient watching interface for Kubernetes.
Go
1
star
77

policy

1
star