Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Commit cc47493

Browse files
author
Sean Perkins
authored
Merge pull request #24 from sean-perkins/android-ios-merge
Android ios merge
2 parents 56771bc + bc7510e commit cc47493

29 files changed

+1192
-1032
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ demo/node_modules
99
demo/lib/ios
1010
*.log
1111
*.d.ts
12-
!opentok.d.ts
12+
!opentok.d.ts

LICENSE

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
The MIT License (MIT)
2-
3-
nativescript-opentok
4-
Copyright (c) 2016, Sean Perkins
5-
6-
Permission is hereby granted, free of charge, to any person obtaining a copy of
7-
this software and associated documentation files (the "Software"), to deal in
8-
the Software without restriction, including without limitation the rights to
9-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10-
the Software, and to permit persons to whom the Software is furnished to do so,
11-
subject to the following conditions:
12-
13-
The above copyright notice and this permission notice shall be included in all
14-
copies or substantial portions of the Software.
15-
16-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1+
The MIT License (MIT)
2+
3+
nativescript-opentok
4+
Copyright (c) 2016, Sean Perkins
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy of
7+
this software and associated documentation files (the "Software"), to deal in
8+
the Software without restriction, including without limitation the rights to
9+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10+
the Software, and to permit persons to whom the Software is furnished to do so,
11+
subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2121
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,87 @@
1-
# Nativescript OpenTok
2-
3-
[![npm](https://img.shields.io/npm/v/nativescript-opentok.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/package/nativescript-opentok)
4-
[![npm](https://img.shields.io/npm/dt/nativescript-opentok.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/package/nativescript-opentok)
5-
6-
A Nativescript plugin for the OpenTok iOS and (coming soon Android) SDK.
7-
8-
OpenTok: https://tokbox.com/developer/
9-
10-
## Getting Started
11-
12-
### Requirements
13-
- API Key with OpenTok. [Get one here](https://dashboard.tokbox.com/signups/new).
14-
- Ability to generate a valid session id (either through OpenTok account or back-end service)
15-
- Ability to generate a valid token (either through OpenTok account or back-end service)
16-
- Opentok.framework requires projects to be built for only armv7 (device); i386 (simulator), armv6, armv7s, and arm64 are not supported.
17-
18-
### Installation
19-
Node Package Manager (NPM)
20-
21-
- `npm install nativescript-opentok --save`
22-
23-
### Integration
24-
25-
#### Routed Sessions
26-
##### View
27-
You will first need to import the custom element into the {N} xml view. This can be accomplished by adding this snippet: `xmlns:OT="nativescript-opentok"` to your existing `Page` element tag.
28-
29-
The basic integration example would include the following declarations for publisher and subscriber. Notice subscriber is any element with `id="subscriber"`.
30-
```
31-
<StackLayout id="subscriber" width="100%" height="100%"></StackLayout>
32-
<OT:TNSOTPublisher id="publisher" verticalAlignment="top" horizontalAlignment="right" margin="10" width="100" height="100"></OT:TNSOTPublisher>
33-
```
34-
35-
Next in your page's binding context (a controller, view model, etc.), you will need to import and hook to the OpenTok implementation.
36-
37-
```
38-
import {TNSOTSession, TNSOTPublisher, TNSOTSubscriber} from 'nativescript-opentok';
39-
40-
private _apiKey:string = 'API_KEY';
41-
private _sessionId: string = 'SESSION_ID';
42-
private _token: string = 'TOKEN';
43-
44-
private publisher: TNSOTPublisher;
45-
private subscriber: TNSOTSubscriber;
46-
47-
private session: TNSOTSession;
48-
49-
constructor(private page: Page) {
50-
super();
51-
this.session = TNSOTSession.initWithApiKeySessionId(this._apiKey, this._sessionId);
52-
this.publisher = <TNSOTPublisher> this.page.getViewById('publisher');
53-
this.subscriber = <TNSOTSubscriber> this.page.getViewById('subscriber');
54-
this.initPublisher();
55-
this.initSubscriber();
56-
}
57-
58-
initPublisher() {
59-
this.session.connect(this._token);
60-
this.publisher.publish(this.session, '', 'HIGH', '30');
61-
this.publisher.events.on('streamDestroyed', (result) => {
62-
console.log('publisher stream destroyed');
63-
});
64-
}
65-
66-
initSubscriber() {
67-
this.session.events.on('streamCreated', () => {
68-
this.subscriber.subscribe(this.session);
69-
});
70-
}
71-
```
72-
73-
74-
### Special Articles
75-
- [Overlay UI on the Video Stream](https://github.com/sean-perkins/nativescript-opentok/wiki/Overlay-UI-on-Video-Stream)
76-
- [Angular 2 Integration Guide](https://github.com/sean-perkins/nativescript-opentok/wiki/Angular-2-Integration-Guide)
77-
- [Controlling Resolution and FPS](https://github.com/sean-perkins/nativescript-opentok/wiki/Controlling-Frame-Rate-and-Resolution)
78-
- [Event Hooks](https://github.com/sean-perkins/nativescript-opentok/wiki/Event-Hooks)
79-
80-
### Images
81-
|iPhone|iPad|
82-
|---|---|
83-
|![iPhone Image](http://i.imgur.com/tjnfeQ7.png)|![iPad Image](http://i.imgur.com/2Ubjw0W.png)|
84-
85-
### Notes
86-
- Publishing is not supported in the Simulator because it does not have access to your webcam. You may see a yellow tea-kettle instead.
87-
- `TNS` stands for **T**elerik **N**ative**S**cript
1+
# Nativescript OpenTok
2+
3+
[![npm](https://img.shields.io/npm/v/nativescript-opentok.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/package/nativescript-opentok)
4+
[![npm](https://img.shields.io/npm/dt/nativescript-opentok.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/package/nativescript-opentok)
5+
6+
A Nativescript plugin for the OpenTok iOS and (coming soon Android) SDK.
7+
8+
OpenTok: https://tokbox.com/developer/
9+
10+
## Getting Started
11+
12+
### Requirements
13+
- API Key with OpenTok. [Get one here](https://dashboard.tokbox.com/signups/new).
14+
- Ability to generate a valid session id (either through OpenTok account or back-end service)
15+
- Ability to generate a valid token (either through OpenTok account or back-end service)
16+
- Opentok.framework requires projects to be built for only armv7 (device); i386 (simulator), armv6, armv7s, and arm64 are not supported.
17+
18+
### Installation
19+
Node Package Manager (NPM)
20+
21+
- `npm install nativescript-opentok --save`
22+
23+
### Integration
24+
25+
#### Routed Sessions
26+
##### View
27+
You will first need to import the custom element into the {N} xml view. This can be accomplished by adding this snippet: `xmlns:OT="nativescript-opentok"` to your existing `Page` element tag.
28+
29+
The basic integration example would include the following declarations for publisher and subscriber. Notice subscriber is any element with `id="subscriber"`.
30+
```
31+
<StackLayout id="subscriber" width="100%" height="100%"></StackLayout>
32+
<OT:TNSOTPublisher id="publisher" verticalAlignment="top" horizontalAlignment="right" margin="10" width="100" height="100"></OT:TNSOTPublisher>
33+
```
34+
35+
Next in your page's binding context (a controller, view model, etc.), you will need to import and hook to the OpenTok implementation.
36+
37+
```
38+
import {TNSOTSession, TNSOTPublisher, TNSOTSubscriber} from 'nativescript-opentok';
39+
40+
private _apiKey:string = 'API_KEY';
41+
private _sessionId: string = 'SESSION_ID';
42+
private _token: string = 'TOKEN';
43+
44+
private publisher: TNSOTPublisher;
45+
private subscriber: TNSOTSubscriber;
46+
47+
private session: TNSOTSession;
48+
49+
constructor(private page: Page) {
50+
super();
51+
this.session = TNSOTSession.initWithApiKeySessionId(this._apiKey, this._sessionId);
52+
this.publisher = <TNSOTPublisher> this.page.getViewById('publisher');
53+
this.subscriber = <TNSOTSubscriber> this.page.getViewById('subscriber');
54+
this.initPublisher();
55+
this.initSubscriber();
56+
}
57+
58+
initPublisher() {
59+
this.session.connect(this._token);
60+
this.publisher.publish(this.session, '', 'HIGH', '30');
61+
this.publisher.events.on('streamDestroyed', (result) => {
62+
console.log('publisher stream destroyed');
63+
});
64+
}
65+
66+
initSubscriber() {
67+
this.session.events.on('streamCreated', () => {
68+
this.subscriber.subscribe(this.session);
69+
});
70+
}
71+
```
72+
73+
74+
### Special Articles
75+
- [Overlay UI on the Video Stream](https://github.com/sean-perkins/nativescript-opentok/wiki/Overlay-UI-on-Video-Stream)
76+
- [Angular 2 Integration Guide](https://github.com/sean-perkins/nativescript-opentok/wiki/Angular-2-Integration-Guide)
77+
- [Controlling Resolution and FPS](https://github.com/sean-perkins/nativescript-opentok/wiki/Controlling-Frame-Rate-and-Resolution)
78+
- [Event Hooks](https://github.com/sean-perkins/nativescript-opentok/wiki/Event-Hooks)
79+
80+
### Images
81+
|iPhone|iPad|
82+
|---|---|
83+
|![iPhone Image](http://i.imgur.com/tjnfeQ7.png)|![iPad Image](http://i.imgur.com/2Ubjw0W.png)|
84+
85+
### Notes
86+
- Publishing is not supported in the Simulator because it does not have access to your webcam. You may see a yellow tea-kettle instead.
87+
- `TNS` stands for **T**elerik **N**ative**S**cript
Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="__PACKAGE__"
4-
android:versionCode="1"
5-
android:versionName="1.0">
6-
7-
<supports-screens
8-
android:smallScreens="true"
9-
android:normalScreens="true"
10-
android:largeScreens="true"
11-
android:xlargeScreens="true"/>
12-
13-
<uses-sdk
14-
android:minSdkVersion="17"
15-
android:targetSdkVersion="__APILEVEL__"/>
16-
17-
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
18-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
19-
<uses-permission android:name="android.permission.INTERNET"/>
20-
21-
<application
22-
android:name="com.tns.NativeScriptApplication"
23-
android:allowBackup="true"
24-
android:icon="@drawable/icon"
25-
android:label="@string/app_name"
26-
android:theme="@style/AppTheme" >
27-
<activity
28-
android:name="com.tns.NativeScriptActivity"
29-
android:label="@string/title_activity_kimera"
30-
android:configChanges="keyboardHidden|orientation|screenSize">
31-
32-
<intent-filter>
33-
<action android:name="android.intent.action.MAIN" />
34-
35-
<category android:name="android.intent.category.LAUNCHER" />
36-
</intent-filter>
37-
</activity>
38-
<activity android:name="com.tns.ErrorReportActivity"/>
39-
</application>
40-
</manifest>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="__PACKAGE__"
4+
android:versionCode="1"
5+
android:versionName="1.0">
6+
7+
<supports-screens
8+
android:smallScreens="true"
9+
android:normalScreens="true"
10+
android:largeScreens="true"
11+
android:xlargeScreens="true"/>
12+
13+
<uses-sdk
14+
android:minSdkVersion="17"
15+
android:targetSdkVersion="__APILEVEL__"/>
16+
17+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
18+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
19+
<uses-permission android:name="android.permission.INTERNET"/>
20+
21+
<application
22+
android:name="com.tns.NativeScriptApplication"
23+
android:allowBackup="true"
24+
android:icon="@drawable/icon"
25+
android:label="@string/app_name"
26+
android:theme="@style/AppTheme" >
27+
<activity
28+
android:name="com.tns.NativeScriptActivity"
29+
android:label="@string/title_activity_kimera"
30+
android:configChanges="keyboardHidden|orientation|screenSize">
31+
32+
<intent-filter>
33+
<action android:name="android.intent.action.MAIN" />
34+
35+
<category android:name="android.intent.category.LAUNCHER" />
36+
</intent-filter>
37+
</activity>
38+
<activity android:name="com.tns.ErrorReportActivity"/>
39+
</application>
40+
</manifest>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Add your native dependencies here:
2-
3-
// Uncomment to add recyclerview-v7 dependency
4-
//dependencies {
5-
// compile 'com.android.support:recyclerview-v7:+'
1+
// Add your native dependencies here:
2+
3+
// Uncomment to add recyclerview-v7 dependency
4+
//dependencies {
5+
// compile 'com.android.support:recyclerview-v7:+'
66
//}

0 commit comments

Comments
 (0)