Coder Social home page Coder Social logo

opentokapi's Introduction

OpenTok API .NET

This is a .NET implementation of the OpenTok API. See complete documentation at http://www.tokbox.com/opentok/api/tools/documentation/api/server_side_libraries.html.

Usage

Configuration

Install from NuGet

PM > Install-Package OpenTokApi
<configuration>
 <appSettings>
    <add key="opentok.key" value="***API key***"/>
    <add key="opentok.secret" value="***API secret***"/>
    <add key="opentok.server" value="https://api.opentok.com"/>
    <add key="opentok.token.sentinel" value="T1=="/>
    <add key="opentok.sdk.version" value="opentokapi.net"/>
 </appSettings>

Explicitly set your OpenTok API key and secret.

Generating Sessions

To generate an OpenTok session:

var opentok = new OpenTok(); // will pull settings from config
string sessionId = opentok.CreateSession(Request.ServerVariables["REMOTE_ADDR"]);

To generate an OpenTok P2P session:

var opentok = new OpenTok();
string sessionId = opentok.CreateSession(Request.ServerVariables["REMOTE_ADDR"], new { p2p_preference = "enabled" });

Generating Tokens

To generate a session token:

string token = opentok.GenerateToken(sessionId);

By default, the token has the "publisher" permission. To generate a token with a different set of permissions:

string token = opentok.GenerateToken(sessionId, new { role = Roles.Moderator });

You can also pass in additional token options like "connection_data" and "expire_time":

string token = opentok.GenerateToken(sessionId, new { connection_data = "id = 1", expire_time = DateTime.Now.AddDays(7) });

Contributions

This library is ported from https://github.com/opentok/Opentok-.NET-SDK

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Send me a pull request. Bonus points for topic branches.

opentokapi's People

Contributors

khalidabuhakmeh avatar

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.