@whereby.com/assistant-sdk 0.0.0-canary-20251007140529 → 1.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.
- package/dist/index.cjs +61 -54
- package/dist/index.d.cts +5 -6
- package/dist/index.d.mts +5 -6
- package/dist/index.d.ts +5 -6
- package/dist/index.mjs +61 -54
- package/dist/legacy-esm.js +61 -54
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -17,6 +17,38 @@ const PARTICIPANT_VIDEO_TRACK_REMOVED = "PARTICIPANT_VIDEO_TRACK_REMOVED";
|
|
|
17
17
|
const PARTICIPANT_AUDIO_TRACK_ADDED = "PARTICIPANT_AUDIO_TRACK_ADDED";
|
|
18
18
|
const PARTICIPANT_AUDIO_TRACK_REMOVED = "PARTICIPANT_AUDIO_TRACK_REMOVED";
|
|
19
19
|
|
|
20
|
+
/******************************************************************************
|
|
21
|
+
Copyright (c) Microsoft Corporation.
|
|
22
|
+
|
|
23
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
24
|
+
purpose with or without fee is hereby granted.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
27
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
28
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
29
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
30
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
31
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
32
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
33
|
+
***************************************************************************** */
|
|
34
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
38
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
39
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
40
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
41
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
42
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
43
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
48
|
+
var e = new Error(message);
|
|
49
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
50
|
+
};
|
|
51
|
+
|
|
20
52
|
const { nonstandard: { RTCAudioSink, RTCAudioSource }, } = wrtc;
|
|
21
53
|
class AudioSource extends RTCAudioSource {
|
|
22
54
|
}
|
|
@@ -529,8 +561,6 @@ class VideoSink extends RTCVideoSink {
|
|
|
529
561
|
class Assistant extends EventEmitter {
|
|
530
562
|
constructor({ assistantKey }) {
|
|
531
563
|
super();
|
|
532
|
-
this.localAudioSource = null;
|
|
533
|
-
this.localVideoSource = null;
|
|
534
564
|
this.combinedAudioSink = null;
|
|
535
565
|
this.remoteMediaTracks = {};
|
|
536
566
|
this.roomUrl = null;
|
|
@@ -608,29 +638,38 @@ class Assistant extends EventEmitter {
|
|
|
608
638
|
getRoomConnection() {
|
|
609
639
|
return this.roomConnection;
|
|
610
640
|
}
|
|
611
|
-
startLocalMedia() {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
641
|
+
startLocalMedia(_a) {
|
|
642
|
+
return __awaiter(this, arguments, void 0, function* ({ audio, video }) {
|
|
643
|
+
const localMediaState = this.localMedia.getState();
|
|
644
|
+
const localMediaStream = localMediaState.localStream || new wrtc.MediaStream([]);
|
|
645
|
+
// Remove all existing tracks from local stream, if any
|
|
646
|
+
localMediaStream.getTracks().forEach((existingTrack) => {
|
|
647
|
+
localMediaStream.removeTrack(existingTrack);
|
|
648
|
+
existingTrack.stop();
|
|
649
|
+
});
|
|
650
|
+
let newLocalAudioSource = null;
|
|
651
|
+
let newLocalVideoSource = null;
|
|
652
|
+
if (audio) {
|
|
653
|
+
newLocalAudioSource = new AudioSource();
|
|
654
|
+
localMediaStream.addTrack(newLocalAudioSource.createTrack());
|
|
655
|
+
}
|
|
656
|
+
if (video) {
|
|
657
|
+
newLocalVideoSource = new VideoSource();
|
|
658
|
+
localMediaStream.addTrack(newLocalVideoSource.createTrack());
|
|
659
|
+
}
|
|
660
|
+
if (!localMediaState.localStream) {
|
|
661
|
+
yield this.localMedia.startMedia(localMediaStream);
|
|
662
|
+
}
|
|
663
|
+
this.localMedia.toggleMicrophone(audio);
|
|
664
|
+
this.localMedia.toggleCamera(video);
|
|
665
|
+
return {
|
|
666
|
+
audioSource: newLocalAudioSource,
|
|
667
|
+
videoSource: newLocalVideoSource,
|
|
668
|
+
};
|
|
669
|
+
});
|
|
623
670
|
}
|
|
624
671
|
stopLocalMedia() {
|
|
625
672
|
this.localMedia.stopMedia();
|
|
626
|
-
this.localAudioSource = null;
|
|
627
|
-
this.localVideoSource = null;
|
|
628
|
-
}
|
|
629
|
-
getLocalAudioSource() {
|
|
630
|
-
return this.localAudioSource;
|
|
631
|
-
}
|
|
632
|
-
getLocalVideoSource() {
|
|
633
|
-
return this.localVideoSource;
|
|
634
673
|
}
|
|
635
674
|
getLocalMedia() {
|
|
636
675
|
return this.localMedia;
|
|
@@ -651,38 +690,6 @@ class Assistant extends EventEmitter {
|
|
|
651
690
|
}
|
|
652
691
|
}
|
|
653
692
|
|
|
654
|
-
/******************************************************************************
|
|
655
|
-
Copyright (c) Microsoft Corporation.
|
|
656
|
-
|
|
657
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
658
|
-
purpose with or without fee is hereby granted.
|
|
659
|
-
|
|
660
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
661
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
662
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
663
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
664
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
665
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
666
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
667
|
-
***************************************************************************** */
|
|
668
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
672
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
673
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
674
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
675
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
676
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
677
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
682
|
-
var e = new Error(message);
|
|
683
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
684
|
-
};
|
|
685
|
-
|
|
686
693
|
function buildRoomUrl(roomPath, wherebySubdomain, baseDomain = "whereby.com") {
|
|
687
694
|
const wherebyDomain = `${wherebySubdomain}.${baseDomain}`;
|
|
688
695
|
return `https://${wherebyDomain}${roomPath}`;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as wrtc from '@roamhq/wrtc';
|
|
2
2
|
import wrtc__default from '@roamhq/wrtc';
|
|
3
3
|
import * as _whereby_com_core from '@whereby.com/core';
|
|
4
|
-
import { RoomConnectionClient, LocalMediaClient } from '@whereby.com/core';
|
|
4
|
+
import { RoomConnectionClient, LocalMediaOptions, LocalMediaClient } from '@whereby.com/core';
|
|
5
5
|
export { RemoteParticipantState } from '@whereby.com/core';
|
|
6
6
|
import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
|
|
7
7
|
|
|
@@ -174,8 +174,6 @@ declare class Assistant extends EventEmitter<AssistantEvents> {
|
|
|
174
174
|
private assistantKey;
|
|
175
175
|
private client;
|
|
176
176
|
private roomConnection;
|
|
177
|
-
private localAudioSource;
|
|
178
|
-
private localVideoSource;
|
|
179
177
|
private localMedia;
|
|
180
178
|
private combinedAudioSink;
|
|
181
179
|
private remoteMediaTracks;
|
|
@@ -186,10 +184,11 @@ declare class Assistant extends EventEmitter<AssistantEvents> {
|
|
|
186
184
|
private handleRemoteParticipantsTracksChange;
|
|
187
185
|
joinRoom(roomUrl: string): Promise<_whereby_com_core.RoomJoinedSuccess>;
|
|
188
186
|
getRoomConnection(): RoomConnectionClient;
|
|
189
|
-
startLocalMedia():
|
|
187
|
+
startLocalMedia({ audio, video }: LocalMediaOptions): Promise<{
|
|
188
|
+
audioSource: AudioSource | null;
|
|
189
|
+
videoSource: VideoSource | null;
|
|
190
|
+
}>;
|
|
190
191
|
stopLocalMedia(): void;
|
|
191
|
-
getLocalAudioSource(): AudioSource | null;
|
|
192
|
-
getLocalVideoSource(): VideoSource | null;
|
|
193
192
|
getLocalMedia(): LocalMediaClient;
|
|
194
193
|
getCombinedAudioSink(): AudioSink | null;
|
|
195
194
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as wrtc from '@roamhq/wrtc';
|
|
2
2
|
import wrtc__default from '@roamhq/wrtc';
|
|
3
3
|
import * as _whereby_com_core from '@whereby.com/core';
|
|
4
|
-
import { RoomConnectionClient, LocalMediaClient } from '@whereby.com/core';
|
|
4
|
+
import { RoomConnectionClient, LocalMediaOptions, LocalMediaClient } from '@whereby.com/core';
|
|
5
5
|
export { RemoteParticipantState } from '@whereby.com/core';
|
|
6
6
|
import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
|
|
7
7
|
|
|
@@ -174,8 +174,6 @@ declare class Assistant extends EventEmitter<AssistantEvents> {
|
|
|
174
174
|
private assistantKey;
|
|
175
175
|
private client;
|
|
176
176
|
private roomConnection;
|
|
177
|
-
private localAudioSource;
|
|
178
|
-
private localVideoSource;
|
|
179
177
|
private localMedia;
|
|
180
178
|
private combinedAudioSink;
|
|
181
179
|
private remoteMediaTracks;
|
|
@@ -186,10 +184,11 @@ declare class Assistant extends EventEmitter<AssistantEvents> {
|
|
|
186
184
|
private handleRemoteParticipantsTracksChange;
|
|
187
185
|
joinRoom(roomUrl: string): Promise<_whereby_com_core.RoomJoinedSuccess>;
|
|
188
186
|
getRoomConnection(): RoomConnectionClient;
|
|
189
|
-
startLocalMedia():
|
|
187
|
+
startLocalMedia({ audio, video }: LocalMediaOptions): Promise<{
|
|
188
|
+
audioSource: AudioSource | null;
|
|
189
|
+
videoSource: VideoSource | null;
|
|
190
|
+
}>;
|
|
190
191
|
stopLocalMedia(): void;
|
|
191
|
-
getLocalAudioSource(): AudioSource | null;
|
|
192
|
-
getLocalVideoSource(): VideoSource | null;
|
|
193
192
|
getLocalMedia(): LocalMediaClient;
|
|
194
193
|
getCombinedAudioSink(): AudioSink | null;
|
|
195
194
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as wrtc from '@roamhq/wrtc';
|
|
2
2
|
import wrtc__default from '@roamhq/wrtc';
|
|
3
3
|
import * as _whereby_com_core from '@whereby.com/core';
|
|
4
|
-
import { RoomConnectionClient, LocalMediaClient } from '@whereby.com/core';
|
|
4
|
+
import { RoomConnectionClient, LocalMediaOptions, LocalMediaClient } from '@whereby.com/core';
|
|
5
5
|
export { RemoteParticipantState } from '@whereby.com/core';
|
|
6
6
|
import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
|
|
7
7
|
|
|
@@ -174,8 +174,6 @@ declare class Assistant extends EventEmitter<AssistantEvents> {
|
|
|
174
174
|
private assistantKey;
|
|
175
175
|
private client;
|
|
176
176
|
private roomConnection;
|
|
177
|
-
private localAudioSource;
|
|
178
|
-
private localVideoSource;
|
|
179
177
|
private localMedia;
|
|
180
178
|
private combinedAudioSink;
|
|
181
179
|
private remoteMediaTracks;
|
|
@@ -186,10 +184,11 @@ declare class Assistant extends EventEmitter<AssistantEvents> {
|
|
|
186
184
|
private handleRemoteParticipantsTracksChange;
|
|
187
185
|
joinRoom(roomUrl: string): Promise<_whereby_com_core.RoomJoinedSuccess>;
|
|
188
186
|
getRoomConnection(): RoomConnectionClient;
|
|
189
|
-
startLocalMedia():
|
|
187
|
+
startLocalMedia({ audio, video }: LocalMediaOptions): Promise<{
|
|
188
|
+
audioSource: AudioSource | null;
|
|
189
|
+
videoSource: VideoSource | null;
|
|
190
|
+
}>;
|
|
190
191
|
stopLocalMedia(): void;
|
|
191
|
-
getLocalAudioSource(): AudioSource | null;
|
|
192
|
-
getLocalVideoSource(): VideoSource | null;
|
|
193
192
|
getLocalMedia(): LocalMediaClient;
|
|
194
193
|
getCombinedAudioSink(): AudioSink | null;
|
|
195
194
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -15,6 +15,38 @@ const PARTICIPANT_VIDEO_TRACK_REMOVED = "PARTICIPANT_VIDEO_TRACK_REMOVED";
|
|
|
15
15
|
const PARTICIPANT_AUDIO_TRACK_ADDED = "PARTICIPANT_AUDIO_TRACK_ADDED";
|
|
16
16
|
const PARTICIPANT_AUDIO_TRACK_REMOVED = "PARTICIPANT_AUDIO_TRACK_REMOVED";
|
|
17
17
|
|
|
18
|
+
/******************************************************************************
|
|
19
|
+
Copyright (c) Microsoft Corporation.
|
|
20
|
+
|
|
21
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
22
|
+
purpose with or without fee is hereby granted.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
25
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
26
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
27
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
28
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
29
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
30
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
31
|
+
***************************************************************************** */
|
|
32
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
46
|
+
var e = new Error(message);
|
|
47
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
48
|
+
};
|
|
49
|
+
|
|
18
50
|
const { nonstandard: { RTCAudioSink, RTCAudioSource }, } = wrtc;
|
|
19
51
|
class AudioSource extends RTCAudioSource {
|
|
20
52
|
}
|
|
@@ -527,8 +559,6 @@ class VideoSink extends RTCVideoSink {
|
|
|
527
559
|
class Assistant extends EventEmitter$1 {
|
|
528
560
|
constructor({ assistantKey }) {
|
|
529
561
|
super();
|
|
530
|
-
this.localAudioSource = null;
|
|
531
|
-
this.localVideoSource = null;
|
|
532
562
|
this.combinedAudioSink = null;
|
|
533
563
|
this.remoteMediaTracks = {};
|
|
534
564
|
this.roomUrl = null;
|
|
@@ -606,29 +636,38 @@ class Assistant extends EventEmitter$1 {
|
|
|
606
636
|
getRoomConnection() {
|
|
607
637
|
return this.roomConnection;
|
|
608
638
|
}
|
|
609
|
-
startLocalMedia() {
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
639
|
+
startLocalMedia(_a) {
|
|
640
|
+
return __awaiter(this, arguments, void 0, function* ({ audio, video }) {
|
|
641
|
+
const localMediaState = this.localMedia.getState();
|
|
642
|
+
const localMediaStream = localMediaState.localStream || new wrtc.MediaStream([]);
|
|
643
|
+
// Remove all existing tracks from local stream, if any
|
|
644
|
+
localMediaStream.getTracks().forEach((existingTrack) => {
|
|
645
|
+
localMediaStream.removeTrack(existingTrack);
|
|
646
|
+
existingTrack.stop();
|
|
647
|
+
});
|
|
648
|
+
let newLocalAudioSource = null;
|
|
649
|
+
let newLocalVideoSource = null;
|
|
650
|
+
if (audio) {
|
|
651
|
+
newLocalAudioSource = new AudioSource();
|
|
652
|
+
localMediaStream.addTrack(newLocalAudioSource.createTrack());
|
|
653
|
+
}
|
|
654
|
+
if (video) {
|
|
655
|
+
newLocalVideoSource = new VideoSource();
|
|
656
|
+
localMediaStream.addTrack(newLocalVideoSource.createTrack());
|
|
657
|
+
}
|
|
658
|
+
if (!localMediaState.localStream) {
|
|
659
|
+
yield this.localMedia.startMedia(localMediaStream);
|
|
660
|
+
}
|
|
661
|
+
this.localMedia.toggleMicrophone(audio);
|
|
662
|
+
this.localMedia.toggleCamera(video);
|
|
663
|
+
return {
|
|
664
|
+
audioSource: newLocalAudioSource,
|
|
665
|
+
videoSource: newLocalVideoSource,
|
|
666
|
+
};
|
|
667
|
+
});
|
|
621
668
|
}
|
|
622
669
|
stopLocalMedia() {
|
|
623
670
|
this.localMedia.stopMedia();
|
|
624
|
-
this.localAudioSource = null;
|
|
625
|
-
this.localVideoSource = null;
|
|
626
|
-
}
|
|
627
|
-
getLocalAudioSource() {
|
|
628
|
-
return this.localAudioSource;
|
|
629
|
-
}
|
|
630
|
-
getLocalVideoSource() {
|
|
631
|
-
return this.localVideoSource;
|
|
632
671
|
}
|
|
633
672
|
getLocalMedia() {
|
|
634
673
|
return this.localMedia;
|
|
@@ -649,38 +688,6 @@ class Assistant extends EventEmitter$1 {
|
|
|
649
688
|
}
|
|
650
689
|
}
|
|
651
690
|
|
|
652
|
-
/******************************************************************************
|
|
653
|
-
Copyright (c) Microsoft Corporation.
|
|
654
|
-
|
|
655
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
656
|
-
purpose with or without fee is hereby granted.
|
|
657
|
-
|
|
658
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
659
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
660
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
661
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
662
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
663
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
664
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
665
|
-
***************************************************************************** */
|
|
666
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
670
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
671
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
672
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
673
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
674
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
675
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
680
|
-
var e = new Error(message);
|
|
681
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
682
|
-
};
|
|
683
|
-
|
|
684
691
|
function buildRoomUrl(roomPath, wherebySubdomain, baseDomain = "whereby.com") {
|
|
685
692
|
const wherebyDomain = `${wherebySubdomain}.${baseDomain}`;
|
|
686
693
|
return `https://${wherebyDomain}${roomPath}`;
|
package/dist/legacy-esm.js
CHANGED
|
@@ -15,6 +15,38 @@ const PARTICIPANT_VIDEO_TRACK_REMOVED = "PARTICIPANT_VIDEO_TRACK_REMOVED";
|
|
|
15
15
|
const PARTICIPANT_AUDIO_TRACK_ADDED = "PARTICIPANT_AUDIO_TRACK_ADDED";
|
|
16
16
|
const PARTICIPANT_AUDIO_TRACK_REMOVED = "PARTICIPANT_AUDIO_TRACK_REMOVED";
|
|
17
17
|
|
|
18
|
+
/******************************************************************************
|
|
19
|
+
Copyright (c) Microsoft Corporation.
|
|
20
|
+
|
|
21
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
22
|
+
purpose with or without fee is hereby granted.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
25
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
26
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
27
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
28
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
29
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
30
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
31
|
+
***************************************************************************** */
|
|
32
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
46
|
+
var e = new Error(message);
|
|
47
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
48
|
+
};
|
|
49
|
+
|
|
18
50
|
const { nonstandard: { RTCAudioSink, RTCAudioSource }, } = wrtc;
|
|
19
51
|
class AudioSource extends RTCAudioSource {
|
|
20
52
|
}
|
|
@@ -527,8 +559,6 @@ class VideoSink extends RTCVideoSink {
|
|
|
527
559
|
class Assistant extends EventEmitter$1 {
|
|
528
560
|
constructor({ assistantKey }) {
|
|
529
561
|
super();
|
|
530
|
-
this.localAudioSource = null;
|
|
531
|
-
this.localVideoSource = null;
|
|
532
562
|
this.combinedAudioSink = null;
|
|
533
563
|
this.remoteMediaTracks = {};
|
|
534
564
|
this.roomUrl = null;
|
|
@@ -606,29 +636,38 @@ class Assistant extends EventEmitter$1 {
|
|
|
606
636
|
getRoomConnection() {
|
|
607
637
|
return this.roomConnection;
|
|
608
638
|
}
|
|
609
|
-
startLocalMedia() {
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
639
|
+
startLocalMedia(_a) {
|
|
640
|
+
return __awaiter(this, arguments, void 0, function* ({ audio, video }) {
|
|
641
|
+
const localMediaState = this.localMedia.getState();
|
|
642
|
+
const localMediaStream = localMediaState.localStream || new wrtc.MediaStream([]);
|
|
643
|
+
// Remove all existing tracks from local stream, if any
|
|
644
|
+
localMediaStream.getTracks().forEach((existingTrack) => {
|
|
645
|
+
localMediaStream.removeTrack(existingTrack);
|
|
646
|
+
existingTrack.stop();
|
|
647
|
+
});
|
|
648
|
+
let newLocalAudioSource = null;
|
|
649
|
+
let newLocalVideoSource = null;
|
|
650
|
+
if (audio) {
|
|
651
|
+
newLocalAudioSource = new AudioSource();
|
|
652
|
+
localMediaStream.addTrack(newLocalAudioSource.createTrack());
|
|
653
|
+
}
|
|
654
|
+
if (video) {
|
|
655
|
+
newLocalVideoSource = new VideoSource();
|
|
656
|
+
localMediaStream.addTrack(newLocalVideoSource.createTrack());
|
|
657
|
+
}
|
|
658
|
+
if (!localMediaState.localStream) {
|
|
659
|
+
yield this.localMedia.startMedia(localMediaStream);
|
|
660
|
+
}
|
|
661
|
+
this.localMedia.toggleMicrophone(audio);
|
|
662
|
+
this.localMedia.toggleCamera(video);
|
|
663
|
+
return {
|
|
664
|
+
audioSource: newLocalAudioSource,
|
|
665
|
+
videoSource: newLocalVideoSource,
|
|
666
|
+
};
|
|
667
|
+
});
|
|
621
668
|
}
|
|
622
669
|
stopLocalMedia() {
|
|
623
670
|
this.localMedia.stopMedia();
|
|
624
|
-
this.localAudioSource = null;
|
|
625
|
-
this.localVideoSource = null;
|
|
626
|
-
}
|
|
627
|
-
getLocalAudioSource() {
|
|
628
|
-
return this.localAudioSource;
|
|
629
|
-
}
|
|
630
|
-
getLocalVideoSource() {
|
|
631
|
-
return this.localVideoSource;
|
|
632
671
|
}
|
|
633
672
|
getLocalMedia() {
|
|
634
673
|
return this.localMedia;
|
|
@@ -649,38 +688,6 @@ class Assistant extends EventEmitter$1 {
|
|
|
649
688
|
}
|
|
650
689
|
}
|
|
651
690
|
|
|
652
|
-
/******************************************************************************
|
|
653
|
-
Copyright (c) Microsoft Corporation.
|
|
654
|
-
|
|
655
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
656
|
-
purpose with or without fee is hereby granted.
|
|
657
|
-
|
|
658
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
659
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
660
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
661
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
662
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
663
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
664
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
665
|
-
***************************************************************************** */
|
|
666
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
670
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
671
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
672
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
673
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
674
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
675
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
680
|
-
var e = new Error(message);
|
|
681
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
682
|
-
};
|
|
683
|
-
|
|
684
691
|
function buildRoomUrl(roomPath, wherebySubdomain, baseDomain = "whereby.com") {
|
|
685
692
|
const wherebyDomain = `${wherebySubdomain}.${baseDomain}`;
|
|
686
693
|
return `https://${wherebyDomain}${roomPath}`;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@whereby.com/assistant-sdk",
|
|
3
3
|
"description": "Assistant SDK for whereby.com",
|
|
4
4
|
"author": "Whereby AS",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "1.1.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"express": "5.1.0",
|
|
65
65
|
"uuid": "^11.0.3",
|
|
66
66
|
"ws": "^8.18.0",
|
|
67
|
-
"@whereby.com/core": "
|
|
67
|
+
"@whereby.com/core": "1.2.0"
|
|
68
68
|
},
|
|
69
69
|
"prettier": "@whereby.com/prettier-config",
|
|
70
70
|
"scripts": {
|