Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/webfactorymk/ng2-opentok

This library is an angular 2 wrapper in typescript of opentok.js library(web).
https://github.com/webfactorymk/ng2-opentok

angular2 opentok real-time-communications tokbox video video-communications videochat webrtc

Last synced: 4 months ago
JSON representation

This library is an angular 2 wrapper in typescript of opentok.js library(web).

Awesome Lists containing this project

README

        

# ng2-opentok

## Description

This library is an angular 2 wrapper in typescript of [opentok.js library(web)](https://tokbox.com/developer/sdks/js/). Full description of the opentok platform can be found [here](https://tokbox.com/developer/guides/basics/).
This library is still in beta version, so any contribution is always welcome.

## Documentation

The documentation for opentok.js can be found [here](https://tokbox.com/developer/sdks/js) and used as a reference when using this library.

Here is a [wiki](https://github.com/webfactorymk/ng2-opentok/wiki/Opentok-service) with description ONLY of the opentok service provided by in this library, to make the implementation of a simple video call between two users easier.

Use the opentok official documentation to learn how to implement the logic with the help of the models wrapped in this library, for custom use and for video call between multiple users. The wiki does not contain information about them, use the files with code as reference:

Basic models
* [Subscriber](https://github.com/webfactorymk/ng2-opentok/blob/master/src/models/subscriber.model.ts)
* [Stream](https://github.com/webfactorymk/ng2-opentok/blob/master/src/models/stream.model.ts)
* [Signal](https://github.com/webfactorymk/ng2-opentok/blob/master/src/models/signal.model.ts)
* [Session](https://github.com/webfactorymk/ng2-opentok/blob/master/src/models/session.model.ts)
* [Publisher](https://github.com/webfactorymk/ng2-opentok/blob/master/src/models/publisher.model.ts)
* [Connection](https://github.com/webfactorymk/ng2-opentok/blob/master/src/models/connection.model.ts)
* [Capabilities](https://github.com/webfactorymk/ng2-opentok/blob/master/src/models/capabilities.model.ts)

[Events](https://github.com/webfactorymk/ng2-opentok/tree/master/src/models/events)

[Errors](https://github.com/webfactorymk/ng2-opentok/blob/master/src/models/error.constants.ts)

## Installation
To install this library, run:

```bash
$ npm install ng2-opentok --save
```
## Use
This library should be used as described in the official documentation for [Opentok](). This means you can follow their tutorials for creating a backend server, and use the new service and classes available in this library. The prerequirements stay the same though.

#### Prerequirements
To use this library you need to have:
* A valid TokBox account — if you don't have one, you can sign up for a free trial
* A webcam and microphone
* Google Chrome, Firefox or another supported browser
* A local web server — if you don't already have one, try setting up a SimpleHTTPServer using Python or http-server using Node.js.

[Basic video chat tutorial from opentok](https://tokbox.com/developer/tutorials/web/basic-video-chat/)

#### Authentication prerequirements
In order to use the library OpenTok, the client will need to have some authentication credentials — an API Key.
The API key can be obtained from the valid [TokBox Account](https://id.tokbox.com/login?response_type=code&redirect_uri=https%3A%2F%2Ftokbox.com%2Faccount%2Fauth%2Fprovider%2Fcallback&state=eyJyZWRpcmVjdCI6Ii8ifQ%3D%3D&client_id=acountportalprod).

Use the [DEMO](https://github.com/webfactorymk/ng2-opentok-demo) project and the [ng2-opentok documentation](https://github.com/webfactorymk/ng2-opentok/wiki/Opentok-service) to see how the library is used.

After you have read the basic tutorial and obtained an api key, you can add to your Angular `AppModule`:

typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

// Import Opentok library
import {OpentokModule} from "ng2-opentok/dist/opentok.module"

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,

// Add you opentok module here with the api key for opentok
OpentokModule.forRoot({apiKey: "your-api-key-here"})
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

Once your library is imported, you have to add the actual opentok.js library and it's css file in the scripts section in your index.html.

You can also install OpenTok.js using the [@opentok/client](https://www.npmjs.com/package/@opentok/client) npm package.

html




OpentokNg2Demo










## Development

To generate all `*.js`, `*.d.ts` and `*.metadata.json` files:

```bash
$ npm run build
```

To lint all `*.ts` files:

```bash
$ npm run lint
```

## Contribution
If you have any problems with pull request and want to contribute, contact [me](mailto:[email protected])

## License

MIT © [WF | Snezhana Dichevska](mailto:[email protected])

Developed by [SnezanaDichevska](https://github.com/SnezanaDichevska)