Build a Sender Application for iOS
Step 1: Set Up Your Environment
- Download the Ooyala SDK for iOS from the Ooyala Mobile and Client SDKs Downloads Page.
- Download the Cast SDK for iOS.
- Download the ChromecastSampleApp from the Ooyala SDK for iOS Sample Apps repository.
- Install the iOS Sender API libraries for GoogleCastFramework 2.2.1 or later on your system (see https://developers.google.com/cast/docs/ios_sender).
- Review the iOS sender application development details on the Google Developers portal.
|OOCastPlayer||The interface between Chromecast device and sender app. It is the object that sends/receives messages. It listens to the action from Ooyala CoreSDK and send the action to the receiver app, and it also listens to the message from the receiver app and transfers it to Ooyala Core SDK.|
|OOCastManager||The interface between customer application/CoreSDK and the OOCastPlayer. It manages the switch between "cast mode" and "local playback mode" and all basic connections between the sender app and the chromecast device.|
Step 2: Integrate with the Sender ApplicationUse the following steps to integrate with the sender application UIViewController with OOOoyalaPlayer (where the UIViewController in the sender application contains a player).
- Initial Configuration. Open the ChromecastSampleApp project in Xcode.
- Make sure you have -ObjC linker flag enabled.
- Link the following libraries as static libraries:
OoyalaSDK.framework OoyalaCastSDK.framework GoogleCast.framework libz.dylib
- Initialize the Cast Manager. Open OOCastManagerFetcher.m and specify your own App
ID and NameSpace values:
App ID The ID you were given when you register the receiver app with which you are trying to connect. NameSpace The namespace to identify the protocol of the message being sent for the related receiver app.Note: The namespace should not be changed unless you modify the receiver app source code.
Step 3: Configure the Mini Controller (Default) for iOSReview the following content for information about configuring the mini controller using the Ooyala mobile SDK for iOS.
- Open CustomizedMiniControllerView.m. Replace the values of pauseImage and playImage with your own.
- Replace ooyala_logo.png with your own image.
Step 4: Customize the iOS Sender Application
- (Recommended) Uses Google Cast Custom Channel namespace to pass messages.
- Uses the Cast Message Bus via Custom Channel to facilitate the following:
- Transmits the embed_code and player_branding_id to the receiver application for launch of the Ooyala Player V4.
- Transmits basic player functions (stop, play, pause etc.) to the receiver application to control the Ooyala Player V4.
- Via Custom Channel Listener, receives Ooyala related player errors based on player message bus events and translates them to application-friendly user messages. An example use case is if the Ooyala Device Management feature is used. The /last_Result messages are published in the player message bus and passed back to the sender; based on these results, the appropriate message is passed back to the application.
- Customized Mini Controller. Open CustomizedMiniControllerView.m and adjust the values according to your application needs. The remaining steps apply to the customized mini controller.
- Take the castManager as a property in your class.
- Instantiate play/pause the casting video through [self.castManager.castPlayer play]/[self.castManager.castPlayer pause].
- Update the play/pause button image.
- Manage cast mode video view (The UIView fills in the blank video view in OOOoyalaPlayer when casting video).
- Set the castModeVideoView in castManager as shown in the following code sample: [self.castManager setCastModeVideoView:videoView]; This view is displayed in the videoView of OOOoyalaPlayer when casting the video.
Debugging a Sender Application
Use the function printDebugMessage to dynamically debug the Chrome developer tools console output about sender commands and Ooyala Player events. Media status objects can be monitored on the receiver debug console with the MediaManager.customizedStatusCallback function. You can customize which events are reported to the logs and select to see errors from the Chromecast and/or Ooyala namespace.
Open a browser window and point it to the IP address of the Chromecast unit (port 9222). For more information on how to debug from this point, go to Google’s Chromecast Developer Guide topic on debugging and Google's topic on handling Cast Media error messages.
|OOCastManagerFailToConnectNotification||This notification is sent when a OOCastManager fails to connect to a chromecast device.|
|OOCastDeviceLostNotification||This notification is sent when a chromecast device lost. It does not mean the connection to the device was lost.|
|OOCastManagerDidDisconnectNotification||This notification is sent when a castManager disconnects from chromecast device.|
|OOCastEnterCastModeNotification||This notification is sent when the app enters cast mode.|
|OOCastExitCastModeNotification||This notification is sent when the app exits cast mode.|
|OOCastMiniControllerClickedNotification||This notification is sent when a mini controller event is activated.|