Home

Awesome

Accelerator Core iOS

Build Status Version Status license MIT Platform PRs Welcome

<img src="https://assets.tokbox.com/img/vonage/Vonage_VideoAPI_black.svg" height="48px" alt="Tokbox is now known as Vonage" />

The Accelerator Core is a solution to integrate audio/video communication to any iOS applications via OpenTok platform. Accelerator TextChat and Accelerator Annotation have been deprecated and are now part of Accelerator Core.

Accelerator Core helps you with:

Core:

TextChat:

Annotation:

Configure, build and run the sample apps

The Accelerator Core workspace contains 3 sample apps, one for the Core, TextChat and Annotation components.

  1. Get values for API Key, Session ID, and Token. See Obtaining OpenTok Credentials for important information.

  2. Install CocoaPods as described in CocoaPods Getting Started.

  3. In Terminal, cd to your project directory and type pod install.

  4. Reopen your project in Xcode using the new *.xcworkspace file.

  5. Replace the following empty strings with the corresponding API Key, Session ID, and Token values:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // Override point for customization after application launch.
        sharedSession = [[OTAcceleratorSession alloc] initWithOpenTokApiKey:@"apikey" sessionId:@"sessionid" token:@"token"];
        return YES;
    }
    
  6. Use Xcode to build and run the app on an iOS simulator or device.

  7. For testing audio/video communication, we include a simple web app to make it easier: Browser-Demo. Simply open it and replace the corresponding API Key, Session ID, and Token values. Then save and load it to the browser. For multiparty, you can achieve by opening up multiple tabs.

  8. You might want to run on other platforms:

Accelerator Core Javascript

Accelerator Core Android

Core Sample Code

Each communicator instance will take the OpenTok session from OTOneToOneCommunicatorDataSource, so this applies to each communicator instance:

Core Ready-to-Use Components

ready-in-use-2 ready-in-use-3

OTOneToOneCommunicationController *vc = [OTOneToOneCommunicationController oneToOneCommunicationControllerWithSession:<#OTAcceleratorSession#>];
[self.navigationController pushViewController:vc animated:YES];

TextChat Sample Code

JSON Requirements for Text Chat Signaling

The JSON used when using the OpenTok signaling API with the OpenTok Text Chat component describes the information used when submitting a chat message. This information includes the date, chat message text, sender alias, and sender ID. The JSON is formatted as shown in this example:

// var type = "text-chat"
{
    "sentOn" : 1462396461923.305,
    "text" : "Hi",
    "sender" : {
        "alias" : "Tokboxer",
        "id" : "16FEB40D-C09B-4491-A983-44677B7EBB3E"
    }
}

This formatted JSON is converted to a string, which is submitted to the OpenTok signaling API. For more information, see:

For testing text chat, we include a simple web app to make it easier: Browser-Demo-TextChat. Simply open it and replace the corresponding API Key, Session ID, and Token values. Then save and load it to the browser.

Annotation sample code

The OTAnnotationScrollView class is the backbone of the annotation features in this Sample.

self.annotationView = [[OTAnnotationScrollView alloc] init];
self.annotationView.frame = <# desired frame #>;
[self.annotationView initializeToolbarView];
self.annotationView.toolbarView.frame = <# desired frame #>;

Class design

The following classes represent the software design for the OpenTok Annotations Accelerator.

ClassDescription
OTAnnotatorThe core component for enabling remote annotation across devices and platforms.
OTAnnotationScrollViewProvides essentials components for annotating on either the entire screen or a specified portion of the screen.
OTAnnotationToolbarViewA convenient annotation toolbar that is optionally available for your development. As an alternative, you can create your own toolbar using OTAnnotationScrollView.
OTFullScreenAnnotationViewControllerA convenient view controller enables you to annotate the whole screen immediately.

3rd Party Libraries

Sample Apps that uses the Core

The following sample apps use Accelerator Core:

The accelerator and sample app access the OpenTok session through the Accelerator Session Pack layer, which allows them to share a single OpenTok session:

architecture

On the Android and iOS mobile platforms, when you try to set a listener (Android) or delegate (iOS), it is not normally possible to set multiple listeners or delegates for the same event. For example, on these mobile platforms you can only set one OpenTok signal listener. The Common Accelerator Session Pack, however, allows you to set up several listeners for the same event.

Obtaining OpenTok Credentials

To use OpenTok's framework you need a Session ID, a Token, and an API Key. You can get these values at the OpenTok Developer Dashboard . For production deployment, you must generate the Session ID and Token values using one of the OpenTok Server SDKs.

Development and Contributing

Interested in contributing? We :heart: 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