@campoint/vxwebrtc 0.0.5 → 0.0.8
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.
- package/README.md +4 -1
- package/dist/MungeSdp.d.ts +2 -0
- package/dist/Types/CodecsOptions.d.ts +8 -0
- package/dist/Types/CommonConnectionTypes.d.ts +48 -0
- package/dist/Types/EnumCodecContentType.d.ts +13 -0
- package/dist/Types/EnumMediaStreamTrackKind.d.ts +4 -0
- package/dist/Types/WebRTCStreamConfig.d.ts +26 -0
- package/dist/WebRtcInputConnection.d.ts +19 -0
- package/dist/WebRtcOutputConnection.d.ts +21 -0
- package/dist/WebRtcPeerConnection.d.ts +23 -0
- package/dist/browserSupportedAudioCodec.d.ts +13 -0
- package/dist/browserSupportedVideoCodec.d.ts +7 -0
- package/dist/stats.json +10371 -0
- package/dist/utils.d.ts +6 -0
- package/dist/version.d.ts +1 -0
- package/{src/vxwebrtc.ts → dist/vxwebrtc.d.ts} +1 -8
- package/dist/vxwebrtc.js +3 -0
- package/dist/vxwebrtc.js.LICENSE.txt +8 -0
- package/dist/vxwebrtc.js.map +1 -0
- package/package.json +5 -2
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -22
- package/.gitlab-ci.yml +0 -51
- package/.husky/pre-commit +0 -4
- package/.prettierignore +0 -1
- package/src/MungeSdp.ts +0 -323
- package/src/Types/CodecsOptions.ts +0 -9
- package/src/Types/CommonConnectionTypes.ts +0 -57
- package/src/Types/EnumCodecContentType.ts +0 -13
- package/src/Types/EnumMediaStreamTrackKind.ts +0 -4
- package/src/Types/WebRTCStreamConfig.ts +0 -59
- package/src/WebRtcInputConnection.ts +0 -152
- package/src/WebRtcOutputConnection.ts +0 -153
- package/src/WebRtcPeerConnection.ts +0 -91
- package/src/browserSupportedAudioCodec.ts +0 -49
- package/src/browserSupportedVideoCodec.ts +0 -39
- package/src/utils.ts +0 -18
- package/src/version.ts +0 -1
- package/tsconfig.json +0 -15
- package/tslint.json +0 -18
- package/webpack.common.js +0 -44
- package/webpack.dev.js +0 -7
- package/webpack.prod.js +0 -7
package/README.md
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { TConstrainULongRange } from './WebRTCStreamConfig';
|
|
2
|
+
import { TWebRtcH264CodecOptions, TWebRtcVP9CodecOptions } from './CodecsOptions';
|
|
3
|
+
export declare type OnErrorCallback = (e: Error) => void;
|
|
4
|
+
export declare type OnStopCallback = () => void;
|
|
5
|
+
export interface StreamInfo {
|
|
6
|
+
applicationName: string;
|
|
7
|
+
streamName: string;
|
|
8
|
+
sessionId: string;
|
|
9
|
+
}
|
|
10
|
+
export interface WebSocketReply {
|
|
11
|
+
status: string;
|
|
12
|
+
statusDescription: string;
|
|
13
|
+
command: string;
|
|
14
|
+
streamInfo?: StreamInfo;
|
|
15
|
+
sdp?: RTCSessionDescriptionInit;
|
|
16
|
+
iceCandidates?: RTCIceCandidateInit[];
|
|
17
|
+
direction: string;
|
|
18
|
+
}
|
|
19
|
+
export declare enum EnumVideoCodec {
|
|
20
|
+
H264 = "42e01f"
|
|
21
|
+
}
|
|
22
|
+
export interface MediaInfo {
|
|
23
|
+
audioBitrate: TConstrainULongRange;
|
|
24
|
+
audioCodec: string;
|
|
25
|
+
videoBitrate: TConstrainULongRange;
|
|
26
|
+
videoCodec: string;
|
|
27
|
+
videoFrameRate: ConstrainULongRange;
|
|
28
|
+
h264CodecOptions: TWebRtcH264CodecOptions;
|
|
29
|
+
vp9CodecOptions: TWebRtcVP9CodecOptions;
|
|
30
|
+
}
|
|
31
|
+
export declare enum EnumWebSocketConnectionStatus {
|
|
32
|
+
OK = 200,
|
|
33
|
+
NOT_READY = 514
|
|
34
|
+
}
|
|
35
|
+
export declare enum EnumWebSocketConnectionDirection {
|
|
36
|
+
PUBLISH = "publish",
|
|
37
|
+
PLAY = "play"
|
|
38
|
+
}
|
|
39
|
+
export declare enum EnumWebSocketConnectionCommand {
|
|
40
|
+
SEND_OFFER = "sendOffer",
|
|
41
|
+
GET_OFFER = "getOffer",
|
|
42
|
+
SEND_RESPONSE = "sendResponse",
|
|
43
|
+
GET_AVAILABLE_STREAM = "getAvailableStreams"
|
|
44
|
+
}
|
|
45
|
+
export declare enum EnumMediaStreamTrackKind {
|
|
46
|
+
AUDIO = "audio",
|
|
47
|
+
VIDEO = "video"
|
|
48
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum EnumCodecContentType {
|
|
2
|
+
OPUS = "audio/mp4;codecs=\"opus\"",
|
|
3
|
+
VORBIS = "audio/ogg;codecs=\"vorbis\"",
|
|
4
|
+
H264 = "video/mp4",
|
|
5
|
+
VP8 = "video/webm;codecs=\"vp8\"",
|
|
6
|
+
VP9 = "video/webm;codecs=\"vp9\"",
|
|
7
|
+
WEBM = "video/webm",
|
|
8
|
+
HLS = "application/vnd.apple.mpegURL",
|
|
9
|
+
H264_AVC = "video/mp4; codecs=\"avc1.42E01E\"",
|
|
10
|
+
H264_MP4 = "video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"",
|
|
11
|
+
H265_HEC = "video/mp4; codecs=\"hvc1.1.L0.0\"",
|
|
12
|
+
H265_HEV = "video/mp4; codecs=\"hev1.1.L0.0\""
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare abstract class WebRTCStreamConfig {
|
|
2
|
+
url: string;
|
|
3
|
+
applicationName: string;
|
|
4
|
+
streamName: string;
|
|
5
|
+
h264CodecOptions: {};
|
|
6
|
+
vp9CodecOptions: {};
|
|
7
|
+
video: TVideoPermissions;
|
|
8
|
+
audio: TAudioPermissions;
|
|
9
|
+
}
|
|
10
|
+
export declare type TAudioPermissions = {
|
|
11
|
+
noiseSuppression?: boolean;
|
|
12
|
+
echoCancellation?: boolean;
|
|
13
|
+
channelCount?: number;
|
|
14
|
+
bitRate: TConstrainULongRange;
|
|
15
|
+
};
|
|
16
|
+
export declare type TVideoPermissions = {
|
|
17
|
+
width: TConstrainULongRange;
|
|
18
|
+
height: TConstrainULongRange;
|
|
19
|
+
frameRate: TConstrainULongRange;
|
|
20
|
+
bitRate: TConstrainULongRange;
|
|
21
|
+
};
|
|
22
|
+
export declare type TConstrainULongRange = {
|
|
23
|
+
min: number;
|
|
24
|
+
ideal?: number;
|
|
25
|
+
max: number;
|
|
26
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import WebRtcPeerConnection, { IWebRtcPeerConnectionOptions } from './WebRtcPeerConnection';
|
|
2
|
+
export declare class WebRtcInputConnection extends WebRtcPeerConnection {
|
|
3
|
+
protected connectionOptions: IWebRtcInputConnection;
|
|
4
|
+
private _peerConnectionConfig?;
|
|
5
|
+
private _repeaterRetryCount;
|
|
6
|
+
private _stream;
|
|
7
|
+
constructor(connectionOptions: IWebRtcInputConnection);
|
|
8
|
+
protected onRtcDescription(description: RTCSessionDescriptionInit): void;
|
|
9
|
+
protected onRemoteTrack(event: RTCTrackEvent): void;
|
|
10
|
+
protected onWsOpen(): void;
|
|
11
|
+
protected onWsMessage(evt: MessageEvent): void;
|
|
12
|
+
getStream(): MediaStream;
|
|
13
|
+
start(): void;
|
|
14
|
+
}
|
|
15
|
+
export interface IWebRtcInputConnection extends IWebRtcPeerConnectionOptions {
|
|
16
|
+
videoElement?: HTMLVideoElement;
|
|
17
|
+
onTrack?: (string: any) => void;
|
|
18
|
+
debounceTime: number;
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MediaInfo } from './Types/CommonConnectionTypes';
|
|
2
|
+
import WebRtcPeerConnection, { IWebRtcPeerConnectionOptions } from './WebRtcPeerConnection';
|
|
3
|
+
export declare class WebRtcOutputConnection extends WebRtcPeerConnection {
|
|
4
|
+
protected connectionOptions: IWebRtcOutputConnection;
|
|
5
|
+
protected wsConnection?: WebSocket;
|
|
6
|
+
protected peerConnection?: RTCPeerConnection;
|
|
7
|
+
private peerConnectionConfig?;
|
|
8
|
+
private videoSender?;
|
|
9
|
+
private audioSender?;
|
|
10
|
+
constructor(connectionOptions: IWebRtcOutputConnection);
|
|
11
|
+
protected onRtcDescription(description: RTCSessionDescriptionInit): void;
|
|
12
|
+
protected onWsOpen(): void;
|
|
13
|
+
protected onWsMessage(evt: MessageEvent): void;
|
|
14
|
+
changeTrack(newTrack: MediaStreamTrack): Promise<void>;
|
|
15
|
+
start(): void;
|
|
16
|
+
stop(): void;
|
|
17
|
+
}
|
|
18
|
+
export interface IWebRtcOutputConnection extends IWebRtcPeerConnectionOptions {
|
|
19
|
+
localStream: MediaStream;
|
|
20
|
+
mediaInfo: MediaInfo;
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OnErrorCallback, OnStopCallback, StreamInfo, EnumWebSocketConnectionCommand, EnumWebSocketConnectionDirection } from './Types/CommonConnectionTypes';
|
|
2
|
+
declare abstract class WebRtcPeerConnection {
|
|
3
|
+
protected connectionOptions: IWebRtcPeerConnectionOptions;
|
|
4
|
+
protected wsConnection?: WebSocket;
|
|
5
|
+
protected peerConnection?: RTCPeerConnection;
|
|
6
|
+
protected abstract onRtcDescription(description: RTCSessionDescriptionInit): void;
|
|
7
|
+
protected abstract onWsOpen(): void;
|
|
8
|
+
protected abstract onWsMessage(evt: MessageEvent): void;
|
|
9
|
+
protected constructor(connectionOptions: IWebRtcPeerConnectionOptions);
|
|
10
|
+
protected sendResponse(direction: EnumWebSocketConnectionDirection, command: EnumWebSocketConnectionCommand, description?: RTCSessionDescriptionInit): void;
|
|
11
|
+
protected connectToWebSocket(): void;
|
|
12
|
+
protected onError(error: Error): void;
|
|
13
|
+
start(): void;
|
|
14
|
+
stop(): void;
|
|
15
|
+
}
|
|
16
|
+
export interface IWebRtcPeerConnectionOptions {
|
|
17
|
+
wsUrl: string;
|
|
18
|
+
streamInfo: StreamInfo;
|
|
19
|
+
userData?: object;
|
|
20
|
+
onStop: OnStopCallback;
|
|
21
|
+
onError: OnErrorCallback;
|
|
22
|
+
}
|
|
23
|
+
export default WebRtcPeerConnection;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum EnumAudioCodecs {
|
|
2
|
+
OPUS = "opus",
|
|
3
|
+
VORBIS = "vorbis",
|
|
4
|
+
PCMU = "pcmu",
|
|
5
|
+
PCMA = "pcma"
|
|
6
|
+
}
|
|
7
|
+
/** @see CanPlayTypeResult */
|
|
8
|
+
export declare enum EnumMediaCodecSupported {
|
|
9
|
+
UNKNOWN = "",
|
|
10
|
+
PROBABLY = "probably",
|
|
11
|
+
MAYBE = "maybe"
|
|
12
|
+
}
|
|
13
|
+
export declare const browserSupportedAudioCodec: (codecs: string[]) => "" | EnumAudioCodecs.OPUS | EnumAudioCodecs.VORBIS;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EnumVideoCodec } from './Types/CommonConnectionTypes';
|
|
2
|
+
export declare enum EnumVideoCodecs {
|
|
3
|
+
H264 = "h264",
|
|
4
|
+
VP9 = "VP9",
|
|
5
|
+
VP8 = "VP8"
|
|
6
|
+
}
|
|
7
|
+
export declare const browserSupportedVideoCodec: (codecs: string[]) => "" | EnumVideoCodec.H264 | EnumVideoCodecs.VP9 | EnumVideoCodecs.VP8;
|