Skip to content

Commit

Permalink
Initial commit. v0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tensafefrogs committed Dec 18, 2013
0 parents commit 2e7d967
Show file tree
Hide file tree
Showing 66 changed files with 4,461 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Xcode
.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap

#CocoaPods
Pods
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# GoogleMediaFramework CHANGELOG

## 0.1.0

Initial release. We are looking for feedback and bug reports, please file an issue in the Github project page.

Features:
- Basic video playback of iOS system supported video formats
- Demo app integrated with Google IMA ads SDK (optional when using the player)

26 changes: 26 additions & 0 deletions GoogleMediaFramework.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Be sure to run `pod spec lint NAME.podspec' to ensure this is a
# valid spec and remove all comments before submitting the spec.
#
# To learn more about the attributes see http://docs.cocoapods.org/specification.html
#
Pod::Spec.new do |s|
s.name = "GoogleMediaFramework"
s.version = "0.1.0"
s.summary = "A video player framework for playing videos. Integrates easily with the Google IMA SDK for including advertising on your videos."
s.homepage = "https://github.com/googleads/Google-Media-Framework-iOS"
s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" }
s.author = "Google"
s.source = { :git => "https://github.com/googleads/Google-Media-Framework-iOS.git", :tag => s.version.to_s }

s.platform = :ios, '5.0'
s.requires_arc = true

s.source_files = 'GoogleMediaFramework'
s.resources = 'Resources/*'

#s.public_header_files = 'GoogleMediaFramework/GoogleMediaFramework.h'

# s.frameworks = 'SomeFramework', 'AnotherFramework'
end
25 changes: 25 additions & 0 deletions GoogleMediaFramework/GMFAdService.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2013 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <Foundation/Foundation.h>

#import "GMFPlayerViewController.h"

@interface GMFAdService : NSObject

@property(nonatomic, weak) GMFPlayerViewController *videoPlayerController;

- (id)initWithGMFVideoPlayer:(GMFPlayerViewController* )videoPlayerController;

@end
67 changes: 67 additions & 0 deletions GoogleMediaFramework/GMFAdService.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright 2013 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif

#import "GMFAdService.h"

@implementation GMFAdService

- (id)init {
NSAssert(false, @"init not available, use initWithGMFVideoPlayer.");
return nil;
}

// Designated initializer
- (id)initWithGMFVideoPlayer:(GMFPlayerViewController *)videoPlayerController {
self = [super init];
if (self) {
_videoPlayerController = videoPlayerController;

// Listen for playback finished event. See GMFPlayerFinishReason.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playbackWillFinish:)
name:kGMFPlayerStateWillChangeToFinishedNotification
object:_videoPlayerController];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playbackDidFinish:)
name:kGMFPlayerStateDidChangeToFinishedNotification
object:_videoPlayerController];
}
return self;
}

- (void)playbackWillFinish:(NSNotification *)notification {
// Override this in your AdService class to play any postrolls or post-content events.
}

- (void)playbackDidFinish:(NSNotification *)notification {
// After playbackWillFinish
}

- (void)dealloc {
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:kGMFPlayerStateWillChangeToFinishedNotification
object:nil];
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:kGMFPlayerStateDidChangeToFinishedNotification
object:nil];
}

@end
32 changes: 32 additions & 0 deletions GoogleMediaFramework/GMFPlayerControlsProtocol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2013 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <Foundation/Foundation.h>

@protocol GMFPlayerControlsProtocol<NSObject>

// These are all mutually exclusive. E.g. calling showPlayButton hides all the
// other views and shows the play button. Only one can be shown at a time.
- (void)showPlayButton;
- (void)showPauseButton;
- (void)showReplayButton;

- (void)enableSeekbarInteraction;
- (void)disableSeekbarInteraction;
- (void)setSeekbarTrackColor:(UIColor *)color;

- (void)setTotalTime:(NSTimeInterval)totalTime;
- (void)setMediaTime:(NSTimeInterval)mediaTime;

@end
62 changes: 62 additions & 0 deletions GoogleMediaFramework/GMFPlayerControlsView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright 2013 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <UIKit/UIKit.h>

@protocol GMFPlayerControlsViewDelegate <NSObject>

- (void)didPressPlay;
- (void)didPressPause;
- (void)didPressReplay;
- (void)didPressMinimize;

// User seeked to a given time relative to the start of the video.
- (void)didSeekToTime:(NSTimeInterval)time;
- (void)didStartScrubbing;
- (void)didEndScrubbing;

@end

@interface GMFPlayerControlsView : UIView

// Toggle visibility among play, pause, and replay buttons.
- (void)showPlayButton;
- (void)showPauseButton;
- (void)showReplayButton;

// Set the total duration of the video. May be NaN or Infinity if the
// total time is unknown. Call updateScrubberAndTime to make the change visible.
- (void)setTotalTime:(NSTimeInterval)totalTime;

// Set the amount of video downloaded. Call updateScrubberAndTime to make
// the change visible.
- (void)setDownloadedTime:(NSTimeInterval)downloadedTime;

// Set the current position of the scrubber within the total video duration.
// Call updateScrubberAndTime to make the change visible.
- (void)setMediaTime:(NSTimeInterval)mediaTime;

- (void)updateScrubberAndTime;

- (CGFloat)preferredHeight;

- (void)setDelegate:(id<GMFPlayerControlsViewDelegate>)delegate;

- (void)setSeekbarTrackColor:(UIColor *)color;

- (void)disableSeekbarInteraction;
- (void)enableSeekbarInteraction;

@end

Loading

0 comments on commit 2e7d967

Please sign in to comment.