...
If your application requires IRIS.TV's default AdaptiveStream workflow, please use Version 1.0.12 of this plugin. Versions 1.0.15 and above currently offer only the alternative Recommendation Slate workflow, used when displaying multiple upcoming video recommendations within the application's UI.
UPDATE - Version 1.1.0: Now references newer version of Brightcove SDK pod (Brightcove-Player-Core), which subsequently deprecates the BCOVCatalogService and requires use of the BrightcovePlaybackService
Version 1.0.22: Brightcove iOS SDK can pass through IMA3 settings
UPDATE - Version 1.0.18: Video request errors from the Brightcove API are now handled via event listener handleVideoRequestErrorEvent
UPDATE - Version 1.0.17: The image_url
data point has been reintroduced in the playlist
UPDATE - Version 1.0.16: Error handling for invalid video requests (see Notes section) New public function setContinuousPlay:(BOOL)contPlay to turn on/off continuous play upon completion of video playback
...
Version 1.0.11: * Plugin now loads video assets via whichever Brightcove API (Media Catalog or Playback Service) is specified in the IRIS Playback Controller constructor
Version 1.0.10: ~~New New public method queue~~ getCurrentPlaylist
to return all video objects in the playlist queue; Videos are now loaded via the Brightcove Media API; previous versions used the video content URL
...
Then, after adding CocoaPods to your project using ‘pod init’ pod init
, add the following lines to your Podfile:
Code Block |
---|
use_frameworks!
platform :ios, ‘9.0’ |
Also add the following pods:
Code Block |
---|
pod ‘Brightcove-Player- |
...
Core/dynamic’ pod ‘BCOVIRISTV’, :git => 'https://github.com/jbtv/iris_brightcove_ios_pod.git', :tag => ‘1. |
...
1. |
...
0’ |
Integration
The IRIS.TV Brightcove iOS Player plugin subclasses the Brightcove Player classes for easy integration with Brightcove’s current SDK.
To integrate into an app you must include the BCOVIRISTV.h header in file creating Brightcove Player. Beneath import statements, create strings representing a catalog token, your client token, and your IRIS access token. Also add strings representation for the video source URL and platformID: objc
Code Block |
---|
#import <BCOVIRISTV/BCOVIRISTV.h> |
...
// Customize these values with your own account information |
...
// This is your IRIS provided ID, used to identify you as a client static NSString * const kClientToken = @"yourClientToken"; |
...
// This is your Brightcove Cagalog Service Media API Token; required if using Brightcove Media API static NSString * const kViewControllerCatalogToken = @"yourBrightcoveCatalogToken"; |
...
// This is your Brightcove Playback Service Policy Key; required if using Brightcove Playback API static NSString * const kPolicyKey = @"yourBrightcovePlaybackServicePolicyKey"; |
...
// This is the URL to the video resource. You will need this if loading the initial video via URL static NSString * const kVideoURL = @"yourVideoURL"; |
...
// This is your IRIS.TV API access token provided by IRIS static NSString * const kIRISToken = @"yourIrisAccessToken"; |
...
// This is the video reference ID from the CMS static NSString * const kPlatformID = @"yourVideoPlatformID"; |
...
To create Brightcove Player:
- Class should utilize
BCOVPlaybackControllerDelegate
protocol Declare class property for playbackController:
Code Block @property (nonatomic, strong) id<BCOVPlaybackController> playbackController;
Create a custom playback controller using
BCOVIRISTV
protocol:Code Block BCOVPlayerSDKManager *manager = [BCOVPlayerSDKManager sharedManager]; // If utilizing the Brightcove Media API, use the following constructor self.playbackController = [manager createIRISTVPlaybackControllerWithCatalogToken:kViewControllerCatalogToken clientToken:kClientToken accessToken:kIRISToken]; // If utilizing the Brightcove Playback API, use this constructor instead self.playbackController = [manager createIRISTVPlaybackControllerWithPolicyKey:kPolicyKey clientToken:kClientToken accessToken:kIRISToken]; self.playbackController.autoPlay = YES; self.playbackController.delegate = self;
If the player requires a custom set of controls, simply add an alternative view strategy as a parameter to the end of the playback controller constructor to override the IRIS.TV controls:
Code Block self.playbackController = [manager createIRISTVPlaybackControllerWithCatalogToken:kViewControllerCatalogToken clientToken:kClientToken accessToken:kIRISToken viewStrategy:yourCustomViewStrategy];
**Note that custom controls are not implicitly linked to the IRIS.TV methods. These methods are publically accessible and should be called manually corresponding to new controls:
Code Block |
---|
(void)playPause; (void)playNext; (void)playPrev; (void)sliderTapped:(UIGestureRecognizer *)gestureRecognizer; (void)thumbsUp:(UIButton *)sender; (void)thumbsDown:(UIButton *)sender; |
- If using a custom number of video recommendations per IRIS.TV API call, append another parameter to the end of the playback controller constructor, where numRecs is the number of recs per call:
Code Block self.playbackController = [manager createIRISTVPlaybackControllerWithCatalogToken:kViewControllerCatalogToken clientToken:kClientToken accessToken:kIRISToken playlistLength:numRecs];
If your application requires an integration with IMA3 Ad Service, follow the 'Brightcove-Player-IMA' pod documentation, located here: https://github.com/brightcove/brightcove-player-sdk-ios-ima
Replace the
createIMAPlaybackControllerWithSettings
constructor method with the IRIS.TVcreateIRISTVPlaybackControllerWithCatalogToken
orcreateIRISTVPlaybackControllerWithPolicyKey
method, and pass the required settings through as normal:
Code Block |
---|
self.playbackController = [manager createIRISTVPlaybackControllerWithCatalogToken:kViewControllerCatalogToken clientToken:kClientToken accessToken:kIRISToken imaSettings:imaSettings adsRenderingSettings:yourAdsRenderingSettings adsRequestPolicy:yourAdsRequestPolicy adContainer:yourAdContainer companionSlots:yourCompanionSlots]; |
- If your application involves displaying upcoming recommendations:
- First, import
BCOVIRISTVPlayer.h
to your view controller's header file and addPlayListDelegate
to its protocols - Next, import
BCVVideo.h
andBCOVIRISTV.h
to your view controller's main file Then, assign the global
BCOVIRISTVPlayer
as its own PlayListDelegate in thedidAdvanceToPlaybackSession
function:
Code Block BCOVIRISTVPlayer *player = [BCOVIRISTVPlayer globalPlayer]; player.playListDelegate=self;
- To access the list of recommended videos, implement the function
-(void)updateList:(NSArray *)list {...}
, which is called each time the list of recs is updated. From here you can save and display the video objects. Note that thislist
containsBCVVideo
objects with the video's title, platform ID, and image URL.
- First, import
...
- If
...
- you
...
- want
...
- to
...
- disable
...
- automatic
...
- continuous
...
- play,
...
- calling
...
- the
...
- function
...
setContinuousPlay:(BOOL)
...
contPlay
at any time will adjust this feature's
...
- functionality
...
- Insert controller.view into video container view
...
If using the Brightcove Media API to load the initial video, add the video to the playbackController as follows:
NOTE: this method of creating a playback controller is now deprecated. See release notes above
Code Block |
---|
BCOVCatalogService *catalog = [[BCOVcatalogService alloc] initWithToken:kViewControllerCatalogToken];
[catalog findVideoWithVideoID:kPlatformID parameters:nil completion:^(BCOVVideo *video, NSDictionary *jsonResponse, NSError *error) {
if (video)
{
[self.playbackController setVideos:@[ video ]];
}
else
{
NSLog(@"ViewController Debug - Error retrieving video: `%@`", error);
}
}]; |
OR
If using the Brightcove Playback API to load the initial video, replace the setVideo statement from above with the following:
Code Block BCOVPlaybackService *service = [[BCOVPlaybackService alloc] initWithAccountId:kClientToken policyKey:kViewControllerPlaybackServicePolicyKey]; [service findVideoWithVideoID:kPlatformID parameters:nil completion:^(BCOVVideo *video, NSDictionary *jsonResponse, NSError *error) { if (video) { [self.playbackController setVideos:@[ video ]]; } else { NSLog(@"ViewController Debug - Error retrieving video: `%@`", error); } }];
For more information about your policy key, see Brightcove's documentation on Policy Keys.
OR
If loading the initial video via source URL, create the video object and add to playbackController as follows:
Code Block BCOVSource *source = [[BCOVSource alloc] initWithURL:kVideoURL]; BCOVVideo *video = [[BCOVVideo alloc] initWithSource:source cuePoints:nil properties:@{@"id": kPlatformID}]; [playbackController setVideos:@[video]];
- If the video URL uses ‘http://...' rather than ‘https://...’ protocol, your info.plist file may need the addition of the following property:
...App Transport Security Settings > Allow Arbitrary Loads - YES
If you choose to create the initial video using the source URL, please note that either a Media Catalog Token or a Playback Service Policy Key is still required for use of this plugin.
...
For an example on how to integrate this plugin, see: IrisBrightcoveExampleApp
...
Notes:
- In the unlikely event that no more unique videos are available from the Brightcove account that is in use, the following exception will be raised from within the plugin:
Code Block |
---|
[NSException raise:@"NO_MORE_RECOMMENDATIONS" format:@"no new assets: /next response object is empty"]; |
- Custom errors will also be raised in the result of an unsuccessful call to the IRIS.TV API:
Code Block |
---|
[NSException raise:@"WATCH_CALL_FAILED" format:@"IRIS.TV API /watch call unsuccessful for initial video: %@", error.description];
[NSException raise:@"UPDATE_CALL_FAILED" format:@"IRIS.TV API /update call unsuccessful: %@", error.description];
[NSException raise:@"NEXT_CALL_FAILED" format:@"IRIS.TV API /next call unsuccessful: %@", error.description]; |
- The following error will also be raised in
In the event of an unsuccessful video request to the Brightcove CMS
:
...
, the PlaylistDelegate will redirect this error through this function, which should be implemented in the native application:
Code Block -(void)handleVideoRequestErrorEvent:(NSError*)error { // Handle error here }
...
Please contact your IRIS.TV Account Executive for access to these GitHub repositories.
IRISTV Brightcove Player Plugin Architecture
...