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

Commit 786b6f7

Browse files
author
Sean Perkins
authored
Merge pull request #26 from sean-perkins/ios-10-bugs
Ios 10 bugs
2 parents 53ccd4b + f5aafba commit 786b6f7

File tree

6 files changed

+36
-22
lines changed

6 files changed

+36
-22
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ initSubscriber() {
7070
}
7171
```
7272

73-
7473
### Special Articles
7574
- [Overlay UI on the Video Stream](https://github.com/sean-perkins/nativescript-opentok/wiki/Overlay-UI-on-Video-Stream)
7675
- [Angular 2 Integration Guide](https://github.com/sean-perkins/nativescript-opentok/wiki/Angular-2-Integration-Guide)
7776
- [Controlling Resolution and FPS](https://github.com/sean-perkins/nativescript-opentok/wiki/Controlling-Frame-Rate-and-Resolution)
7877
- [Event Hooks](https://github.com/sean-perkins/nativescript-opentok/wiki/Event-Hooks)
78+
- [iOS 10 Notice](https://github.com/sean-perkins/nativescript-opentok/wiki/iOS-10-Notice)
7979

8080
### Images
8181
|iPhone|iPad|

demo/app/App_Resources/iOS/Info.plist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,11 @@
4141
<string>UIInterfaceOrientationLandscapeLeft</string>
4242
<string>UIInterfaceOrientationLandscapeRight</string>
4343
</array>
44+
<key>NSCameraUsageDescription</key>
45+
<string>We need your camera to display your feed.</string>
46+
<key>NSMicrophoneUsageDescription</key>
47+
<string>We need your microphone to hear your voice.</string>
48+
<key>UIBackgroundModes</key>
49+
<string>audio</strong>
4450
</dict>
4551
</plist>

demo/app/main-view-model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import {TNSOTSession, TNSOTPublisher, TNSOTSubscriber} from 'nativescript-opento
77

88
export class Demo extends Observable {
99

10-
public _apiKey:string = '45720082';
11-
private _sessionId: string = '1_MX40NTcyMDA4Mn5-MTQ3OTQwMDk0NDcyN35XdmdkZjlnazN2UytPYk1mNW1aWVZSZmh-fg';
12-
private _publisherToken: string = 'T1==cGFydG5lcl9pZD00NTcyMDA4MiZzaWc9YjUxN2NlZmU0MjEyYjU4YTcxMzY0MWU5M2JkZTYyOTIyY2E4OTNhNTpzZXNzaW9uX2lkPTFfTVg0ME5UY3lNREE0TW41LU1UUTNPVFF3TURrME5EY3lOMzVYZG1ka1pqbG5hek4yVXl0UFlrMW1OVzFhV1ZaU1ptaC1mZyZjcmVhdGVfdGltZT0xNDc5NDAwOTU1Jm5vbmNlPTAuOTAzNTUwODk1ODE3Mzk4MyZyb2xlPXB1Ymxpc2hlciZleHBpcmVfdGltZT0xNDgxOTkyOTU0';
10+
public _apiKey:string = '45743242';
11+
private _sessionId: string = '1_MX40NTc0MzI0Mn5-MTQ4MzQwMzM1NzM5N34rUTZFS1JSY0E0Z3hXMXhlYlZYblk5amh-fg';
12+
private _publisherToken: string = 'T1==cGFydG5lcl9pZD00NTc0MzI0MiZzaWc9Y2VkNjE3YmM4NzA0ZWY0M2FjOGNjOWNlMGM3ZWI0MGRjZDI4OWQ1YzpzZXNzaW9uX2lkPTFfTVg0ME5UYzBNekkwTW41LU1UUTRNelF3TXpNMU56TTVOMzRyVVRaRlMxSlNZMEUwWjNoWE1YaGxZbFpZYmxrNWFtaC1mZyZjcmVhdGVfdGltZT0xNDgzNDAzMzY1Jm5vbmNlPTAuMTM1MzI5MjkzNzEwNzEzNTYmcm9sZT1wdWJsaXNoZXImZXhwaXJlX3RpbWU9MTQ4NTk5NTM2Ng==';
1313

1414
private publisher: TNSOTPublisher;
1515
private subscriber: TNSOTSubscriber;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-opentok",
3-
"version": "1.6.3",
3+
"version": "1.6.4",
44
"description": "Integrates OpenTok for NativeScript.",
55
"main": "opentok.js",
66
"typings": "./opentok.d.ts",

src/ios/publisher.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export class TNSOTPublisher extends ContentView {
2020

2121
constructor() {
2222
super();
23-
this._publisherKitDelegate = TNSPublisherKitDelegateImpl.initWithOwner(new WeakRef(this));
2423
this._view = UIView.alloc().init();
24+
this._publisherKitDelegate = TNSPublisherKitDelegateImpl.initWithOwner(new WeakRef(this));
2525
}
2626

2727
publish(session: TNSOTSession, name?:string, cameraResolution?: string, cameraFrameRate?: string): void {
@@ -33,14 +33,15 @@ export class TNSOTPublisher extends ContentView {
3333
);
3434
this._ios.view.frame = CGRectMake(0, 0, this.width, this.height);
3535
// this._view.frame = CGRectMake(this.originX, this.originY, this.width, this.height);
36+
3637
this._view.addSubview(this._ios.view);
3738

3839
session.events.on('sessionDidConnect', (result) => {
3940
this._ios.publishAudio = true;
41+
let stream: any = result.object;
42+
this.setIdleTimer(true);
4043
try {
41-
let stream: any = result.object;
42-
this.setIdleTimer(true);
43-
stream.publish(this._ios);
44+
stream.session.publish(this._ios);
4445
} catch(error) {
4546
console.log(error);
4647
}
@@ -72,13 +73,19 @@ export class TNSOTPublisher extends ContentView {
7273
}
7374

7475
private setIdleTimer(idleTimerDisabled: boolean) {
75-
let app = UIApplication.sharedApplication();
76+
let app: any;
77+
if(UIApplication.sharedApplication) {
78+
app = UIApplication.sharedApplication;
79+
}
80+
else {
81+
app = UIApplication.sharedApplication();
82+
}
7683
app.idleTimerDisabled = idleTimerDisabled;
7784
}
7885

7986
private getCameraResolution(cameraResolution: string): any {
8087
if(cameraResolution) {
81-
switch(cameraResolution.toString().toUpperCase()) {
88+
switch(cameraResolution) {
8289
case 'LOW':
8390
return OTCameraCaptureResolution.OTCameraCaptureResolutionLow;
8491
case 'MEDIUM':
@@ -183,6 +190,7 @@ class TNSPublisherKitDelegateImpl extends NSObject {
183190
})
184191
});
185192
}
193+
console.log(error);
186194
}
187195

188196
get events(): Observable {

src/ios/session.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class TNSOTSession extends NSObject {
6969
return this._events;
7070
}
7171

72-
public sessionDidConnect(session: any) {
72+
sessionDidConnect(session: any) {
7373
if (this.events) {
7474
this.events.notify({
7575
eventName: 'sessionDidConnect',
@@ -80,7 +80,7 @@ export class TNSOTSession extends NSObject {
8080
}
8181
}
8282

83-
public sessionDidDisconnect(session: any) {
83+
sessionDidDisconnect(session: any) {
8484
if (this.events) {
8585
this.events.notify({
8686
eventName: 'sessionDidDisconnect',
@@ -91,7 +91,7 @@ export class TNSOTSession extends NSObject {
9191
}
9292
}
9393

94-
public sessionDidReconnect(session: any) {
94+
sessionDidReconnect(session: any) {
9595
if (this.events) {
9696
this.events.notify({
9797
eventName: 'sessionDidReconnect',
@@ -102,7 +102,7 @@ export class TNSOTSession extends NSObject {
102102
}
103103
}
104104

105-
public sessionDidBeginReconnecting(session: any) {
105+
sessionDidBeginReconnecting(session: any) {
106106
if (this.events) {
107107
this.events.notify({
108108
eventName: 'sessionDidBeginReconnecting',
@@ -113,7 +113,7 @@ export class TNSOTSession extends NSObject {
113113
}
114114
}
115115

116-
public sessionStreamCreated(session: any, stream: any) {
116+
sessionStreamCreated(session: any, stream: any) {
117117
if (this.events) {
118118
this.events.notify({
119119
eventName: 'streamCreated',
@@ -128,7 +128,7 @@ export class TNSOTSession extends NSObject {
128128
}
129129
}
130130

131-
public sessionStreamDestroyed(session: any, stream: any) {
131+
sessionStreamDestroyed(session: any, stream: any) {
132132
if (this.events) {
133133
this.events.notify({
134134
eventName: 'streamDestroyed',
@@ -140,7 +140,7 @@ export class TNSOTSession extends NSObject {
140140
}
141141
}
142142

143-
public sessionDidFailWithError(session: any, error: any) {
143+
sessionDidFailWithError(session: any, error: any) {
144144
if (this.events) {
145145
this.events.notify({
146146
eventName: 'didFailWithError',
@@ -152,7 +152,7 @@ export class TNSOTSession extends NSObject {
152152
}
153153
}
154154

155-
public sessionConnectionDestroyed(session: any, connection: any) {
155+
sessionConnectionDestroyed(session: any, connection: any) {
156156
if (this.events) {
157157
this.events.notify({
158158
eventName: 'connectionDestroyed',
@@ -164,7 +164,7 @@ export class TNSOTSession extends NSObject {
164164
}
165165
}
166166

167-
public sessionConnectionCreated(session: any, connection: any) {
167+
sessionConnectionCreated(session: any, connection: any) {
168168
if (this.events) {
169169
this.events.notify({
170170
eventName: 'connectionCreated',
@@ -176,7 +176,7 @@ export class TNSOTSession extends NSObject {
176176
}
177177
}
178178

179-
public sessionArchiveStartedWithId(session: any, archiveId: string, name?: string) {
179+
sessionArchiveStartedWithId(session: any, archiveId: string, name?: string) {
180180
if (this.events) {
181181
this.events.notify({
182182
eventName: 'archiveStartedWithId',
@@ -189,7 +189,7 @@ export class TNSOTSession extends NSObject {
189189
}
190190
}
191191

192-
public sessionArchiveStoppedWithId(session: any, archiveId: string) {
192+
sessionArchiveStoppedWithId(session: any, archiveId: string) {
193193
if (this.events) {
194194
this.events.notify({
195195
eventName: 'archiveStoppedWithId',

0 commit comments

Comments
 (0)