Giter Club home page Giter Club logo

interactive-broadcast-ios's Introduction

OpenTok Interactive Broadcast Solution for iOS

OpenTok Labs

Build Status codecov

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:

NOTE: The Interactive Broadcast Solution only supports landscape orientation on mobile devices.

Prerequisites

  • 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.

Create your first Interactive Broadcast Solution application

To get up and running quickly with your first app, go through the following steps in the tutorial provided below:

Create an Xcode project

In Xcode, configure a new iOS Single View Application project.

  1. Specify your Product Name and the storage location for your project.
  2. From the Project Navigator view, click Build Settings and configure the following:
    • Build Options > Enable Bitcode: Select No.

Add the required frameworks

  1. Drag the IBKit.framework into your project. Select each and ensure Target Membership is checked in the File Inspector.
  2. From the Project Navigator view, click General. Add both frameworks in Embedded Binaries.
  3. On the General tab under Linked Frameworks and Libraries, add all the required frameworks listed at OpenTok iOS SDK Requirements.

Configure the Interactive Broadcast Solution controller

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.

  1. From the Project Navigator view, edit ViewController.m and ensure you have the following import statements:
#import <IBKit/IBKit.h>
  1. 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, or host. 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.
  1. Configure the backend URL using the configureBackendURL method:
[IBApi configureBackendURL:<YOUR_BACKEND URL>];
  1. 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, the admin_id parameter and the user 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];
                                           }
                                       });
                                   }];

Development and Contributing

Interested in contributing? We ❤️ pull requests! See the Contribution guidelines.

Getting Help

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:

Further Reading

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.