Skip to content

Commit

Permalink
Committing latest changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnbuso committed Jan 31, 2014
0 parents commit 7db82a8
Show file tree
Hide file tree
Showing 16 changed files with 1,694 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Classes/IMASampleAppDelegate.h
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
25 changes: 25 additions & 0 deletions Classes/IMASampleAppDelegate.m
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
94 changes: 94 additions & 0 deletions Classes/IMASampleViewController.h
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
Loading

0 comments on commit 7db82a8

Please sign in to comment.