@campoint/vxwebrtc 0.0.11-alpha → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,7 @@ export declare class WebRtcInputConnection extends WebRtcPeerConnection {
11
11
  protected onWsMessage(evt: MessageEvent): void;
12
12
  getStream(): MediaStream;
13
13
  start(): void;
14
+ protected restartConnectionWithTcp(): void;
14
15
  }
15
16
  export interface IWebRtcInputConnection extends IWebRtcPeerConnectionOptions {
16
17
  videoElement?: HTMLVideoElement;
@@ -2,18 +2,27 @@ import { MediaInfo } from './Types/CommonConnectionTypes';
2
2
  import WebRtcPeerConnection, { IWebRtcPeerConnectionOptions } from './WebRtcPeerConnection';
3
3
  export declare class WebRtcOutputConnection extends WebRtcPeerConnection {
4
4
  protected connectionOptions: IWebRtcOutputConnection;
5
- protected wsConnection?: WebSocket;
6
- protected peerConnection?: RTCPeerConnection;
7
5
  private peerConnectionConfig?;
8
- private videoSender?;
9
- private audioSender?;
6
+ private isUsingTcpFallback;
10
7
  constructor(connectionOptions: IWebRtcOutputConnection);
11
8
  protected onRtcDescription(description: RTCSessionDescriptionInit): void;
9
+ private mungeDescription;
12
10
  protected onWsOpen(): void;
11
+ private initializePeerConnection;
12
+ private handleIceCandidate;
13
+ private onNegotiationNeeded;
14
+ private attachLocalTracks;
15
+ private assignSender;
16
+ private applyBitrateParams;
13
17
  protected onWsMessage(evt: MessageEvent): void;
14
- changeTrack(newTrack: MediaStreamTrack): Promise<void>;
18
+ private parseWebSocketMessage;
19
+ private validateMessageStatus;
20
+ private handleSdpData;
21
+ private handleIceCandidates;
22
+ private isUdpCandidate;
15
23
  start(): void;
16
24
  stop(): void;
25
+ protected restartConnectionWithTcp(): void;
17
26
  }
18
27
  export interface IWebRtcOutputConnection extends IWebRtcPeerConnectionOptions {
19
28
  localStream: MediaStream;
@@ -1,20 +1,24 @@
1
1
  import { EnumWebSocketConnectionCommand, EnumWebSocketConnectionDirection, OnErrorCallback, OnStopCallback, StreamInfo } from './Types/CommonConnectionTypes';
2
2
  declare abstract class WebRtcPeerConnection {
3
- protected connectionOptions: IWebRtcPeerConnectionOptions;
3
+ protected readonly connectionOptions: IWebRtcPeerConnectionOptions;
4
4
  protected wsConnection?: WebSocket;
5
5
  protected peerConnection?: RTCPeerConnection;
6
+ private hasAttemptedTcpFallback;
6
7
  protected abstract onRtcDescription(description: RTCSessionDescriptionInit): void;
7
8
  protected abstract onWsOpen(): void;
8
9
  protected abstract onWsMessage(evt: MessageEvent): void;
10
+ protected abstract restartConnectionWithTcp?(): void;
9
11
  protected constructor(connectionOptions: IWebRtcPeerConnectionOptions);
10
12
  protected sendResponse(direction: EnumWebSocketConnectionDirection, command: EnumWebSocketConnectionCommand, description?: RTCSessionDescriptionInit): void;
11
13
  protected connectToWebSocket(): void;
12
- /**
13
- * @description iOS gets the [Abnormal Closure](https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code) error when closing a socket
14
- * without specifying the reason. We should always send this code.
15
- */
14
+ private onWsError;
15
+ private isWebSocketClosing;
16
16
  protected disconnectFromWebSocket(code?: number): void;
17
17
  protected onError(error: Error): void;
18
+ protected setupIceConnectionMonitoring(peerConnection: RTCPeerConnection): void;
19
+ private handleIceConnectionStateChange;
20
+ private handleConnectionStateChange;
21
+ private handleIceConnectionFailure;
18
22
  start(): void;
19
23
  stop(): void;
20
24
  stats(): Promise<RTCStatsReport | undefined>;
@@ -25,5 +29,6 @@ export interface IWebRtcPeerConnectionOptions {
25
29
  userData?: object;
26
30
  onStop: OnStopCallback;
27
31
  onError: OnErrorCallback;
32
+ enableTcpFallback?: boolean;
28
33
  }
29
34
  export default WebRtcPeerConnection;