{"id":1559,"url":"https://github.com/opentok/accelerator-core-ios","last_synced_at":"2025-05-01T21:30:33.502Z","repository":{"id":56292943,"uuid":"80169782","full_name":"opentok/accelerator-core-ios","owner":"opentok","description":"Syntax sugar of OpenTok iOS SDK with Audio/Video communication including screen sharing","archived":false,"fork":false,"pushed_at":"2023-01-17T14:06:02.000Z","size":909,"stargazers_count":31,"open_issues_count":0,"forks_count":17,"subscribers_count":69,"default_branch":"main","last_synced_at":"2024-10-19T08:27:41.608Z","etag":null,"topics":["audio","communication","ios","objective-c","opentok","real-time","real-time-video-streaming","realtime","realtime-audio","screen-capture","screencapture","screenshare","screensharing","screenshots","tokbox","video","video-call","video-communication","webrtc"],"latest_commit_sha":null,"homepage":"https://tokbox.com/","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opentok.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-27T00:38:12.000Z","updated_at":"2024-08-04T04:08:57.000Z","dependencies_parsed_at":"2023-02-10T10:00:57.665Z","dependency_job_id":null,"html_url":"https://github.com/opentok/accelerator-core-ios","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentok%2Faccelerator-core-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentok%2Faccelerator-core-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentok%2Faccelerator-core-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentok%2Faccelerator-core-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opentok","download_url":"https://codeload.github.com/opentok/accelerator-core-ios/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224278480,"owners_count":17285080,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","communication","ios","objective-c","opentok","real-time","real-time-video-streaming","realtime","realtime-audio","screen-capture","screencapture","screenshare","screensharing","screenshots","tokbox","video","video-call","video-communication","webrtc"],"created_at":"2024-01-05T20:15:49.809Z","updated_at":"2024-11-12T13:07:41.595Z","avatar_url":"https://github.com/opentok.png","language":"Objective-C","funding_links":[],"categories":["Media","Objective-C"],"sub_categories":["Streaming","Other free courses"],"readme":"# Accelerator Core iOS\n\n[![Build Status](https://travis-ci.org/opentok/accelerator-core-ios.svg?branch=main)](https://travis-ci.org/opentok/accelerator-core-ios)\n[![Version Status](https://img.shields.io/cocoapods/v/OTAcceleratorCore.svg)](https://cocoapods.org/pods/OTAcceleratorCore)\n[![license MIT](https://img.shields.io/cocoapods/l/OTAcceleratorCore.svg)](https://cocoapods.org/pods/OTAcceleratorCore)\n[![Platform](https://img.shields.io/cocoapods/p/OTAcceleratorCore.svg)](https://cocoapods.org/pods/OTAcceleratorCore)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)\n\n\u003cimg src=\"https://assets.tokbox.com/img/vonage/Vonage_VideoAPI_black.svg\" height=\"48px\" alt=\"Tokbox is now known as Vonage\" /\u003e\n\nThe Accelerator Core is a solution to integrate audio/video communication to any iOS applications via OpenTok platform. [Accelerator TextChat](https://github.com/opentok/accelerator-textchat-ios) and [Accelerator Annotation](https://github.com/opentok/accelerator-annotation-ios) have been deprecated and are now part of Accelerator Core.\n\nAccelerator Core helps you with:\n\nCore:\n- one to one audio/video call\n- multiparty audio/video call\n- one to one screen sharing\n- multiparty screen sharing\n- UI components for handling audio/video enable\u0026disable\n\nTextChat:\n- one to one text chat\n\nAnnotation:\n- one to one audio/video call with annotations\n\n# Configure, build and run the sample apps\n\nThe Accelerator Core workspace contains 3 sample apps, one for the Core, TextChat and Annotation components.\n\n1. Get values for **API Key**, **Session ID**, and **Token**. See [Obtaining OpenTok Credentials](#obtaining-opentok-credentials) for important information.\n\n1. Install CocoaPods as described in [CocoaPods Getting Started](https://guides.cocoapods.org/using/getting-started.html#getting-started).\n\n1. In Terminal, `cd` to your project directory and type `pod install`.\n\n1. Reopen your project in Xcode using the new `*.xcworkspace` file.\n\n1. Replace the following empty strings with the corresponding API Key, Session ID, and Token values:\n\n    ```objc\n    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n        // Override point for customization after application launch.\n        sharedSession = [[OTAcceleratorSession alloc] initWithOpenTokApiKey:@\"apikey\" sessionId:@\"sessionid\" token:@\"token\"];\n        return YES;\n    }\n    ```\n\n1. Use Xcode to build and run the app on an iOS simulator or device.\n\n1. For testing audio/video communication, we include a simple web app to make it easier: [Browser-Demo](https://github.com/opentok/accelerator-core-ios/blob/master/browser-demo.html). 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.\n\n1. You might want to run on other platforms:\n\n[Accelerator Core Javascript](https://github.com/opentok/accelerator-core-js)\n\n[Accelerator Core Android](https://github.com/opentok/accelerator-core-android)\n\n## Core Sample Code\n\nEach communicator instance will take the OpenTok session from OTOneToOneCommunicatorDataSource, so this applies to each communicator instance:\n\n- Passing the session\n    ```objc\n    - (OTAcceleratorSession *)sessionOfOTOneToOneCommunicator:(OTOneToOneCommunicator *)oneToOneCommunicator {\n        return \u003c#OTAcceleratorSession#\u003e;\n    }\n    ```\n\n- One-to-One\n\n    ```objc\n    self.communicator = [[OTOneToOneCommunicator alloc] init];\n    self.communicator.dataSource = self;\n    [self.communicator connectWithHandler:^(OTCommunicationSignal signal, NSError *error) {\n        if (signal == OTPublisherCreated \u0026\u0026 !error) {\n            weakSelf.communicator.publisherView.frame = CGRectMake(0, 0, 100, 100);\n            [self.publisherView addSubview:weakSelf.communicator.publisherView];\n        }\n        else if (signal == OTSubscriberReady \u0026\u0026 !error) {\n            weakSelf.communicator.subscriberView.frame = CGRectMake(0, 0, 100, 100);\n            [self.subscriberView addSubview:weakSelf.communicator.subscriberView];\n        }\n    }];\n    ```\n\n- Multiparty\n\n    ```objc\n    self.communicator = [[OTMultiPartyCommunicator alloc] init];\n    self.communicator.dataSource = self;\n    [self.communicator connectWithHandler:^(OTCommunicationSignal signal, OTMultiPartyRemote *subscriber, NSError *error) {\n        if (signal == OTPublisherCreated \u0026\u0026 !error) {\n            weakSelf.communicator.publisherView.frame = CGRectMake(0, 0, 100, 100);\n            [self.publisherView addSubview:weakSelf.communicator.publisherView];\n        }\n        else if (signal == OTSubscriberReady \u0026\u0026 !error) {\n            subscriber.subscriberView.frame = \u003c#your desired frame for this remote subscriberview#\u003e;\n            // your logic to handle multiple remote subscriberview(s)\n        }\n    }];\n    ```\n\n- Screen Sharing\n\n    Use `- (instancetype)initWithView:` or `- (instancetype)initWithView:name:` like so\n\n    ```objc\n    self.screenSharer = [[OTOneToOneCommunicator alloc] initWithView:[UIApplication sharedApplication].keyWindow.rootViewController.view];\n    ```\n\n    or\n\n    ```objc\n    self.screenSharer = [[OTMultiPartyCommunicator alloc] initWithView:[UIApplication sharedApplication].keyWindow.rootViewController.view];\n    ```\n\n- Pre-defined UI\n\n    Enable audio\u0026video control\n\n    ```objc\n    self.communicator.publisherView.controlView.isVerticalAlignment = YES;\n    self.communicator.publisherView.controlView.frame = CGRectMake(10, 10, CGRectGetWidth(self.publisherView.frame) * 0.1, CGRectGetHeight(self.publisherView.frame) * 0.3);\n    ```\n\n    Handle video enable/disable control\n\n    ```objc\n    // default\n    // enable handleAudioVideo property, the publisherView will be covered by a silhouette automatically.\n    self.communicator.publisherView.handleAudioVideo = YES;\n\n    // disable handleAudioVideo property, the publisherView will do nothing for enabling/disabling publishVideo.\n    self.communicator.publisherView.handleAudioVideo = NO;\n    ```\n\n### Core Ready-to-Use Components\n\n- One-to-One communication\n\n![ready-in-use-2](./ready-in-use-2.png)\n![ready-in-use-3](./ready-in-use-3.png)\n\n```objc\nOTOneToOneCommunicationController *vc = [OTOneToOneCommunicationController oneToOneCommunicationControllerWithSession:\u003c#OTAcceleratorSession#\u003e];\n[self.navigationController pushViewController:vc animated:YES];\n```\n\n## TextChat Sample Code\n\n- Passing the session\n\n    ```objc\n    - (OTAcceleratorSession *)sessionOfOTOneToOneCommunicator:(OTOneToOneCommunicator *)oneToOneCommunicator {\n        return \u003c#OTAcceleratorSession#\u003e;\n    }\n    ```\n\n- Start signaling text chat data\n\n    ```objc\n    // we assume self owns a table tableView\n    [self.textChat connectWithHandler:^(OTTextChatConnectionEventSignal signal, OTConnection *connection, NSError *error) {\n        if (signal == OTTextChatConnectionEventSignalDidConnect) {\n            NSLog(@\"Text Chat starts\");\n        }\n        else if (signal == OTTextChatConnectionEventSignalDidDisconnect) {\n            NSLog(@\"Text Chat stops\");\n        }\n    } messageHandler:^(OTTextChatMessageEventSignal signal, OTTextMessage *message, NSError *error) {\n        if (signal == OTTextChatMessageEventSignalDidSendMessage || signal == OTTextChatMessageEventSignalDidReceiveMessage) {\n            if (!error) {\n                [weakSelf.textMessages addObject:message];\n                [weakSelf.tableView reloadData];\n            }\n        }\n    }];\n    ```\n\n- Stop signaling text chat data\n\n    ```objc\n    [self.textchat disconnect];\n    ```\n\n### JSON Requirements for Text Chat Signaling\n\nThe 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:\n\n``` javascript\n// var type = \"text-chat\"\n```\n\n```json\n{\n    \"sentOn\" : 1462396461923.305,\n    \"text\" : \"Hi\",\n    \"sender\" : {\n        \"alias\" : \"Tokboxer\",\n        \"id\" : \"16FEB40D-C09B-4491-A983-44677B7EBB3E\"\n    }\n}\n```\n\nThis formatted JSON is converted to a string, which is submitted to the OpenTok signaling API. For more information, see:\n\n- [Signaling - JavaScript](https://tokbox.com/developer/guides/signaling/js/)\n- [Signaling - iOS](https://tokbox.com/developer/guides/signaling/ios/)\n- [Signaling - Android](https://tokbox.com/developer/guides/signaling/android/)\n\nFor testing text chat, we include a simple web app to make it easier: [Browser-Demo-TextChat](https://github.com/opentok/accelerator-core-ios/blob/master/browser-demo-textchat.html). Simply open it and replace the corresponding API Key, Session ID, and Token values. Then save and load it to the browser.\n\n## Annotation sample code\n\nThe `OTAnnotationScrollView` class is the backbone of the annotation features in this Sample.\n\n\n```objc\nself.annotationView = [[OTAnnotationScrollView alloc] init];\nself.annotationView.frame = \u003c# desired frame #\u003e;\n[self.annotationView initializeToolbarView];\nself.annotationView.toolbarView.frame = \u003c# desired frame #\u003e;\n```\n\n### Class design\n\nThe following classes represent the software design for the OpenTok Annotations Accelerator.\n\n| Class                                  | Description                                                                                                                                                           |\n| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `OTAnnotator`                          | The core component for enabling remote annotation across devices and platforms.                                                                                       |\n| `OTAnnotationScrollView`               | Provides essentials components for annotating on either the entire screen or a specified portion of the screen.                                                       |\n| `OTAnnotationToolbarView`              | A convenient annotation toolbar that is optionally available for your development. As an alternative, you can create your own toolbar using `OTAnnotationScrollView`. |\n| `OTFullScreenAnnotationViewController` | A convenient view controller enables you to annotate the whole screen immediately.                                                                                    |\n\n### 3rd Party Libraries\n\n- [LHToolbar](https://github.com/Lucashuang0802/LHToolbar)\n\n## Sample Apps that uses the Core\n\nThe following sample apps use `Accelerator Core`:\n\n- [Accelerator Sample Apps](https://github.com/opentok/accelerator-sample-apps-ios)\n\nThe accelerator and sample app access the OpenTok session through the Accelerator Session Pack layer, which allows them to share a single OpenTok session:\n\n![architecture](./accpackarch.png)\n\nOn 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.\n\n### Obtaining OpenTok Credentials\n\nTo 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](https://dashboard.tokbox.com/) . For production deployment, you must generate the Session ID and Token values using one of the [OpenTok Server SDKs](https://tokbox.com/developer/sdks/server/).\n\n\n## Development and Contributing\n\nInterested in contributing? We :heart: pull requests! See the [Contribution](CONTRIBUTING.md) guidelines.\n\n## Getting Help\n\nWe love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either:\n\n- Open an issue on this repository\n- See \u003chttps://support.tokbox.com/\u003e for support options\n- Tweet at us! We're [@VonageDev](https://twitter.com/VonageDev) on Twitter\n- Or [join the Vonage Developer Community Slack](https://developer.nexmo.com/community/slack)\n\n## Further Reading\n\n- Check out the Developer Documentation at \u003chttps://tokbox.com/developer/\u003e\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentok%2Faccelerator-core-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopentok%2Faccelerator-core-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentok%2Faccelerator-core-ios/lists"}