The Brightcove iPad iPhone Kit is a Cocoa/Objective-C Library for playing back your Brightcove content on iOS 3.1 and greater.
The BCMoviePlayerController class inherits from the Apple MPMoviePlayerController class. This is done to give you more controll over how your video player is displayed and exposes the increased functionality that Apple has given developers. We are moving away from the fullscreen only experience that didn't give developers the control they need over the playback experience. The BCMoviePlayerController injects things like exstracting the correct url to play back into the MPMoviePlayerController classes flow. The Brightcove specific methods exposed are setContentURL:(BCVideo *) video, searchForRenditionsBetweenLowBitRate:(int) lowBitRate andHighBitRate:(int) highBitRate and initWithContentURL:(BCVideo *) video searchForRenditionWithLowBitRate:(NSNumber *) lowBitRate andHighBitRate:(NSNumber *) highBitRate;. These port over the major parts of the BCPlayer class that deal with video playback. To make sure the Brightcove code interacts with the MPMoviePlayerController correctly you need to follow one of the following flows.
Flow 1 OS Targets: iOS 3.2 and greater Description: This flow is best used when you are targeting iOS 3.2 currently only on the iPad and iOS 4 currently only on the iPhone (3G, 3GS & 4). Linked Library Type: Required
(1) Create the object with the init method and not any other convienence methods.
BCMoviePlayerController *player = [[BCMoviePlayerController alloc] init];
(2) If you want to use the searchForRenditionsBetweenLowBitRate:andHighBitRate: method you have to call it before you set the content.
[player searchForRenditionsBetweenLowBitRate:[NSNumber numberWithInt:200000] andHighBitRate:[NSNumber numberWithInt:300000]];
(3) Finally you set the content, this can be done before or after you have added the player to a view.
[player setContentURL:myVideo];
// Don't forget to include this line in your source: #import "BCMoviePlayerController.h" BCMoviePlayerController *player = [[BCMoviePlayerController alloc] init]; [player setContentURL:self.video]; // video fetched via the media apis, type is BCVideo CGRect rect = CGRectMake(0.0f, 0.0f, 480.0f, 320.0f); UIView *pView = player.view; [pView setFrame:rect]; [self.view addSubview:player.view];
Flow 2 OS Targets: iOS 3.1 and greater Description: This flow allows you to develop code that will run on 3.1 and greater with out using any runtime checking to see what OS version you are running. Linked Library Type: Weak
(1) Create the object with the initWithContentURL: searchForRenditionWithLowBitRate: andHighBitRate: method. If you do not want to change the default bit-rates that we search for 200000 - 500000 you can pass nil for the last two params.
BCMoviePlayerController *player = [[BCMoviePlayerController alloc] initWithContentURL:self.video searchForRenditionWithLowBitRate:[NSNumber numberWithInt:200000] andHighBitRate:[NSNumber numberWithInt:300000]];
(2) Call the play method to start playback
[player play];