-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7db82a8
Showing
16 changed files
with
1,694 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// IMASampleAppDelegate.h | ||
// SampleAppV3 | ||
// | ||
// Copyright (c) 2013 Google Inc. All rights reserved. | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@class IMASampleViewController; | ||
|
||
@interface IMASampleAppDelegate : UIResponder <UIApplicationDelegate> | ||
|
||
@property(strong, nonatomic) UIWindow *window; | ||
@property(strong, nonatomic) IMASampleViewController *viewController; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// IMASampleAppDelegate.m | ||
// SampleAppV3 | ||
// | ||
// Copyright (c) 2013 Google Inc. All rights reserved. | ||
|
||
#import "IMASampleAppDelegate.h" | ||
#import "IMASampleViewController.h" | ||
|
||
@implementation IMASampleAppDelegate | ||
|
||
- (BOOL)application:(UIApplication *)application | ||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
self.viewController = [[IMASampleViewController alloc] | ||
initWithNibName:@"ViewLayout" | ||
bundle:[NSBundle mainBundle]]; | ||
self.window = [[UIWindow alloc] | ||
initWithFrame:[[UIScreen mainScreen] bounds]]; | ||
|
||
self.window.rootViewController = self.viewController; | ||
[self.window makeKeyAndVisible]; | ||
return YES; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// | ||
// IMASampleViewController.h | ||
// SampleAppV3 | ||
// | ||
// Copyright (c) 2013 Google Inc. All rights reserved. | ||
|
||
#import <AVFoundation/AVFoundation.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
// IMA SDK | ||
#import "IMAAVPlayerContentPlayhead.h" | ||
#import "IMAAd.h" | ||
#import "IMAAdsLoader.h" | ||
#import "IMAAdsManager.h" | ||
|
||
@interface IMASampleViewController : UIViewController<IMAAdsLoaderDelegate, | ||
IMAAdsManagerDelegate, | ||
IMAWebOpenerDelegate> | ||
|
||
// Outlets for the xib | ||
@property(nonatomic, strong) IBOutlet UIView *videoView; | ||
@property(nonatomic, strong) IBOutlet UIView *largeCompanionSlot; | ||
@property(nonatomic, strong) IBOutlet UIView *smallCompanionSlot; | ||
@property(nonatomic, strong) IBOutlet UIButton *playHeadButton; | ||
@property(nonatomic, strong) IBOutlet UITextField *playHeadTimeText; | ||
@property(nonatomic, strong) IBOutlet UITextField *durationTimeText; | ||
@property(nonatomic, strong) IBOutlet UISlider *progressBar; | ||
@property(nonatomic, strong) IBOutlet UITextView *console; | ||
@property(nonatomic, strong) IBOutlet UITextField *adTagUrlTextField; | ||
@property(nonatomic, strong) IBOutlet UISwitch *browserSwitch; | ||
@property(nonatomic, strong) IBOutlet UILabel *titleLabel; | ||
@property(nonatomic, strong) IBOutlet UILabel *adPodInfoLabel; | ||
@property(nonatomic, strong) IBOutlet UISwitch *useInAppSwitch; | ||
|
||
// Play button image. | ||
@property(nonatomic, strong) UIImage *playBtnBG; | ||
// Pause button image. | ||
@property(nonatomic, strong) UIImage *pauseBtnBG; | ||
// The player that plays the content. | ||
@property(nonatomic, strong) AVPlayer *contentPlayer; | ||
// Player observer for playback UI. | ||
@property(nonatomic, strong) id playHeadObserver; | ||
// The content playhead used for content tracking. | ||
@property(nonatomic, strong) IMAAVPlayerContentPlayhead *contentPlayhead; | ||
// This is used but the IMA SDK to place ads. | ||
@property(nonatomic, strong) UIView *adView; | ||
// Map of companion ad slots. | ||
@property(nonatomic, strong) NSDictionary *companionSlots; | ||
// The language sent to the ad server. | ||
@property(nonatomic, strong) NSString *language; | ||
|
||
// Google IMA classes. | ||
// The ads Loader class that requests and loads an ad. | ||
@property(nonatomic, strong) IMAAdsLoader *adsLoader; | ||
// The ads manager that plays a video ad. | ||
@property(nonatomic, strong) IMAAdsManager *adsManager; | ||
// The ads rendering settings. | ||
@property(nonatomic, strong) IMAAdsRenderingSettings *adsRenderingSettings; | ||
|
||
#pragma mark UIOutlet functions | ||
|
||
// Playhead control method. | ||
- (IBAction)onPlayPauseClicked:(id)sender; | ||
|
||
// Called when the playhead controller's value changed. | ||
- (IBAction)playHeadValueChanged:(id)sender; | ||
|
||
// Called when the Ad tag example value changed. | ||
- (IBAction)adTagValueChanged:(id)sender; | ||
|
||
// Request an ad using Google IMA SDK. | ||
- (IBAction)onRequestAds; | ||
|
||
// Forcefully unload the ad and the adsManager. | ||
- (IBAction)onUnloadAds; | ||
|
||
// Reset the state of the test app. | ||
- (IBAction)onResetState; | ||
|
||
// Toggle using the in app webview. | ||
- (IBAction)onChangeInApp; | ||
|
||
// When language button is pressed. | ||
- (IBAction)onChangeLanguage; | ||
|
||
# pragma mark Utility functions. | ||
|
||
- (void)resetAppState; | ||
- (IMASettings *)createIMASettings; | ||
|
||
// Logs a message to the app's log text field. | ||
- (void)logMessage:(NSString *)log, ...; | ||
|
||
@end |
Oops, something went wrong.