21 Commits

Author SHA1 Message Date
Alfie Hanssen 088d368709 bumped version in podspec 2015-08-27 13:51:20 -04:00
Alfie Hanssen 4508acf2ed Merge pull request #17 from vimeo/vim-2669
VIM-2669
2015-08-26 17:20:16 -04:00
Alfie Hanssen 7ae3643508 added an assertion 2015-08-26 17:18:18 -04:00
Alfie Hanssen d6047dc471 Merge pull request #16 from vimeo/pod-authors
update podspec authors
2015-08-26 16:56:14 -04:00
Alfie Hanssen 3724c3000c changing property name for playerItem 2015-08-26 16:39:36 -04:00
Alfie Hanssen 38f28c9e3a potential fix for KVO crash related to not removing observers from currentItem before deallocation of item 2015-08-26 16:27:04 -04:00
Rob Huebner 5b3134f094 add some more authors 2015-08-20 11:37:06 -04:00
Rob Huebner 85efea0363 update podspec authors 2015-08-19 12:21:42 -04:00
Alfie Hanssen dd8b5b9dc6 updated podspec 2015-08-14 17:33:42 -04:00
Alfie Hanssen 5775bbc2af Merge pull request #15 from vimeo/vim-2661
Fix for crash where av player status == failed but there's no nserror
2015-08-13 11:56:38 -04:00
Alfie Hanssen 0a9707d68f fix for crash where av player status == failed but theres no nserror 2015-08-10 14:22:49 -04:00
Rob Huebner c1c2f93793 updated podspec 2015-07-31 17:27:47 -04:00
Gavin King 3454df7198 formatting 2015-07-29 14:27:39 -04:00
Gavin King 5545e1bc43 Merge pull request #14 from efremidze/master
Added initializers (storyboard support)
2015-07-29 14:04:57 -04:00
Lasha Efremidze 367b516abd Update VIMVideoPlayerView.m
Added required initializers
2015-07-18 22:08:37 -07:00
Alfie Hanssen de0957a62b syntax error in podspec 2015-07-15 08:42:49 -04:00
Alfie Hanssen 9ce6b9092c updated podspec version 2015-07-15 08:40:28 -04:00
Alfie Hanssen 7e32ee3482 Update README.md 2015-06-08 09:14:35 -07:00
Alfie Hanssen 0d188c8228 Update README.md 2015-06-02 16:03:10 -04:00
Alfie Hanssen 840d01e1b0 pod version 2015-06-02 15:17:12 -04:00
Alfie Hanssen 5c39ae71a7 podspec pointed at tag 2015-06-02 15:13:58 -04:00
4 changed files with 70 additions and 99 deletions
+10 -1
View File
@@ -1,11 +1,20 @@
# VIMVideoPlayer
`VIMVideoPlayer` is a simple wrapper around the [`AVPlayer`](https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVPlayer_Class/index.html) and [`AVPlayerLayer`](https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVPlayerLayer_Class/index.html#//apple_ref/occ/cl/AVPlayerLayer) classes.
`VIMVideoPlayer` is a simple wrapper around the [`AVPlayer`](https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVPlayer_Class/index.html) and [`AVPlayerLayer`](https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVPlayerLayer_Class/index.html#//apple_ref/occ/cl/AVPlayerLayer) classes. Check out the [Pegasus](https://github.com/vimeo/Pegasus) project for a demo.
## Setup
Add the `VIMVideoPlayerView` and `VIMVideoPlayer` classes to your project.
Do this by including it as a git submodule or by using cocoapods:
```Ruby
# Add this to your podfile
target 'MyTarget' do
pod 'VIMVideoPlayer', '5.4.2'
end
```
## Usage
Create a new `VIMVideoPlayerView` and add it to your view hierarchy:
+10 -83
View File
@@ -8,56 +8,26 @@
Pod::Spec.new do |s|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# These will help people to find your library, and whilst it
# can feel like a chore to fill in it's definitely to your advantage. The
# summary should be tweet-length, and the description more in depth.
#
s.name = "VIMVideoPlayer"
s.version = "0.0.1"
s.version = "5.5.5"
s.summary = "A simple wrapper around the AVPlayer and AVPlayerLayer classes."
s.description = <<-DESC
VIMVideoPlayer is a simple wrapper around the AVPlayer and AVPlayerLayer classes. Check out the README for details. And the Pegasus project for a demo.
DESC
s.homepage = "https://github.com/vimeo/VIMVideoPlayer"
# s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
# ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Licensing your code is important. See http://choosealicense.com for more info.
# CocoaPods will detect a license file if there is a named LICENSE*
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
#
s.license = "MIT"
s.license = { :type => "MIT", :file => "LICENSE.md" }
s.authors = { "Alfie Hanssen" => "alfiehanssen@gmail.com",
"Rob Huebner" => "robh@vimeo.com",
"Gavin King" => "gavin@vimeo.com",
"Kashif Muhammad" => "support@vimeo.com",
"Andrew Whitcomb" => "support@vimeo.com",
"Stephen Fredieu" => "support@vimeo.com",
"Rahul Kumar" => "support@vimeo.com" }
# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the authors of the library, with email addresses. Email addresses
# of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
# accepts just a name if you'd rather not provide an email address.
#
# Specify a social_media_url where others can refer to, for example a twitter
# profile URL.
#
s.author = { "Alfie Hanssen" => "alfiehanssen@gmail.com" }
# Or just: s.author = "Alfie Hanssen"
# s.authors = { "Alfie Hanssen" => "alfiehanssen@gmail.com" }
# s.social_media_url = "http://twitter.com/vimeo
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If this Pod runs only on iOS or OS X, then specify the platform and
# the deployment target. You can optionally include the target after the platform.
#
s.social_media_url = "http://twitter.com/vimeo"
# s.platform = :ios
# s.platform = :ios, "7.0"
@@ -67,43 +37,10 @@ Pod::Spec.new do |s|
# s.osx.deployment_target = "10.7"
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the location from where the source should be retrieved.
# Supports git, hg, bzr, svn and HTTP.
#
s.source = { :git => "https://github.com/vimeo/VIMVideoPlayer.git", :branch => "cocoapods" }
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# CocoaPods is smart about how it includes source code. For source files
# giving a folder will include any swift, h, m, mm, c & cpp files.
# For header files it will include any header in the folder.
# Not including the public_header_files will make all headers public.
#
s.source = { :git => "https://github.com/vimeo/VIMVideoPlayer.git", :tag => s.version.to_s }
s.source_files = "VIMVideoPlayer", "VIMVideoPlayer/*.{h,m}"
s.exclude_files = "VIMVideoPlayer/Exclude"
# s.public_header_files = "Classes/**/*.h"
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# A list of resources included with the Pod. These are copied into the
# target bundle with a build phase script. Anything else will be cleaned.
# You can preserve files from being cleaned, please don't preserve
# non-essential files like tests, examples and documentation.
#
# s.resource = "icon.png"
# s.resources = "Resources/*.png"
# s.preserve_paths = "FilesToSave", "MoreFilesToSave"
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Link your library with frameworks, or libraries. Libraries do not include
@@ -116,16 +53,6 @@ Pod::Spec.new do |s|
# s.library = "iconv"
# s.libraries = "iconv", "xml2"
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If your library depends on compiler flags you can set them in the xcconfig hash
# where they will only apply to your library. If you depend on other Podspecs
# you can include multiple dependencies to ensure it works.
s.requires_arc = true
# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
# s.dependency "AFNetworking", "~> 2.5.3"
end
+25 -8
View File
@@ -55,6 +55,8 @@ static void *VideoPlayer_PlayerItemLoadedTimeRangesContext = &VideoPlayer_Player
@property (nonatomic, assign) BOOL isTimingUpdateEnabled;
@property (nonatomic, strong) id timeObserverToken;
@property (nonatomic, strong) AVPlayerItem *item;
@end
@implementation VIMVideoPlayer
@@ -68,8 +70,6 @@ static void *VideoPlayer_PlayerItemLoadedTimeRangesContext = &VideoPlayer_Player
[self removeTimeObserver];
[self cancelFadeVolume];
NSLog(@"dealloc");
}
- (instancetype)init
@@ -407,11 +407,13 @@ static void *VideoPlayer_PlayerItemLoadedTimeRangesContext = &VideoPlayer_Player
- (void)resetPlayerItemIfNecessary
{
if (self.player.currentItem)
if (self.item)
{
[self removePlayerItemObservers:self.player.currentItem];
[self removePlayerItemObservers:self.item];
[self.player replaceCurrentItemWithPlayerItem:nil];
self.item = nil;
}
_volumeFadeDuration = DefaultVolumeFadeDuration;
@@ -424,6 +426,10 @@ static void *VideoPlayer_PlayerItemLoadedTimeRangesContext = &VideoPlayer_Player
- (void)preparePlayerItem:(AVPlayerItem *)playerItem
{
NSParameterAssert(playerItem);
self.item = playerItem;
[self addPlayerItemObservers:playerItem];
[self.player replaceCurrentItemWithPlayerItem:playerItem];
@@ -702,14 +708,25 @@ static void *VideoPlayer_PlayerItemLoadedTimeRangesContext = &VideoPlayer_Player
}
case AVPlayerItemStatusFailed:
{
NSLog(@"Video player Status Failed: error = %@", self.player.currentItem.error);
NSLog(@"Video player Status Failed: player item error = %@", self.player.currentItem.error);
NSLog(@"Video player Status Failed: player error = %@", self.player.error);
NSError *error = self.player.error;
if (!error)
{
error = self.player.currentItem.error;
}
else
{
error = [NSError errorWithDomain:kVideoPlayerErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"unknown player error, status == AVPlayerItemStatusFailed"}];
}
[self reset];
if ([self.delegate respondsToSelector:@selector(videoPlayer:didFailWithError:)])
{
[self reset];
dispatch_async(dispatch_get_main_queue(), ^{
[self.delegate videoPlayer:self didFailWithError:self.player.currentItem.error];
[self.delegate videoPlayer:self didFailWithError:error];
});
}
+25 -7
View File
@@ -40,21 +40,39 @@
[self detachPlayer];
}
- (instancetype)init
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super init];
self = [super initWithFrame:frame];
if (self)
{
_player = [[VIMVideoPlayer alloc] init];
_player.muted = YES;
_player.looping = YES;
[self attachPlayer];
[self commonInit];
}
return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self)
{
[self commonInit];
}
return self;
}
- (void)commonInit
{
_player = [[VIMVideoPlayer alloc] init];
_player.muted = YES;
_player.looping = YES;
[self attachPlayer];
}
#pragma mark - Public API
- (void)setPlayer:(VIMVideoPlayer *)player