This document describes how to create an OpenTok Interactive Broadcast Solution mobile app for iOS. You will learn how to set up the API calls to use the admin ID for the backend account, set up the role and name of the mobile participant, and connect the participant with a specified event.
This guide has the following sections:
- Prerequisites: A checklist of everything you need to get started.
- Create your first Interactive Broadcast Solution application: A step by step tutorial to help you develop a basic Interactive Broadcast Solution application.
NOTE: The Interactive Broadcast Solution only supports landscape orientation on mobile devices.
- Xcode version 8 or later.
- Download the iOS Interactive Broadcast Solution Framework provided by TokBox.
- You will need the Admin ID and Backend Base URL provided by TokBox.
NOTE: To get the iOS Interactive Broadcast Solution Framework, Admin ID, and Backend Base URL, contact <a mailto:"[email protected]">[email protected].
IMPORTANT: In order to deploy the OpenTok Interactive Broadcast Solution, your web domain must use HTTPS.
To get up and running quickly with your first app, go through the following steps in the tutorial provided below:
In Xcode, configure a new iOS Single View Application project.
- Specify your Product Name and the storage location for your project.
- From the Project Navigator view, click Build Settings and configure the following:
- Build Options > Enable Bitcode: Select No.
- Drag the IBKit.framework into your project. Select each and ensure Target Membership is checked in the File Inspector.
- From the Project Navigator view, click General. Add both frameworks in Embedded Binaries.
- On the General tab under Linked Frameworks and Libraries, add all the required frameworks listed at OpenTok iOS SDK Requirements.
Now you are ready to add the Interactive Broadcast Solution user detail to your app, as well as the Admin ID and Base URL you retrieved earlier (see Prerequisites). This detail is needed to initialize the Interactive Broadcast Solution controller that connects the app with the backend server and presents the user interface populated with Interactive Broadcast Solution events.
- From the Project Navigator view, edit ViewController.m and ensure you have the following import statements:
#import <IBKit/IBKit.h>
- You will be able to use the API to create an Interactive Broadcasting Solution controller.
To initialize the controller you need:
- The Admin ID is unique to your account. It is used to authorize your code to use the library and make requests to the backend, which is hosted at the location identified by the Backend Base URL. You can use your Admin ID for multiple events.
- The Backend URL is the endpoint to the web service hosting the events, and should be provided by TokBox.
- The User Type to be used. Specify one of the following values for the User Type:
fan
,celebrity
, orhost
. There should only be one celebrity and host per event. - The Username will be displayed in chats with the producer and when Fans get in line. This field is optional.
- Configure the backend URL using the
configureBackendURL
method:
[IBApi configureBackendURL:<YOUR_BACKEND URL>];
- Now you can create an Interactive Broadcast Solution controller, which will populate the application with events available on the Interactive Broadcast Solution service using the
sharedManager
method, theadmin_id
parameter and theuser type
:
[[IBApi sharedManager] getInstanceWithAdminId: <#admin id#>
completion:^(IBInstance *instance, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^(){
if (!error) {
// user data could be:
// [IBUser userWithIBUserRole:IBUserRoleFan name:@"FanName"]
// [IBUser userWithIBUserRole:IBUserRoleCelebrity name:@"Celebrity"]
// [IBUser userWithIBUserRole:IBUserRoleHost name:@"Host"]
UIViewController *viewcontroller;
if(instance.events.count != 1){
viewcontroller = [[EventsViewController alloc] initWithInstance:instance user:<#user data#>];
}
else {
viewcontroller = [[EventViewController alloc] initWithInstance:instance eventIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] user:<#user data#>];
}
[weakSelf presentViewController:viewcontroller animated:YES completion:nil];
}
});
}];
Interested in contributing? We ❤️ pull requests! See the Contribution guidelines.
We love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either:
- Open an issue on this repository
- See https://support.tokbox.com/ for support options
- Tweet at us! We're @VonageDev on Twitter
- Or join the Vonage Developer Community Slack
- Check out the Developer Documentation at https://tokbox.com/developer/