Skip to content

Commit a0b477a

Browse files
authored
Merge pull request #38 from triniwiz/alpha22
alpha22
2 parents d9be218 + bef1fee commit a0b477a

File tree

5 files changed

+35
-22
lines changed

5 files changed

+35
-22
lines changed

demo/app/standard/standard-vm.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import {
88
TNSRTCPeerConnection,
99
TNSRTCSdpType,
1010
TNSRTCSessionDescription,
11-
WebRTC
11+
WebRTC,
12+
TNSRTCIceServer,
13+
TNSRTCConfiguration
1214
} from 'nativescript-webrtc-plugin';
1315

1416
export class StandardViewModel extends Observable {
@@ -27,7 +29,13 @@ export class StandardViewModel extends Observable {
2729

2830
constructor() {
2931
super();
30-
this.connection = new TNSRTCPeerConnection();
32+
const config = new TNSRTCConfiguration({
33+
iceServers: [
34+
new TNSRTCIceServer(['stun:stun.l.google.com:19302']),
35+
new TNSRTCIceServer(['stun:stun1.l.google.com:19302']),
36+
]
37+
})
38+
this.connection = new TNSRTCPeerConnection(config);
3139
this.connection.onIceCandidate(candidate => {
3240
const object = {};
3341
object['from'] = this.me;
@@ -43,7 +51,7 @@ export class StandardViewModel extends Observable {
4351
}
4452
});
4553
this.me = this.generateId();
46-
this.socket = new SocketIO('http://192.168.0.10:3001', {
54+
this.socket = new SocketIO('http://192.168.0.15:3001', {
4755
forceNew: true,
4856
secure: false
4957
});
@@ -128,7 +136,7 @@ export class StandardViewModel extends Observable {
128136
}
129137
});
130138
} else {
131-
this.setUpUserMedia();
139+
this.setUpUserMedia();
132140
}
133141
}
134142

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-webrtc-plugin",
3-
"version": "2.0.0-alpha.21",
3+
"version": "2.0.0-alpha.22",
44
"description": "WebRTC for NativeScript",
55
"main": "webrtc",
66
"typings": "index.d.ts",
38 Bytes
Binary file not shown.

src/src/android/TNSRTCIceServer.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ export class TNSRTCIceServer extends TNSRTCIceServerBase {
44

55
constructor(urls: Array<string>, username?: string, credential?: string) {
66
super(urls, username, credential);
7+
const array = Array.create('java.lang.String', urls.length);
8+
const length = urls.length;
9+
for(let i = 0; i < length;i++){
10+
array[i] = urls[i];
11+
}
712
if (urls && !username && !credential) {
8-
this.server = new co.fitcom.fancywebrtc.FancyRTCIceServer(urls as any);
13+
this.server = new co.fitcom.fancywebrtc.FancyRTCIceServer(array);
914
} else {
10-
this.server = new co.fitcom.fancywebrtc.FancyRTCIceServer(urls as any, username, credential);
15+
this.server = new co.fitcom.fancywebrtc.FancyRTCIceServer(array, username, credential);
1116
}
1217

1318
}

src/src/index.d.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ declare class TNSRTCTrackEventBase {
205205
/* Base */
206206

207207
export declare class TNSRTCAudioTrack extends TNSRTCMediaStreamTrack {
208-
protected _audioTrack;
208+
private _audioTrack;
209209

210210
constructor(track: any);
211211

@@ -220,7 +220,7 @@ export declare class TNSRTCAudioTrack extends TNSRTCMediaStreamTrack {
220220
}
221221

222222
export declare class TNSRTCConfiguration extends TNSRTCConfigurationBase {
223-
protected _configuration;
223+
_configuration;
224224

225225
constructor(options?: TNSRTCConfigurationOptions);
226226

@@ -230,7 +230,7 @@ export declare class TNSRTCConfiguration extends TNSRTCConfigurationBase {
230230
}
231231

232232
export declare class TNSRTCDataChannel extends TNSRTCDataChannelBase {
233-
protected _channel;
233+
private _channel;
234234

235235
protected constructor();
236236

@@ -242,7 +242,7 @@ export declare class TNSRTCDataChannel extends TNSRTCDataChannelBase {
242242
}
243243

244244
export declare class TNSRTCDataChannelEvent extends TNSRTCDataChannelEventBase {
245-
protected _event;
245+
private _event;
246246

247247
constructor(event: any);
248248

@@ -252,7 +252,7 @@ export declare class TNSRTCDataChannelEvent extends TNSRTCDataChannelEventBase {
252252
}
253253

254254
export declare class TNSRTCDTMFSender extends TNSRTCDTMFSenderBase {
255-
protected _sender;
255+
private _sender;
256256

257257
protected constructor();
258258

@@ -310,7 +310,7 @@ export declare class TNSRTCMediaDevices {
310310
}
311311

312312
export declare class TNSRTCMediaStream extends TNSRTCMediaStreamBase {
313-
protected _stream;
313+
private _stream;
314314

315315
protected constructor();
316316

@@ -331,7 +331,7 @@ export declare class TNSRTCMediaStream extends TNSRTCMediaStreamBase {
331331
}
332332

333333
declare class TNSRTCMediaStreamConstraints extends TNSRTCMediaStreamConstraintsBase {
334-
protected _mediaStreamConstraints;
334+
private _mediaStreamConstraints;
335335

336336
constructor(audio: any, video: any);
337337

@@ -342,7 +342,7 @@ declare class TNSRTCMediaStreamConstraints extends TNSRTCMediaStreamConstraintsB
342342

343343

344344
export declare class TNSRTCMediaStreamTrack extends TNSRTCMediaStreamTrackBase {
345-
protected _mediaStreamTrack;
345+
private _mediaStreamTrack;
346346

347347
constructor(mediaStreamTrack: any);
348348

@@ -418,7 +418,7 @@ export declare class TNSRTCPeerConnection {
418418
}
419419

420420
export declare class TNSRTCRtpParameters extends TNSRTCRtpParametersBase {
421-
protected _parameters;
421+
private _parameters;
422422

423423
protected constructor();
424424

@@ -431,7 +431,7 @@ export declare class TNSRTCRtpParameters extends TNSRTCRtpParametersBase {
431431

432432

433433
export declare class TNSRTCRtpReceiver extends TNSRTCRtpReceiverBase {
434-
protected _receiver;
434+
private _receiver;
435435

436436
protected constructor();
437437

@@ -444,7 +444,7 @@ export declare class TNSRTCRtpReceiver extends TNSRTCRtpReceiverBase {
444444

445445

446446
export declare class TNSRTCRtpSender extends TNSRTCRtpSenderBase {
447-
protected _sender;
447+
private _sender;
448448

449449
protected constructor();
450450

@@ -466,7 +466,7 @@ export declare class TNSRTCRtpSender extends TNSRTCRtpSenderBase {
466466

467467

468468
export declare class TNSRTCRtpTransceiver extends TNSRTCRtpTransceiverBase {
469-
protected _transceiver;
469+
private _transceiver;
470470

471471
protected constructor();
472472

@@ -494,7 +494,7 @@ export declare enum TNSRTCSdpType {
494494

495495

496496
export declare class TNSRTCSessionDescription {
497-
protected _sessionDescription;
497+
private _sessionDescription;
498498

499499
constructor(...args: any[]);
500500

@@ -512,7 +512,7 @@ export declare class TNSRTCSessionDescription {
512512

513513

514514
export declare class TNSRTCTrackEvent extends TNSRTCTrackEventBase {
515-
protected _event;
515+
private _event;
516516

517517
constructor(event: any);
518518

@@ -526,7 +526,7 @@ export declare class TNSRTCTrackEvent extends TNSRTCTrackEventBase {
526526

527527

528528
export declare class TNSRTCVideoTrack extends TNSRTCMediaStreamTrack {
529-
protected _videoTrack;
529+
private _videoTrack;
530530

531531
constructor(track: any);
532532

0 commit comments

Comments
 (0)