diff --git a/demo/app/standard/standard-vm.ts b/demo/app/standard/standard-vm.ts index 935a1b1..f5118c0 100644 --- a/demo/app/standard/standard-vm.ts +++ b/demo/app/standard/standard-vm.ts @@ -8,7 +8,9 @@ import { TNSRTCPeerConnection, TNSRTCSdpType, TNSRTCSessionDescription, - WebRTC + WebRTC, + TNSRTCIceServer, + TNSRTCConfiguration } from 'nativescript-webrtc-plugin'; export class StandardViewModel extends Observable { @@ -27,7 +29,13 @@ export class StandardViewModel extends Observable { constructor() { super(); - this.connection = new TNSRTCPeerConnection(); + const config = new TNSRTCConfiguration({ + iceServers: [ + new TNSRTCIceServer(['stun:stun.l.google.com:19302']), + new TNSRTCIceServer(['stun:stun1.l.google.com:19302']), + ] + }) + this.connection = new TNSRTCPeerConnection(config); this.connection.onIceCandidate(candidate => { const object = {}; object['from'] = this.me; @@ -43,7 +51,7 @@ export class StandardViewModel extends Observable { } }); this.me = this.generateId(); - this.socket = new SocketIO('http://192.168.0.10:3001', { + this.socket = new SocketIO('http://192.168.0.15:3001', { forceNew: true, secure: false }); @@ -128,7 +136,7 @@ export class StandardViewModel extends Observable { } }); } else { - this.setUpUserMedia(); + this.setUpUserMedia(); } } diff --git a/src/package.json b/src/package.json index de991eb..a10e0b7 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-webrtc-plugin", - "version": "2.0.0-alpha.21", + "version": "2.0.0-alpha.22", "description": "WebRTC for NativeScript", "main": "webrtc", "typings": "index.d.ts", diff --git a/src/platforms/android/fancywebrtc-release.aar b/src/platforms/android/fancywebrtc-release.aar index 560f30b..6fc8392 100644 Binary files a/src/platforms/android/fancywebrtc-release.aar and b/src/platforms/android/fancywebrtc-release.aar differ diff --git a/src/src/android/TNSRTCIceServer.ts b/src/src/android/TNSRTCIceServer.ts index f26c44e..0d1e03d 100644 --- a/src/src/android/TNSRTCIceServer.ts +++ b/src/src/android/TNSRTCIceServer.ts @@ -4,10 +4,15 @@ export class TNSRTCIceServer extends TNSRTCIceServerBase { constructor(urls: Array, username?: string, credential?: string) { super(urls, username, credential); + const array = Array.create('java.lang.String', urls.length); + const length = urls.length; + for(let i = 0; i < length;i++){ + array[i] = urls[i]; + } if (urls && !username && !credential) { - this.server = new co.fitcom.fancywebrtc.FancyRTCIceServer(urls as any); + this.server = new co.fitcom.fancywebrtc.FancyRTCIceServer(array); } else { - this.server = new co.fitcom.fancywebrtc.FancyRTCIceServer(urls as any, username, credential); + this.server = new co.fitcom.fancywebrtc.FancyRTCIceServer(array, username, credential); } } diff --git a/src/src/index.d.ts b/src/src/index.d.ts index b0a235a..8572364 100644 --- a/src/src/index.d.ts +++ b/src/src/index.d.ts @@ -205,7 +205,7 @@ declare class TNSRTCTrackEventBase { /* Base */ export declare class TNSRTCAudioTrack extends TNSRTCMediaStreamTrack { - protected _audioTrack; + private _audioTrack; constructor(track: any); @@ -220,7 +220,7 @@ export declare class TNSRTCAudioTrack extends TNSRTCMediaStreamTrack { } export declare class TNSRTCConfiguration extends TNSRTCConfigurationBase { - protected _configuration; + _configuration; constructor(options?: TNSRTCConfigurationOptions); @@ -230,7 +230,7 @@ export declare class TNSRTCConfiguration extends TNSRTCConfigurationBase { } export declare class TNSRTCDataChannel extends TNSRTCDataChannelBase { - protected _channel; + private _channel; protected constructor(); @@ -242,7 +242,7 @@ export declare class TNSRTCDataChannel extends TNSRTCDataChannelBase { } export declare class TNSRTCDataChannelEvent extends TNSRTCDataChannelEventBase { - protected _event; + private _event; constructor(event: any); @@ -252,7 +252,7 @@ export declare class TNSRTCDataChannelEvent extends TNSRTCDataChannelEventBase { } export declare class TNSRTCDTMFSender extends TNSRTCDTMFSenderBase { - protected _sender; + private _sender; protected constructor(); @@ -310,7 +310,7 @@ export declare class TNSRTCMediaDevices { } export declare class TNSRTCMediaStream extends TNSRTCMediaStreamBase { - protected _stream; + private _stream; protected constructor(); @@ -331,7 +331,7 @@ export declare class TNSRTCMediaStream extends TNSRTCMediaStreamBase { } declare class TNSRTCMediaStreamConstraints extends TNSRTCMediaStreamConstraintsBase { - protected _mediaStreamConstraints; + private _mediaStreamConstraints; constructor(audio: any, video: any); @@ -342,7 +342,7 @@ declare class TNSRTCMediaStreamConstraints extends TNSRTCMediaStreamConstraintsB export declare class TNSRTCMediaStreamTrack extends TNSRTCMediaStreamTrackBase { - protected _mediaStreamTrack; + private _mediaStreamTrack; constructor(mediaStreamTrack: any); @@ -418,7 +418,7 @@ export declare class TNSRTCPeerConnection { } export declare class TNSRTCRtpParameters extends TNSRTCRtpParametersBase { - protected _parameters; + private _parameters; protected constructor(); @@ -431,7 +431,7 @@ export declare class TNSRTCRtpParameters extends TNSRTCRtpParametersBase { export declare class TNSRTCRtpReceiver extends TNSRTCRtpReceiverBase { - protected _receiver; + private _receiver; protected constructor(); @@ -444,7 +444,7 @@ export declare class TNSRTCRtpReceiver extends TNSRTCRtpReceiverBase { export declare class TNSRTCRtpSender extends TNSRTCRtpSenderBase { - protected _sender; + private _sender; protected constructor(); @@ -466,7 +466,7 @@ export declare class TNSRTCRtpSender extends TNSRTCRtpSenderBase { export declare class TNSRTCRtpTransceiver extends TNSRTCRtpTransceiverBase { - protected _transceiver; + private _transceiver; protected constructor(); @@ -494,7 +494,7 @@ export declare enum TNSRTCSdpType { export declare class TNSRTCSessionDescription { - protected _sessionDescription; + private _sessionDescription; constructor(...args: any[]); @@ -512,7 +512,7 @@ export declare class TNSRTCSessionDescription { export declare class TNSRTCTrackEvent extends TNSRTCTrackEventBase { - protected _event; + private _event; constructor(event: any); @@ -526,7 +526,7 @@ export declare class TNSRTCTrackEvent extends TNSRTCTrackEventBase { export declare class TNSRTCVideoTrack extends TNSRTCMediaStreamTrack { - protected _videoTrack; + private _videoTrack; constructor(track: any);