Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo-ng-firestore/src/app/webrtc/firebase.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ export class FirebaseProvider {

snapshot.forEach((doc) => {
iceCandidates.push(<WebRTCIceCandidate>doc.data());
resolve(iceCandidates);
});
resolve(iceCandidates);
})
.catch((error) => { reject(error); });
});
Expand Down
2 changes: 1 addition & 1 deletion demo-ng-firestore/src/app/webrtc/webrtc.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface WebRTCRoom {

export interface WebRTCOffer {
sdp: any;
type: string; // e.g. "offer"
type: string; // e.g. "offer" or "answer"
}

export interface WebRTCIceCandidate {
Expand Down
2 changes: 1 addition & 1 deletion src/angular/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Directive, NgModule } from '@angular/core';
import { registerElement } from 'nativescript-angular/element-registry';
import { registerElement } from '@nativescript/angular';
import { WebRTCView } from '../';

registerElement('WebRTCView', () => WebRTCView);
Expand Down
2 changes: 1 addition & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export { IceConnectionState, IceServer, IceGatheringState, Quality, SignalingState, WebRTCDataChannelMessageType, WebRTCDataChannelState, WebRTCIceCandidate, WebRTCOptions, WebRTCSdp, WebRTCSdpType, WebRTCState } from './webrtc.common';

import { View } from '@nativescript/core';
import { Common, Quality, WebRTCDataChannelMessageType, WebRTCIceCandidate, WebRTCOptions, WebRTCSdp } from './webrtc.common';
import { View } from 'tns-core-modules/ui/core/view';

export declare class WebRTC extends Common {
private webrtc;
Expand Down
5 changes: 3 additions & 2 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@
"@angular/platform-browser": "~8.0.0",
"@angular/platform-browser-dynamic": "~8.0.0",
"@angular/router": "~8.0.0",
"nativescript-angular": "~8.0.0",
"@angular/animations": "^12.0.5",
"@nativescript/angular": "^12.0.2",
"@nativescript/core": "^8.0.8",
"prompt": "^1.0.0",
"rimraf": "^2.6.2",
"rxjs": "~6.3.3",
"semver": "^5.5.0",
"tns-core-modules": "^6.0.7",
"tns-platform-declarations": "^6.0.7",
"tslint": "~5.4.3",
"typescript": "~3.4.5",
Expand Down
2 changes: 1 addition & 1 deletion src/platforms/android/include.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dependencies {
implementation 'org.webrtc:google-webrtc:1.0.30039'
implementation 'org.webrtc:google-webrtc:1.0.32006'
implementation 'com.google.code.gson:gson:2.8.5'
}
2 changes: 1 addition & 1 deletion src/platforms/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
platform :ios, '10.0'
pod 'GoogleWebRTC', '~> 1.1.29400'
pod 'FancyWebRTC', :git => 'https://github.com/triniwiz/fancy-webrtc-ios.git'
pod 'FancyWebRTC', :git => 'https://github.com/ksteuer/fancy-webrtc-ios.git'

post_install do |installer|
installer.pods_project.targets.each do |target|
Expand Down
2 changes: 1 addition & 1 deletion src/src/android/TNSRTCMediaDevices.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as app from 'tns-core-modules/application';
import * as app from '@nativescript/core/application';
import { TNSRTCMediaStreamConstraints } from './TNSRTCMediaStreamConstraints';
import { TNSRTCMediaStream } from './TNSRTCMediaStream';
import { TNSMediaDevicesInfo } from '../core/TNSMediaDevicesInfo';
Expand Down
6 changes: 3 additions & 3 deletions src/src/android/TNSRTCPeerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
TNSRTCTrackEvent
} from './';
import { TNSRTCPeerConnectionState } from '../core/TNSRTCPeerConnectionState';
import * as utils from 'tns-core-modules/utils/utils';
import * as utils from '@nativescript/core/utils';

declare var co;

Expand Down Expand Up @@ -248,7 +248,7 @@ export class TNSRTCPeerConnection {
}

public setLocalDescription(sdp: TNSRTCSessionDescription): Promise<any> {
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
const ref = new WeakRef(this);
this.android.setLocalDescription(sdp.instance, new co.fitcom.fancywebrtc.FancyRTCPeerConnection.SdpSetListener({
onSuccess(): void {
Expand All @@ -265,7 +265,7 @@ export class TNSRTCPeerConnection {
}

public setRemoteDescription(sdp: TNSRTCSessionDescription): Promise<any> {
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
const ref = new WeakRef(this);
this.android.setRemoteDescription(sdp.instance, new co.fitcom.fancywebrtc.FancyRTCPeerConnection.SdpSetListener({
onSuccess(): void {
Expand Down
2 changes: 1 addition & 1 deletion src/src/android/TNSRTCVideoTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class TNSRTCVideoTrack extends TNSRTCMediaStreamTrack {
}

public applyConstraints(constraints: TNSMediaTrackConstraints): Promise<any> {
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
const nativeMap = new java.util.HashMap();
if (constraints.facingMode) {
nativeMap.put('facingMode', constraints.facingMode);
Expand Down
2 changes: 1 addition & 1 deletion src/src/base/TNSRTCDTMFSenderBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export abstract class TNSRTCDTMFSenderBase {
constructor(sender) {
}

public toneBuffer: string;
public get toneBuffer(): string { return undefined; }


public abstract dispose(): void;
Expand Down
12 changes: 6 additions & 6 deletions src/src/base/TNSRTCIceCandidateBase.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export abstract class TNSRTCIceCandidateBase {
_iceCandidate;
candidate: string;
sdp: string;
sdpMid: string | null;
sdpMLineIndex: number;
usernameFragment: string;
serverUrl: string;
get candidate(): string { return undefined; }
get sdp(): string { return undefined; }
get sdpMid(): string | null { return undefined; }
get sdpMLineIndex(): number { return undefined; }
get usernameFragment(): string { return undefined; }
get serverUrl(): string { return undefined; }

constructor(sdp: string, sdpMid: string | null, sdpMLineIndex: number) {
}
Expand Down
8 changes: 4 additions & 4 deletions src/src/base/TNSRTCIceServerBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ export abstract class TNSRTCIceServerBase {

public abstract toWebRtc(): void;

public iceServer;
public get iceServer() { return undefined; }

public credentialType;
public get credentialType() { return undefined; }

public urls: Array<String>;
public get urls(): Array<String> { return undefined; }

public username: string;
public get username(): string { return undefined; }

}
10 changes: 5 additions & 5 deletions src/src/base/TNSRTCMediaStreamTrackBase.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export abstract class TNSRTCMediaStreamTrackBase {
public id: string;
public get id(): string { return undefined; }

public enabled: boolean;
public get enabled(): boolean { return undefined; }

public kind: string;
public get kind(): string { return undefined; }

public mute: boolean;
public get mute(): boolean { return undefined; }

public abstract dispose(): void;

public readyState: string;
public get readyState(): string { return undefined; }

constructor(mediaStreamTrack: any) {
}
Expand Down
8 changes: 4 additions & 4 deletions src/src/base/TNSRTCRtpSenderBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ export abstract class TNSRTCRtpSenderBase {
constructor(sender) {
}

public dtmf: TNSRTCDTMFSenderBase;
public get dtmf(): TNSRTCDTMFSenderBase { return undefined; }

public id: string;
public get id(): string { return undefined; }

public abstract dispose(): void;

public track: TNSRTCMediaStreamTrackBase;
public get track(): TNSRTCMediaStreamTrackBase { return undefined; }

public parameters: TNSRTCRtpParametersBase;
public get parameters(): TNSRTCRtpParametersBase { return undefined; }

public abstract replaceTrack(track: TNSRTCMediaStreamTrackBase): void ;
}
13 changes: 6 additions & 7 deletions src/src/base/TNSRTCRtpTransceiverBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ export abstract class TNSRTCRtpTransceiverBase {
constructor(transceiver) {
}

public direction: TNSRTCRtpTransceiverDirection;
public get direction(): TNSRTCRtpTransceiverDirection { return undefined; }

public currentDirection: TNSRTCRtpTransceiverDirection;
public get currentDirection(): TNSRTCRtpTransceiverDirection { return undefined; }

public mid: string;
public get mid(): string { return undefined; }

public receiver: TNSRTCRtpReceiverBase;
public get receiver(): TNSRTCRtpReceiverBase { return undefined; }

public sender: TNSRTCRtpSenderBase;
public get sender(): TNSRTCRtpSenderBase { return undefined; }


public stopped: boolean;
public get stopped(): boolean { return undefined; }

public abstract stop(): void;
}
8 changes: 4 additions & 4 deletions src/src/base/TNSRTCTrackEventBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { TNSRTCRtpReceiverBase } from './TNSRTCRtpReceiverBase';
import { TNSRTCRtpTransceiverBase } from './TNSRTCRtpTransceiverBase';

export class TNSRTCTrackEventBase {
mediaTrack: TNSRTCMediaStreamTrackBase;
transceiver: TNSRTCRtpTransceiverBase;
receiver?: TNSRTCRtpReceiverBase;
streams?: Array<TNSRTCMediaStreamBase>;
public get mediaTrack(): TNSRTCMediaStreamTrackBase { return undefined; }
public get transceiver(): TNSRTCRtpTransceiverBase { return undefined; }
public get receiver(): TNSRTCRtpReceiverBase { return undefined; }
public get streams(): Array<TNSRTCMediaStreamBase> { return undefined; }

constructor(event) {
}
Expand Down
4 changes: 2 additions & 2 deletions src/src/ios/TNSRTCPeerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export class TNSRTCPeerConnection {
}

public setLocalDescription(sdp: TNSRTCSessionDescription): Promise<any> {
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
this.ios.localDescriptionWithSdpListener(sdp.instance, (error) => {
if (error) {
reject(error);
Expand All @@ -266,7 +266,7 @@ export class TNSRTCPeerConnection {
}

public setRemoteDescription(sdp: TNSRTCSessionDescription): Promise<any> {
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
this.ios.remoteDescriptionWithSdpListener(sdp.instance, (error) => {
if (error) {
reject(error);
Expand Down
2 changes: 1 addition & 1 deletion src/src/ios/TNSRTCVideoTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class TNSRTCVideoTrack extends TNSRTCMediaStreamTrack {
}

public applyConstraints(constraints: TNSMediaTrackConstraints): Promise<any> {
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
const obj = {};
if (constraints.facingMode) {
obj['facingMode'] = constraints.facingMode;
Expand Down
13 changes: 6 additions & 7 deletions src/webrtc.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import {
WebRTCSdpType
} from './webrtc.common';

import { fromObject } from 'tns-core-modules/data/observable';
import { View } from 'tns-core-modules/ui/core/view';
import { ad } from 'tns-core-modules/utils/utils';
import { fromObject,View } from '@nativescript/core';
import * as permissions from 'nativescript-permissions';
import { TNSRTCMediaStream, TNSRTCMediaStreamTrack } from './src/android';
import * as app from 'tns-core-modules/application';
import { ad } from '@nativescript/core/utils';
import { AndroidApplication, AndroidActivityResultEventData, android as androidApp } from '@nativescript/core/application'

export * from './src/android';
export {
Expand Down Expand Up @@ -374,7 +373,7 @@ export class WebRTC extends Common {
);
}

private static _callbackFn(args: app.AndroidActivityResultEventData) {
private static _callbackFn(args: AndroidActivityResultEventData) {
co.fitcom.fancywebrtc.FancyRTCApplicationHelper.getInstance().handleResult(args.requestCode, args.resultCode, args.intent);
}

Expand All @@ -385,8 +384,8 @@ export class WebRTC extends Common {
if (!this.callback) {
this.callback = this._callbackFn.bind(this);
}
app.android.off(app.AndroidApplication.activityResultEvent, this.callback);
app.android.on(app.AndroidApplication.activityResultEvent, this.callback);
androidApp.off(AndroidApplication.activityResultEvent, this.callback);
androidApp.on(AndroidApplication.activityResultEvent, this.callback);
}

public dataChannelSend(
Expand Down
2 changes: 1 addition & 1 deletion src/webrtc.common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Observable } from 'tns-core-modules/data/observable';
import { Observable } from '@nativescript/core';

export class Common extends Observable {
defaultServers: Array<string> = [
Expand Down
10 changes: 5 additions & 5 deletions src/webrtc.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
WebRTCSdp,
WebRTCSdpType
} from './webrtc.common';
import { layout, View } from 'tns-core-modules/ui/core/view';
import { fromObject } from 'tns-core-modules/data/observable';
import { layout } from '@nativescript/core/utils';
import { fromObject, View } from '@nativescript/core';
import './async-await';

import { TNSRTCMediaStream, TNSRTCMediaStreamTrack } from './src/ios';
Expand Down Expand Up @@ -132,7 +132,7 @@ export class WebRTC extends Common {
}

private static requestCameraPermission() {
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
AVCaptureDevice.requestAccessForMediaTypeCompletionHandler(
AVMediaTypeVideo,
granted => {
Expand All @@ -147,7 +147,7 @@ export class WebRTC extends Common {
}

private static requestAudioPermission() {
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
AVCaptureDevice.requestAccessForMediaTypeCompletionHandler(
AVMediaTypeAudio,
granted => {
Expand All @@ -162,7 +162,7 @@ export class WebRTC extends Common {
}

public static requestPermissions(explanation?: string): Promise<any> {
return new Promise(async (resolve, reject) => {
return new Promise<void>(async (resolve, reject) => {
try {
await WebRTC.requestCameraPermission();
await WebRTC.requestAudioPermission();
Expand Down