TimBarton / PhoneGap-Plugin

PhoneGap Plugin for OpenTok to build video chat applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PhoneGap Plugin for OpenTok iOS

Weave video chat into your web (and now mobile!) application.

Step 1. Install and create a PhoneGap app

Make sure You have PhoneGap 2.9 Installed If you haven't, check out PhoneGap's Getting Started Page.

  1. Create a PhoneGap app by going to your PhoneGap's Bin folder, and type into Terminal:
    ./create <project_folder_path> <bundle_id> <project_name>
    Example:
    ./create ~/Development/OpenTokApp me.songz.OpenTokApp OpenTokApp

  2. In the project directory that you just created, and launch *.xcodeproj file.

Step 2. Add the OpenTok iOS SDK to your project

The easiest way is to do this: take a working OpenTok app and copy the OpenTok Framework and all the dependencies to your project. Here's how to do that.

  1. Clone from https://github.com/opentok/OpenTok-iOS-Hello-World.git and open the Hello-World xcode project.
    Be sure to git clone with --recursive to grab the required OpenTok iOS SDK submodule!
    git clone --recursive https://github.com/opentok/OpenTok-iOS-Hello-World.git

  2. In XCode, drag the OpenTok.framework and all the frameworks that OpenTok needs to run that are not currently in your project.
    Make sure Copy items into destination group's folder is not selected
    framework

  3. Drag opentok.bundle file from Hello-World project into the Resources folder for your project bundle

Note When testing, please run your app in your device, and NOT the simulator. The OpenTok iOS SDK requires access to the camera, which is not available in the simulator.

Step 3. Install the OpenTok PhoneGap Plugin

  1. Clone from https://github.com/opentok/PhoneGap-Plugin. git clone https://github.com/opentok/PhoneGap-Plugin

  2. Copy OpenTokPlugin.h and OpenTokPlugin.m from the src folder into your Project's Plugins folder
    Make sure Copy items into destination group's folder is selected.
    ios

  3. Copy OpenTok.js from src folder into your Project's www/js folder.
    js

  4. In the XCode project manager, select config.xml.
    Under widget, add a new feature entry for our plugin

<feature name="TokBox">
  <param name="ios-package" value="OpenTokPlugin"/>
</feature>

Getting Started on your Project:

All your editing will be done in your www folder.

To use the opentok library, make sure you include OpenTok.js file in your HTML document.
<script type="text/javascript" charset="utf-8" src="OpenTok.js"></script>

All JavaScript code should be written in deviceready function in /js/index.js folder because it is executed after all dependencies has loaded.

deviceready: function() {
    // Do Your Stuff Here!
    app.report('deviceready');
},

When you are Deploying into your device:

  1. Make sure your set the Target in the Scheme drop-down menu on the toolbar to your project name
  2. Make sure your device is selected for deployment
    deploy

Tutorial and sample code

Go through the OpenTok API demo to learn the basics!

Next, look at the included in the sampleCode folder and follow the instructions in the README.

Have Fun!


Documentation for PhoneGap Plugin


License

Copyright (c) 2012 TokBox, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

The software complies with Terms of Service for the OpenTok platform described in http://www.tokbox.com/termsofservice.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

PhoneGap Plugin for OpenTok to build video chat applications

License:Other


Languages

Language:Objective-C 72.6%Language:CoffeeScript 22.3%Language:JavaScript 5.1%