├── .gitignore ├── LICENSE ├── README.md ├── gulpfile.js ├── package.json ├── plugin.xml ├── scripts-src └── fetch-js-client.js ├── scripts └── fetch-js-client.js └── src ├── android └── OpenTokPlugin.java ├── browser └── .gitkeep └── ios └── OpenTokPlugin.m /.gitignore: -------------------------------------------------------------------------------- 1 | # node.js 2 | npm-debug.log 3 | /node_modules 4 | .idea/ 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Ankur Oberoi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenTokJS Cordova Plugin 2 | 3 | A [Cordova](https://cordova.apache.org/) plugin to enable use of 4 | [OpenTok](https://tokbox.com/platform) on the iOS, Android, and Browser platforms. 5 | 6 | *WARNING:* This plugin is prerelease quality for versions less than `1.0.0`. 7 | 8 | ## Install 9 | 10 | Using the Cordova CLI: 11 | 12 | `$ cordova plugin add cordova-plugin-opentokjs --save --shrinkwrap` 13 | 14 | ## Configuration 15 | 16 | The version of the opentok.js SDK included into your project can be specified by a platform 17 | preference in your `config.xml`: 18 | 19 | ``` 20 | 21 | ``` 22 | 23 | The default version string is "v2". It behaves similar to semantic versioning. You can accept more 24 | updates automatically by being less specific: "v2" matches versions greater than or equal to 25 | "v2.0.0" and less than "v3.0.0". You can restrict updates by being more specific: "v2.6.0" matches 26 | just that version. 27 | 28 | ## Example applications 29 | 30 | Basic Example app: . 31 | 32 | Ionic example: . 33 | 34 | ## About this Plugin 35 | 36 | *How is this different from the com.tokbox.cordova.opentok plugin?* 37 | 38 | The goal of this plugin is be as maintainable and portable as possible. During development of the 39 | [com.tokbox.cordova.opentok](http://plugins.cordova.io/#/package/com.tokbox.cordova.opentok) plugin, 40 | it became apparent that the amount of effort it would take to maintain a JavaScript wrapper layer 41 | which mimicked the official opentok.js SDK, even as the SDK kept receiving changes and updates, was 42 | not sustainable for the community. In response to this observation, this plugin takes a drastically 43 | different approach to architecture. 44 | 45 | The approach is to run the official opentok.js client SDK, with as few changes as possible, on top 46 | of lower level plugins that present the standard WebRTC based APIs. This is possible thanks to 47 | projects such as [Crosswalk](https://crosswalk-project.org/) by Intel Corporation and the 48 | [cordova-plugin-iosrtc](http://plugins.cordova.io/#/package/cordova-plugin-iosrtc) plugin from 49 | eFace2Face, Inc. 50 | 51 | Any source transformations to the official opentok.js client SDK that are applied within this plugin 52 | should hopefully go away as the lower level implementations come closer to standards and the SDK 53 | becomes more generalized to support these types of use cases. 54 | 55 | ### Known Limitations 56 | 57 | iOS: 58 | 59 | * The library must be loaded manually after ensuring the iosrtc globals are inserted first. See 60 | sample below: 61 | 62 | ```javascript 63 | function onDeviceReady() { 64 | if (window.device.platform === 'iOS') { 65 | cordova.plugins.iosrtc.registerGlobals(); 66 | window.OT = cordova.require('cordova-plugin-opentokjs.OpenTokClient'); 67 | } 68 | // You can now use OT 69 | } 70 | ``` 71 | 72 | * Denying access to the camera or microphone after it is requested (iOS's permission prompt) will 73 | cause a crash. 74 | 75 | * A publisher's view is not size properly. It behaves similar to `fitMode: 'contain'`, where the 76 | image is letter/pillar boxed into the size of the publisher element. This might also affect 77 | subscriber streams from other devices, but remains to be tested. 78 | 79 | * You cannot draw any UI over the video streams. This is a limitation imposed by the fact that the 80 | rendering is always done in a UIView over top of the Cordova web view. 81 | 82 | * Building the project in Xcode requires special care. See the 83 | [instructions inside the iosrtc project](https://github.com/eface2face/cordova-plugin-iosrtc/blob/master/docs/Building.md). 84 | 85 | ### New API 86 | 87 | iOS: 88 | 89 | * When resizing or moving any publisher/subscriber elements (with contained `