livekit-client 0.12.2 → 0.13.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.
- package/.eslintrc.js +1 -0
- package/.github/workflows/publish.yaml +1 -3
- package/dist/api/SignalClient.d.ts +3 -1
- package/dist/api/SignalClient.js +8 -0
- package/dist/api/SignalClient.js.map +1 -1
- package/dist/connect.d.ts +23 -0
- package/dist/connect.js +93 -0
- package/dist/connect.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/options.d.ts +5 -3
- package/dist/options.js.map +1 -1
- package/dist/proto/livekit_models.d.ts +15 -0
- package/dist/proto/livekit_models.js +129 -1
- package/dist/proto/livekit_models.js.map +1 -1
- package/dist/proto/livekit_rtc.d.ts +16 -1
- package/dist/proto/livekit_rtc.js +116 -1
- package/dist/proto/livekit_rtc.js.map +1 -1
- package/dist/room/DeviceManager.d.ts +10 -0
- package/dist/room/DeviceManager.js +77 -0
- package/dist/room/DeviceManager.js.map +1 -0
- package/dist/room/RTCEngine.d.ts +1 -1
- package/dist/room/RTCEngine.js +8 -7
- package/dist/room/RTCEngine.js.map +1 -1
- package/dist/room/Room.d.ts +45 -2
- package/dist/room/Room.js +108 -2
- package/dist/room/Room.js.map +1 -1
- package/dist/room/defaults.d.ts +3 -0
- package/dist/room/defaults.js +13 -0
- package/dist/room/defaults.js.map +1 -0
- package/dist/room/events.d.ts +23 -2
- package/dist/room/events.js +22 -1
- package/dist/room/events.js.map +1 -1
- package/dist/room/participant/LocalParticipant.d.ts +28 -0
- package/dist/room/participant/LocalParticipant.js +127 -13
- package/dist/room/participant/LocalParticipant.js.map +1 -1
- package/dist/room/participant/Participant.d.ts +14 -0
- package/dist/room/participant/Participant.js +39 -0
- package/dist/room/participant/Participant.js.map +1 -1
- package/dist/room/participant/RemoteParticipant.d.ts +2 -0
- package/dist/room/participant/RemoteParticipant.js +14 -0
- package/dist/room/participant/RemoteParticipant.js.map +1 -1
- package/dist/room/track/LocalAudioTrack.d.ts +3 -0
- package/dist/room/track/LocalAudioTrack.js +37 -0
- package/dist/room/track/LocalAudioTrack.js.map +1 -1
- package/dist/room/track/LocalTrack.d.ts +6 -2
- package/dist/room/track/LocalTrack.js +34 -5
- package/dist/room/track/LocalTrack.js.map +1 -1
- package/dist/room/track/LocalTrackPublication.d.ts +6 -3
- package/dist/room/track/LocalTrackPublication.js +21 -2
- package/dist/room/track/LocalTrackPublication.js.map +1 -1
- package/dist/room/track/LocalVideoTrack.d.ts +3 -2
- package/dist/room/track/LocalVideoTrack.js +34 -5
- package/dist/room/track/LocalVideoTrack.js.map +1 -1
- package/dist/room/track/RemoteAudioTrack.d.ts +2 -0
- package/dist/room/track/RemoteAudioTrack.js +8 -0
- package/dist/room/track/RemoteAudioTrack.js.map +1 -1
- package/dist/room/track/RemoteVideoTrack.d.ts +1 -0
- package/dist/room/track/RemoteVideoTrack.js +6 -1
- package/dist/room/track/RemoteVideoTrack.js.map +1 -1
- package/dist/room/track/Track.d.ts +14 -2
- package/dist/room/track/Track.js +42 -0
- package/dist/room/track/Track.js.map +1 -1
- package/dist/room/track/TrackPublication.d.ts +1 -0
- package/dist/room/track/TrackPublication.js +2 -0
- package/dist/room/track/TrackPublication.js.map +1 -1
- package/dist/room/track/create.d.ts +23 -0
- package/dist/{livekit.js → room/track/create.js} +72 -109
- package/dist/room/track/create.js.map +1 -0
- package/dist/room/track/options.d.ts +42 -17
- package/dist/room/track/options.js +11 -6
- package/dist/room/track/options.js.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/example/index.html +51 -20
- package/example/sample.ts +195 -79
- package/example/webpack.config.js +8 -2
- package/package.json +2 -2
- package/dist/livekit.d.ts +0 -44
- package/dist/livekit.js.map +0 -1
@@ -12,91 +12,78 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
exports.
|
16
|
-
const
|
17
|
-
const
|
15
|
+
exports.createLocalScreenTracks = exports.createLocalAudioTrack = exports.createLocalVideoTrack = exports.createLocalTracks = exports.isVideoCaptureAllowed = exports.isAudioCaptureAllowed = void 0;
|
16
|
+
const errors_1 = require("../errors");
|
17
|
+
const LocalAudioTrack_1 = __importDefault(require("./LocalAudioTrack"));
|
18
|
+
const LocalTrack_1 = __importDefault(require("./LocalTrack"));
|
19
|
+
const LocalVideoTrack_1 = __importDefault(require("./LocalVideoTrack"));
|
18
20
|
const options_1 = require("./options");
|
19
|
-
const
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
const Track_1 = require("./Track");
|
22
|
+
let audioAllowed;
|
23
|
+
function isAudioCaptureAllowed() {
|
24
|
+
return audioAllowed;
|
25
|
+
}
|
26
|
+
exports.isAudioCaptureAllowed = isAudioCaptureAllowed;
|
27
|
+
let videoAllowed;
|
28
|
+
function isVideoCaptureAllowed() {
|
29
|
+
return videoAllowed;
|
30
|
+
}
|
31
|
+
exports.isVideoCaptureAllowed = isVideoCaptureAllowed;
|
28
32
|
/**
|
29
|
-
*
|
30
|
-
*
|
31
|
-
* ```typescript
|
32
|
-
* connect('wss://myhost.livekit.io', token, {
|
33
|
-
* // publish audio and video tracks on joining
|
34
|
-
* audio: true,
|
35
|
-
* video: {
|
36
|
-
* resolution: VideoPresets.hd,
|
37
|
-
* facingMode: {
|
38
|
-
* ideal: "user",
|
39
|
-
* }
|
40
|
-
* }
|
41
|
-
* })
|
42
|
-
* ```
|
43
|
-
* @param url URL to LiveKit server
|
44
|
-
* @param token AccessToken, a JWT token that includes authentication and room details
|
33
|
+
* creates a local video and audio track at the same time
|
45
34
|
* @param options
|
46
35
|
*/
|
47
|
-
function
|
48
|
-
var _a;
|
36
|
+
function createLocalTracks(options) {
|
49
37
|
return __awaiter(this, void 0, void 0, function* () {
|
50
|
-
|
51
|
-
|
52
|
-
options.logLevel || (options.logLevel = options_1.LogLevel.info);
|
38
|
+
if (!options)
|
39
|
+
options = {};
|
53
40
|
if (options.audio === undefined)
|
54
|
-
options.audio =
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
if (options.iceServers) {
|
60
|
-
config.iceServers = options.iceServers;
|
61
|
-
}
|
62
|
-
const client = new SignalClient_1.WSSignalClient();
|
63
|
-
const room = new Room_1.default(client, config);
|
64
|
-
// connect to room
|
65
|
-
yield room.connect(url, token, {
|
66
|
-
autoSubscribe: options === null || options === void 0 ? void 0 : options.autoSubscribe,
|
67
|
-
});
|
68
|
-
// add tracks if available
|
69
|
-
let { tracks } = options;
|
70
|
-
if (!tracks) {
|
71
|
-
if (options.audio || options.video) {
|
72
|
-
tracks = yield createLocalTracks({
|
73
|
-
audio: options.audio,
|
74
|
-
video: options.video,
|
75
|
-
});
|
76
|
-
}
|
41
|
+
options.audio = {};
|
42
|
+
const constraints = LocalTrack_1.default.constraintsForOptions(options);
|
43
|
+
let stream;
|
44
|
+
try {
|
45
|
+
stream = yield navigator.mediaDevices.getUserMedia(constraints);
|
77
46
|
}
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
const trackOptions = {};
|
83
|
-
if (track.kind === Track_1.Track.Kind.Video.toString()
|
84
|
-
|| track.kind === Track_1.Track.Kind.Video) {
|
85
|
-
trackOptions.videoCodec = options === null || options === void 0 ? void 0 : options.videoCodec;
|
86
|
-
trackOptions.videoEncoding = options === null || options === void 0 ? void 0 : options.videoEncoding;
|
87
|
-
trackOptions.simulcast = options === null || options === void 0 ? void 0 : options.simulcast;
|
47
|
+
catch (e) {
|
48
|
+
if (e instanceof DOMException && e.name === 'NotAllowedError') {
|
49
|
+
if (options.audio) {
|
50
|
+
audioAllowed = false;
|
88
51
|
}
|
89
|
-
|
90
|
-
|
91
|
-
trackOptions.audioBitrate = options.audioBitrate;
|
52
|
+
if (options.video) {
|
53
|
+
videoAllowed = false;
|
92
54
|
}
|
93
|
-
yield room.localParticipant.publishTrack(track, trackOptions);
|
94
55
|
}
|
56
|
+
throw e;
|
95
57
|
}
|
96
|
-
|
58
|
+
if (options.audio) {
|
59
|
+
audioAllowed = true;
|
60
|
+
}
|
61
|
+
if (options.video) {
|
62
|
+
videoAllowed = true;
|
63
|
+
}
|
64
|
+
return stream.getTracks().map((mediaStreamTrack) => {
|
65
|
+
const isAudio = mediaStreamTrack.kind === 'audio';
|
66
|
+
let trackOptions = isAudio ? options.audio : options.video;
|
67
|
+
if (typeof trackOptions === 'boolean' || !trackOptions) {
|
68
|
+
trackOptions = {};
|
69
|
+
}
|
70
|
+
let trackConstraints;
|
71
|
+
const conOrBool = isAudio ? constraints.audio : constraints.video;
|
72
|
+
if (typeof conOrBool !== 'boolean') {
|
73
|
+
trackConstraints = conOrBool;
|
74
|
+
}
|
75
|
+
const track = createLocalTrack(mediaStreamTrack, trackOptions === null || trackOptions === void 0 ? void 0 : trackOptions.name, trackConstraints);
|
76
|
+
if (track.kind === Track_1.Track.Kind.Video) {
|
77
|
+
track.source = Track_1.Track.Source.Camera;
|
78
|
+
}
|
79
|
+
else if (track.kind === Track_1.Track.Kind.Audio) {
|
80
|
+
track.source = Track_1.Track.Source.Microphone;
|
81
|
+
}
|
82
|
+
return track;
|
83
|
+
});
|
97
84
|
});
|
98
85
|
}
|
99
|
-
exports.
|
86
|
+
exports.createLocalTracks = createLocalTracks;
|
100
87
|
/**
|
101
88
|
* Creates a [[LocalVideoTrack]] with getUserMedia()
|
102
89
|
* @param options
|
@@ -136,24 +123,28 @@ function createLocalScreenTracks(options) {
|
|
136
123
|
options.name = 'screen';
|
137
124
|
}
|
138
125
|
if (options.resolution === undefined) {
|
139
|
-
options.resolution =
|
126
|
+
options.resolution = options_1.VideoPresets.fhd.resolution;
|
127
|
+
}
|
128
|
+
let videoConstraints = true;
|
129
|
+
if (options.resolution) {
|
130
|
+
videoConstraints = {
|
131
|
+
width: options.resolution.width,
|
132
|
+
height: options.resolution.height,
|
133
|
+
};
|
140
134
|
}
|
141
135
|
// typescript definition is missing getDisplayMedia: https://github.com/microsoft/TypeScript/issues/33232
|
142
136
|
// @ts-ignore
|
143
137
|
const stream = yield navigator.mediaDevices.getDisplayMedia({
|
144
138
|
audio: (_a = options.audio) !== null && _a !== void 0 ? _a : false,
|
145
|
-
video:
|
146
|
-
width: options.resolution.width,
|
147
|
-
height: options.resolution.height,
|
148
|
-
},
|
139
|
+
video: videoConstraints,
|
149
140
|
});
|
150
141
|
const tracks = stream.getVideoTracks();
|
151
142
|
if (tracks.length === 0) {
|
152
143
|
throw new errors_1.TrackInvalidError('no video track found');
|
153
144
|
}
|
154
|
-
const
|
155
|
-
|
156
|
-
];
|
145
|
+
const screenVideo = new LocalVideoTrack_1.default(tracks[0], options.name);
|
146
|
+
screenVideo.source = Track_1.Track.Source.ScreenShare;
|
147
|
+
const localTracks = [screenVideo];
|
157
148
|
if (stream.getAudioTracks().length > 0) {
|
158
149
|
localTracks.push(new LocalAudioTrack_1.default(stream.getAudioTracks()[0], options.name));
|
159
150
|
}
|
@@ -161,34 +152,6 @@ function createLocalScreenTracks(options) {
|
|
161
152
|
});
|
162
153
|
}
|
163
154
|
exports.createLocalScreenTracks = createLocalScreenTracks;
|
164
|
-
/**
|
165
|
-
* creates a local video and audio track at the same time
|
166
|
-
* @param options
|
167
|
-
*/
|
168
|
-
function createLocalTracks(options) {
|
169
|
-
return __awaiter(this, void 0, void 0, function* () {
|
170
|
-
if (!options)
|
171
|
-
options = {};
|
172
|
-
if (options.audio === undefined)
|
173
|
-
options.audio = {};
|
174
|
-
const constraints = LocalTrack_1.default.constraintsForOptions(options);
|
175
|
-
const stream = yield navigator.mediaDevices.getUserMedia(constraints);
|
176
|
-
return stream.getTracks().map((mediaStreamTrack) => {
|
177
|
-
const isAudio = mediaStreamTrack.kind === 'audio';
|
178
|
-
let trackOptions = isAudio ? options.audio : options.video;
|
179
|
-
if (typeof trackOptions === 'boolean' || !trackOptions) {
|
180
|
-
trackOptions = {};
|
181
|
-
}
|
182
|
-
let trackConstraints;
|
183
|
-
const conOrBool = isAudio ? constraints.audio : constraints.video;
|
184
|
-
if (typeof conOrBool !== 'boolean') {
|
185
|
-
trackConstraints = conOrBool;
|
186
|
-
}
|
187
|
-
return createLocalTrack(mediaStreamTrack, trackOptions === null || trackOptions === void 0 ? void 0 : trackOptions.name, trackConstraints);
|
188
|
-
});
|
189
|
-
});
|
190
|
-
}
|
191
|
-
exports.createLocalTracks = createLocalTracks;
|
192
155
|
/** @internal */
|
193
156
|
function createLocalTrack(mediaStreamTrack, name, constraints) {
|
194
157
|
switch (mediaStreamTrack.kind) {
|
@@ -200,4 +163,4 @@ function createLocalTrack(mediaStreamTrack, name, constraints) {
|
|
200
163
|
throw new errors_1.TrackInvalidError(`unsupported track type: ${mediaStreamTrack.kind}`);
|
201
164
|
}
|
202
165
|
}
|
203
|
-
//# sourceMappingURL=
|
166
|
+
//# sourceMappingURL=create.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/room/track/create.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAA8C;AAC9C,wEAAgD;AAChD,8DAAsC;AACtC,wEAAgD;AAChD,uCAGmB;AACnB,mCAAgC;AAEhC,IAAI,YAAiC,CAAC;AACtC,SAAgB,qBAAqB;IACnC,OAAO,YAAY,CAAC;AACtB,CAAC;AAFD,sDAEC;AAED,IAAI,YAAiC,CAAC;AACtC,SAAgB,qBAAqB;IACnC,OAAO,YAAY,CAAC;AACtB,CAAC;AAFD,sDAEC;AAED;;;GAGG;AACH,SAAsB,iBAAiB,CACrC,OAAkC;;QAElC,IAAI,CAAC,OAAO;YAAE,OAAO,GAAG,EAAE,CAAC;QAC3B,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;YAAE,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC;QAEpD,MA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AAC;QAClE,KAAK,OAAO;YACV,OAAO,IAAI,yBAAe,CAAC,gBAAgB,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QAClE;YACE,MAAM,IAAI,0BAAiB,CACzB,2BAA2B,gBAAgB,CAAC,IAAI,EAAE,CACnD,CAAC;KACL;AACH,CAAC"}
|
@@ -1,16 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
*/
|
4
|
-
export interface TrackPublishOptions {
|
1
|
+
import { Track } from './Track';
|
2
|
+
export interface TrackPublishDefaults {
|
5
3
|
/**
|
6
|
-
*
|
4
|
+
* encoding parameters for camera track
|
7
5
|
*/
|
8
|
-
|
6
|
+
videoEncoding?: VideoEncoding;
|
9
7
|
/**
|
10
|
-
*
|
11
|
-
* encoding based on bitrate
|
8
|
+
* default video capture resolution
|
12
9
|
*/
|
13
|
-
|
10
|
+
videoResolution?: VideoResolution;
|
11
|
+
/**
|
12
|
+
* encoding parameters for screen share track
|
13
|
+
*/
|
14
|
+
screenShareEncoding?: VideoEncoding;
|
14
15
|
/**
|
15
16
|
* codec, defaults to vp8
|
16
17
|
*/
|
@@ -19,12 +20,29 @@ export interface TrackPublishOptions {
|
|
19
20
|
* max audio bitrate, defaults to [[AudioPresets.speech]]
|
20
21
|
*/
|
21
22
|
audioBitrate?: number;
|
23
|
+
/**
|
24
|
+
* dtx (Discontinuous Tranmission of audio), defaults to true
|
25
|
+
*/
|
26
|
+
dtx?: boolean;
|
22
27
|
/**
|
23
28
|
* use simulcast, defaults to false.
|
24
29
|
* When using simulcast, LiveKit will publish up to three version of the stream at varying qualiti
|
25
30
|
*/
|
26
31
|
simulcast?: boolean;
|
27
32
|
}
|
33
|
+
/**
|
34
|
+
* Options when publishing tracks
|
35
|
+
*/
|
36
|
+
export interface TrackPublishOptions extends TrackPublishDefaults {
|
37
|
+
/**
|
38
|
+
* set a track name
|
39
|
+
*/
|
40
|
+
name?: string;
|
41
|
+
/**
|
42
|
+
* Source of track, camera, microphone, or screen
|
43
|
+
*/
|
44
|
+
source?: Track.Source;
|
45
|
+
}
|
28
46
|
export interface CreateLocalTracksOptions {
|
29
47
|
/**
|
30
48
|
* audio track options, true to create with defaults. false if audio shouldn't be created
|
@@ -52,7 +70,7 @@ export interface CreateVideoTrackOptions extends CreateLocalTrackOptions {
|
|
52
70
|
* [valid options](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/facingMode)
|
53
71
|
*/
|
54
72
|
facingMode?: ConstrainDOMString;
|
55
|
-
resolution?:
|
73
|
+
resolution?: VideoResolution;
|
56
74
|
}
|
57
75
|
export interface CreateScreenTrackOptions {
|
58
76
|
/** name of track, defaults to "screen" */
|
@@ -63,7 +81,7 @@ export interface CreateScreenTrackOptions {
|
|
63
81
|
*/
|
64
82
|
audio?: boolean;
|
65
83
|
/** capture resolution, defaults to full HD */
|
66
|
-
resolution?:
|
84
|
+
resolution?: VideoResolution;
|
67
85
|
}
|
68
86
|
export interface CreateAudioTrackOptions extends CreateLocalTrackOptions {
|
69
87
|
/**
|
@@ -109,21 +127,21 @@ export interface CreateAudioTrackOptions extends CreateLocalTrackOptions {
|
|
109
127
|
* }
|
110
128
|
* ```
|
111
129
|
*/
|
112
|
-
export interface
|
113
|
-
width:
|
114
|
-
height:
|
115
|
-
frameRate?:
|
130
|
+
export interface VideoResolution {
|
131
|
+
width: number;
|
132
|
+
height: number;
|
133
|
+
frameRate?: number;
|
116
134
|
}
|
117
135
|
export interface VideoEncoding {
|
118
136
|
maxBitrate: number;
|
119
|
-
maxFramerate
|
137
|
+
maxFramerate?: number;
|
120
138
|
}
|
121
139
|
export declare class VideoPreset {
|
122
140
|
encoding: VideoEncoding;
|
123
141
|
width: number;
|
124
142
|
height: number;
|
125
143
|
constructor(width: number, height: number, maxBitrate: number, maxFramerate: number);
|
126
|
-
get resolution():
|
144
|
+
get resolution(): VideoResolution;
|
127
145
|
}
|
128
146
|
export interface AudioPreset {
|
129
147
|
maxBitrate: number;
|
@@ -154,3 +172,10 @@ export declare const VideoPresets43: {
|
|
154
172
|
hd: VideoPreset;
|
155
173
|
fhd: VideoPreset;
|
156
174
|
};
|
175
|
+
export declare const ScreenSharePresets: {
|
176
|
+
vga: VideoPreset;
|
177
|
+
hd_8: VideoPreset;
|
178
|
+
hd_15: VideoPreset;
|
179
|
+
fhd_15: VideoPreset;
|
180
|
+
fhd_30: VideoPreset;
|
181
|
+
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.VideoPresets43 = exports.VideoPresets = exports.AudioPresets = exports.VideoPreset = void 0;
|
3
|
+
exports.ScreenSharePresets = exports.VideoPresets43 = exports.VideoPresets = exports.AudioPresets = exports.VideoPreset = void 0;
|
4
4
|
class VideoPreset {
|
5
5
|
constructor(width, height, maxBitrate, maxFramerate) {
|
6
6
|
this.width = width;
|
@@ -12,11 +12,9 @@ class VideoPreset {
|
|
12
12
|
}
|
13
13
|
get resolution() {
|
14
14
|
return {
|
15
|
-
width:
|
16
|
-
height:
|
17
|
-
frameRate:
|
18
|
-
ideal: this.encoding.maxFramerate,
|
19
|
-
},
|
15
|
+
width: this.width,
|
16
|
+
height: this.height,
|
17
|
+
frameRate: this.encoding.maxFramerate,
|
20
18
|
};
|
21
19
|
}
|
22
20
|
}
|
@@ -53,4 +51,11 @@ exports.VideoPresets43 = {
|
|
53
51
|
hd: new VideoPreset(960, 720, 2000000, 30),
|
54
52
|
fhd: new VideoPreset(1440, 1080, 3200000, 30),
|
55
53
|
};
|
54
|
+
exports.ScreenSharePresets = {
|
55
|
+
vga: new VideoPreset(640, 360, 200000, 3),
|
56
|
+
hd_8: new VideoPreset(1280, 720, 400000, 5),
|
57
|
+
hd_15: new VideoPreset(1280, 720, 1250000, 15),
|
58
|
+
fhd_15: new VideoPreset(1920, 1080, 2000000, 15),
|
59
|
+
fhd_30: new VideoPreset(1920, 1080, 4000000, 30),
|
60
|
+
};
|
56
61
|
//# sourceMappingURL=options.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/room/track/options.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/room/track/options.ts"],"names":[],"mappings":";;;AAsKA,MAAa,WAAW;IAOtB,YAAY,KAAa,EAAE,MAAc,EAAE,UAAkB,EAAE,YAAoB;QACjF,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG;YACd,UAAU;YACV,YAAY;SACb,CAAC;IACJ,CAAC;IAED,IAAI,UAAU;QACZ,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY;SACtC,CAAC;IACJ,CAAC;CACF;AAvBD,kCAuBC;AAQD,IAAiB,YAAY,CAU5B;AAVD,WAAiB,YAAY;IACd,sBAAS,GAAgB;QACpC,UAAU,EAAE,KAAM;KACnB,CAAC;IACW,mBAAM,GAAgB;QACjC,UAAU,EAAE,KAAM;KACnB,CAAC;IACW,kBAAK,GAAgB;QAChC,UAAU,EAAE,KAAM;KACnB,CAAC;AACJ,CAAC,EAVgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAU5B;AAED;;GAEG;AACU,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,MAAO,EAAE,EAAE,CAAC;IAC5C,GAAG,EAAE,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,MAAO,EAAE,EAAE,CAAC;IAC3C,GAAG,EAAE,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,MAAO,EAAE,EAAE,CAAC;IAC3C,EAAE,EAAE,IAAI,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,OAAS,EAAE,EAAE,CAAC;IAC7C,GAAG,EAAE,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAS,EAAE,EAAE,CAAC;CAChD,CAAC;AAEF;;GAEG;AACU,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,MAAO,EAAE,EAAE,CAAC;IAC5C,GAAG,EAAE,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,MAAO,EAAE,EAAE,CAAC;IAC3C,GAAG,EAAE,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,MAAO,EAAE,EAAE,CAAC;IAC3C,EAAE,EAAE,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,OAAS,EAAE,EAAE,CAAC;IAC5C,GAAG,EAAE,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAS,EAAE,EAAE,CAAC;CAChD,CAAC;AAEW,QAAA,kBAAkB,GAAG;IAChC,GAAG,EAAE,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,MAAO,EAAE,CAAC,CAAC;IAC1C,IAAI,EAAE,IAAI,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,MAAO,EAAE,CAAC,CAAC;IAC5C,KAAK,EAAE,IAAI,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,OAAS,EAAE,EAAE,CAAC;IAChD,MAAM,EAAE,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAS,EAAE,EAAE,CAAC;IAClD,MAAM,EAAE,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAS,EAAE,EAAE,CAAC;CACnD,CAAC"}
|
package/dist/version.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export declare const version = "0.
|
2
|
-
export declare const protocolVersion =
|
1
|
+
export declare const version = "0.13.0";
|
2
|
+
export declare const protocolVersion = 4;
|
package/dist/version.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.protocolVersion = exports.version = void 0;
|
4
|
-
exports.version = '0.
|
5
|
-
exports.protocolVersion =
|
4
|
+
exports.version = '0.13.0';
|
5
|
+
exports.protocolVersion = 4;
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/example/index.html
CHANGED
@@ -52,7 +52,19 @@
|
|
52
52
|
</div>
|
53
53
|
|
54
54
|
<div class="form-group row">
|
55
|
-
<div class="col-md-
|
55
|
+
<div class="col-md-2 offset-md-1">
|
56
|
+
<div class="form-check">
|
57
|
+
<input
|
58
|
+
type="checkbox"
|
59
|
+
class="form-check-input"
|
60
|
+
id="publish-option"
|
61
|
+
checked
|
62
|
+
/>
|
63
|
+
<label for="checkbox" class="form-check-label">
|
64
|
+
Publish
|
65
|
+
</label>
|
66
|
+
</div>
|
67
|
+
</div>
|
56
68
|
<div class="col-md-2">
|
57
69
|
<div class="form-check">
|
58
70
|
<input
|
@@ -84,44 +96,44 @@
|
|
84
96
|
<div class="col-md-2">
|
85
97
|
<button
|
86
98
|
id="connect-button"
|
87
|
-
class="btn btn-primary"
|
99
|
+
class="btn btn-primary mt-1"
|
88
100
|
type="button"
|
89
101
|
onclick="connectWithFormInput()"
|
90
102
|
>
|
91
103
|
Connect
|
92
104
|
</button>
|
93
105
|
</div>
|
94
|
-
<div class="col-md-
|
106
|
+
<div class="col-md-10">
|
95
107
|
<button
|
96
|
-
id="
|
97
|
-
class="btn btn-secondary"
|
108
|
+
id="toggle-audio-button"
|
109
|
+
class="btn btn-secondary mt-1"
|
98
110
|
disabled
|
99
111
|
type="button"
|
100
|
-
onclick="
|
112
|
+
onclick="toggleAudio()"
|
101
113
|
>
|
102
|
-
|
114
|
+
Enable Audio
|
103
115
|
</button>
|
104
116
|
<button
|
105
|
-
id="
|
106
|
-
class="btn btn-secondary"
|
117
|
+
id="toggle-video-button"
|
118
|
+
class="btn btn-secondary mt-1"
|
107
119
|
disabled
|
108
120
|
type="button"
|
109
|
-
onclick="
|
121
|
+
onclick="toggleVideo()"
|
110
122
|
>
|
111
|
-
|
123
|
+
Enable Video
|
112
124
|
</button>
|
113
125
|
<button
|
114
126
|
id="flip-video-button"
|
115
|
-
class="btn btn-secondary"
|
127
|
+
class="btn btn-secondary mt-1"
|
116
128
|
disabled
|
117
129
|
type="button"
|
118
130
|
onclick="flipVideo()"
|
119
131
|
>
|
120
|
-
|
132
|
+
Back Camera
|
121
133
|
</button>
|
122
134
|
<button
|
123
135
|
id="share-screen-button"
|
124
|
-
class="btn btn-secondary"
|
136
|
+
class="btn btn-secondary mt-1"
|
125
137
|
disabled
|
126
138
|
type="button"
|
127
139
|
onclick="shareScreen()"
|
@@ -130,16 +142,16 @@
|
|
130
142
|
</button>
|
131
143
|
<button
|
132
144
|
id="disconnect-ws-button"
|
133
|
-
class="btn btn-warning"
|
145
|
+
class="btn btn-warning mt-1"
|
134
146
|
disabled
|
135
147
|
type="button"
|
136
148
|
onclick="disconnectSignal()"
|
137
149
|
>
|
138
|
-
WS
|
150
|
+
WS Reconnect
|
139
151
|
</button>
|
140
152
|
<button
|
141
153
|
id="disconnect-room-button"
|
142
|
-
class="btn btn-danger"
|
154
|
+
class="btn btn-danger mt-1"
|
143
155
|
disabled
|
144
156
|
type="button"
|
145
157
|
onclick="disconnectRoom()"
|
@@ -148,16 +160,35 @@
|
|
148
160
|
</button>
|
149
161
|
<button
|
150
162
|
id="start-audio-button"
|
151
|
-
class="btn btn-secondary"
|
163
|
+
class="btn btn-secondary mt-1"
|
152
164
|
disabled
|
153
165
|
type="button"
|
154
166
|
onclick="startAudio()"
|
155
167
|
>
|
156
|
-
Enable
|
168
|
+
Enable Audio
|
157
169
|
</button>
|
158
170
|
</div>
|
159
171
|
</div>
|
160
172
|
|
173
|
+
<!-- video devices -->
|
174
|
+
<div class="form-group row">
|
175
|
+
<div class="col-md-4">
|
176
|
+
<select id="video-input" class="custom-select" onchange="handleDeviceSelected(event)">
|
177
|
+
<option selected>Video Input (default)</option>
|
178
|
+
</select>
|
179
|
+
</div>
|
180
|
+
<div class="col-md-4">
|
181
|
+
<select id="audio-input" class="custom-select" onchange="handleDeviceSelected(event)">
|
182
|
+
<option selected>Audio Input (default)</option>
|
183
|
+
</select>
|
184
|
+
</div>
|
185
|
+
<div class="col-md-4">
|
186
|
+
<select id="audio-output" class="custom-select" onchange="handleDeviceSelected(event)">
|
187
|
+
<option selected>Audio Output (default)</option>
|
188
|
+
</select>
|
189
|
+
</div>
|
190
|
+
</div>
|
191
|
+
|
161
192
|
<div class="form-group row">
|
162
193
|
<textarea
|
163
194
|
class="form-control col-md-12"
|
@@ -174,7 +205,7 @@
|
|
174
205
|
<textarea class="form-control" id="chat" rows="15"></textarea>
|
175
206
|
</div>
|
176
207
|
</div>
|
177
|
-
<div class="row">
|
208
|
+
<div class="row mt-1">
|
178
209
|
<div class="col-md-10">
|
179
210
|
<input type="text" class="form-control" id="entry" />
|
180
211
|
</div>
|