@wazo/sdk 0.37.3 → 0.37.4
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/wazo-sdk.js +1 -1
- package/esm/index.js +33 -5
- package/esm/simple/Auth.js +33 -5
- package/esm/simple/Configuration.js +33 -5
- package/esm/simple/Phone.js +33 -5
- package/esm/simple/index.js +33 -5
- package/esm/simple/room/LocalParticipant.js +33 -5
- package/esm/simple/room/Participant.js +33 -5
- package/esm/simple/room/RemoteParticipant.js +33 -5
- package/esm/simple/room/Room.js +33 -5
- package/esm/simple/room/SipRoom.js +33 -5
- package/esm/simple/room/Stream.js +33 -5
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +33 -5
- package/esm/simple/utils.js +33 -5
- package/lib/index.js +33 -5
- package/lib/simple/Auth.js +33 -5
- package/lib/simple/Configuration.js +33 -5
- package/lib/simple/Phone.js +33 -5
- package/lib/simple/index.js +33 -5
- package/lib/simple/room/LocalParticipant.js +33 -5
- package/lib/simple/room/Participant.js +33 -5
- package/lib/simple/room/RemoteParticipant.js +33 -5
- package/lib/simple/room/Room.js +33 -5
- package/lib/simple/room/SipRoom.js +33 -5
- package/lib/simple/room/Stream.js +33 -5
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +33 -5
- package/lib/simple/utils.js +33 -5
- package/package.json +1 -1
- package/src/simple/room/Room.js +33 -5
|
@@ -11757,9 +11757,11 @@ class Room$1 extends Emitter {
|
|
|
11757
11757
|
_onParticipantTrackUpdate(oldParticipant , update ) {
|
|
11758
11758
|
const newParticipant = oldParticipant;
|
|
11759
11759
|
|
|
11760
|
-
const { trackId } = this._callIdStreamIdMap[newParticipant.callId] || {};
|
|
11760
|
+
const { trackId, streamId } = this._callIdStreamIdMap[newParticipant.callId] || {};
|
|
11761
11761
|
const pc = Wazo.Phone.phone.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
11762
|
-
|
|
11762
|
+
// Can't use `getReceivers` here because on FF we make the mapping based on the streamId
|
|
11763
|
+
const stream = pc.getRemoteStreams().find(someStream =>
|
|
11764
|
+
someStream.id === streamId || someStream.getTracks().some(track => track.id === trackId));
|
|
11763
11765
|
|
|
11764
11766
|
if (update === 'downgrade') {
|
|
11765
11767
|
newParticipant.streams = [];
|
|
@@ -11789,15 +11791,41 @@ class Room$1 extends Emitter {
|
|
|
11789
11791
|
return;
|
|
11790
11792
|
}
|
|
11791
11793
|
|
|
11792
|
-
|
|
11794
|
+
const streamId = this._getStreamIdFrTrackId(trackId);
|
|
11795
|
+
const key = this._getUnassociatedMapIdFromTrackIdOrStreamId(trackId, streamId);
|
|
11796
|
+
const stream = this._unassociatedVideoStreams[key];
|
|
11797
|
+
|
|
11798
|
+
if (stream) {
|
|
11793
11799
|
// Try to associate stream
|
|
11794
|
-
this._associateStreamTo(
|
|
11800
|
+
this._associateStreamTo(stream, participant);
|
|
11795
11801
|
|
|
11796
|
-
delete this._unassociatedVideoStreams[
|
|
11802
|
+
delete this._unassociatedVideoStreams[key];
|
|
11797
11803
|
delete this._unassociatedParticipants[participant.callId];
|
|
11798
11804
|
}
|
|
11799
11805
|
}
|
|
11800
11806
|
|
|
11807
|
+
_getUnassociatedMapIdFromTrackIdOrStreamId(trackId , streamId ) {
|
|
11808
|
+
// Find by trackId
|
|
11809
|
+
if (trackId in this._unassociatedVideoStreams) {
|
|
11810
|
+
return trackId;
|
|
11811
|
+
}
|
|
11812
|
+
|
|
11813
|
+
// Find by streamId
|
|
11814
|
+
if (streamId && streamId in this._unassociatedVideoStreams) {
|
|
11815
|
+
return streamId;
|
|
11816
|
+
}
|
|
11817
|
+
|
|
11818
|
+
// Find in all the streams by streamId (used on FF where we can't map by trackId)
|
|
11819
|
+
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) => stream.id === streamId);
|
|
11820
|
+
return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
|
|
11821
|
+
}
|
|
11822
|
+
|
|
11823
|
+
_getStreamIdFrTrackId(trackId ) {
|
|
11824
|
+
const mapping = Object.values(this._callIdStreamIdMap).find((map ) => map.trackId === trackId);
|
|
11825
|
+
|
|
11826
|
+
return mapping ? mapping.streamId : null;
|
|
11827
|
+
}
|
|
11828
|
+
|
|
11801
11829
|
_associateStreamTo(rawStream , participant ) {
|
|
11802
11830
|
const stream = new Wazo.Stream(rawStream, participant);
|
|
11803
11831
|
participant.streams.push(stream);
|
|
@@ -11757,9 +11757,11 @@ class Room$1 extends Emitter {
|
|
|
11757
11757
|
_onParticipantTrackUpdate(oldParticipant , update ) {
|
|
11758
11758
|
const newParticipant = oldParticipant;
|
|
11759
11759
|
|
|
11760
|
-
const { trackId } = this._callIdStreamIdMap[newParticipant.callId] || {};
|
|
11760
|
+
const { trackId, streamId } = this._callIdStreamIdMap[newParticipant.callId] || {};
|
|
11761
11761
|
const pc = Wazo.Phone.phone.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
11762
|
-
|
|
11762
|
+
// Can't use `getReceivers` here because on FF we make the mapping based on the streamId
|
|
11763
|
+
const stream = pc.getRemoteStreams().find(someStream =>
|
|
11764
|
+
someStream.id === streamId || someStream.getTracks().some(track => track.id === trackId));
|
|
11763
11765
|
|
|
11764
11766
|
if (update === 'downgrade') {
|
|
11765
11767
|
newParticipant.streams = [];
|
|
@@ -11789,15 +11791,41 @@ class Room$1 extends Emitter {
|
|
|
11789
11791
|
return;
|
|
11790
11792
|
}
|
|
11791
11793
|
|
|
11792
|
-
|
|
11794
|
+
const streamId = this._getStreamIdFrTrackId(trackId);
|
|
11795
|
+
const key = this._getUnassociatedMapIdFromTrackIdOrStreamId(trackId, streamId);
|
|
11796
|
+
const stream = this._unassociatedVideoStreams[key];
|
|
11797
|
+
|
|
11798
|
+
if (stream) {
|
|
11793
11799
|
// Try to associate stream
|
|
11794
|
-
this._associateStreamTo(
|
|
11800
|
+
this._associateStreamTo(stream, participant);
|
|
11795
11801
|
|
|
11796
|
-
delete this._unassociatedVideoStreams[
|
|
11802
|
+
delete this._unassociatedVideoStreams[key];
|
|
11797
11803
|
delete this._unassociatedParticipants[participant.callId];
|
|
11798
11804
|
}
|
|
11799
11805
|
}
|
|
11800
11806
|
|
|
11807
|
+
_getUnassociatedMapIdFromTrackIdOrStreamId(trackId , streamId ) {
|
|
11808
|
+
// Find by trackId
|
|
11809
|
+
if (trackId in this._unassociatedVideoStreams) {
|
|
11810
|
+
return trackId;
|
|
11811
|
+
}
|
|
11812
|
+
|
|
11813
|
+
// Find by streamId
|
|
11814
|
+
if (streamId && streamId in this._unassociatedVideoStreams) {
|
|
11815
|
+
return streamId;
|
|
11816
|
+
}
|
|
11817
|
+
|
|
11818
|
+
// Find in all the streams by streamId (used on FF where we can't map by trackId)
|
|
11819
|
+
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) => stream.id === streamId);
|
|
11820
|
+
return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
|
|
11821
|
+
}
|
|
11822
|
+
|
|
11823
|
+
_getStreamIdFrTrackId(trackId ) {
|
|
11824
|
+
const mapping = Object.values(this._callIdStreamIdMap).find((map ) => map.trackId === trackId);
|
|
11825
|
+
|
|
11826
|
+
return mapping ? mapping.streamId : null;
|
|
11827
|
+
}
|
|
11828
|
+
|
|
11801
11829
|
_associateStreamTo(rawStream , participant ) {
|
|
11802
11830
|
const stream = new Wazo.Stream(rawStream, participant);
|
|
11803
11831
|
participant.streams.push(stream);
|
|
@@ -11757,9 +11757,11 @@ class Room$1 extends Emitter {
|
|
|
11757
11757
|
_onParticipantTrackUpdate(oldParticipant , update ) {
|
|
11758
11758
|
const newParticipant = oldParticipant;
|
|
11759
11759
|
|
|
11760
|
-
const { trackId } = this._callIdStreamIdMap[newParticipant.callId] || {};
|
|
11760
|
+
const { trackId, streamId } = this._callIdStreamIdMap[newParticipant.callId] || {};
|
|
11761
11761
|
const pc = Wazo.Phone.phone.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
11762
|
-
|
|
11762
|
+
// Can't use `getReceivers` here because on FF we make the mapping based on the streamId
|
|
11763
|
+
const stream = pc.getRemoteStreams().find(someStream =>
|
|
11764
|
+
someStream.id === streamId || someStream.getTracks().some(track => track.id === trackId));
|
|
11763
11765
|
|
|
11764
11766
|
if (update === 'downgrade') {
|
|
11765
11767
|
newParticipant.streams = [];
|
|
@@ -11789,15 +11791,41 @@ class Room$1 extends Emitter {
|
|
|
11789
11791
|
return;
|
|
11790
11792
|
}
|
|
11791
11793
|
|
|
11792
|
-
|
|
11794
|
+
const streamId = this._getStreamIdFrTrackId(trackId);
|
|
11795
|
+
const key = this._getUnassociatedMapIdFromTrackIdOrStreamId(trackId, streamId);
|
|
11796
|
+
const stream = this._unassociatedVideoStreams[key];
|
|
11797
|
+
|
|
11798
|
+
if (stream) {
|
|
11793
11799
|
// Try to associate stream
|
|
11794
|
-
this._associateStreamTo(
|
|
11800
|
+
this._associateStreamTo(stream, participant);
|
|
11795
11801
|
|
|
11796
|
-
delete this._unassociatedVideoStreams[
|
|
11802
|
+
delete this._unassociatedVideoStreams[key];
|
|
11797
11803
|
delete this._unassociatedParticipants[participant.callId];
|
|
11798
11804
|
}
|
|
11799
11805
|
}
|
|
11800
11806
|
|
|
11807
|
+
_getUnassociatedMapIdFromTrackIdOrStreamId(trackId , streamId ) {
|
|
11808
|
+
// Find by trackId
|
|
11809
|
+
if (trackId in this._unassociatedVideoStreams) {
|
|
11810
|
+
return trackId;
|
|
11811
|
+
}
|
|
11812
|
+
|
|
11813
|
+
// Find by streamId
|
|
11814
|
+
if (streamId && streamId in this._unassociatedVideoStreams) {
|
|
11815
|
+
return streamId;
|
|
11816
|
+
}
|
|
11817
|
+
|
|
11818
|
+
// Find in all the streams by streamId (used on FF where we can't map by trackId)
|
|
11819
|
+
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) => stream.id === streamId);
|
|
11820
|
+
return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
|
|
11821
|
+
}
|
|
11822
|
+
|
|
11823
|
+
_getStreamIdFrTrackId(trackId ) {
|
|
11824
|
+
const mapping = Object.values(this._callIdStreamIdMap).find((map ) => map.trackId === trackId);
|
|
11825
|
+
|
|
11826
|
+
return mapping ? mapping.streamId : null;
|
|
11827
|
+
}
|
|
11828
|
+
|
|
11801
11829
|
_associateStreamTo(rawStream , participant ) {
|
|
11802
11830
|
const stream = new Wazo.Stream(rawStream, participant);
|
|
11803
11831
|
participant.streams.push(stream);
|
package/lib/simple/utils.js
CHANGED
|
@@ -11759,9 +11759,11 @@ class Room$1 extends Emitter {
|
|
|
11759
11759
|
_onParticipantTrackUpdate(oldParticipant , update ) {
|
|
11760
11760
|
const newParticipant = oldParticipant;
|
|
11761
11761
|
|
|
11762
|
-
const { trackId } = this._callIdStreamIdMap[newParticipant.callId] || {};
|
|
11762
|
+
const { trackId, streamId } = this._callIdStreamIdMap[newParticipant.callId] || {};
|
|
11763
11763
|
const pc = Wazo.Phone.phone.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
11764
|
-
|
|
11764
|
+
// Can't use `getReceivers` here because on FF we make the mapping based on the streamId
|
|
11765
|
+
const stream = pc.getRemoteStreams().find(someStream =>
|
|
11766
|
+
someStream.id === streamId || someStream.getTracks().some(track => track.id === trackId));
|
|
11765
11767
|
|
|
11766
11768
|
if (update === 'downgrade') {
|
|
11767
11769
|
newParticipant.streams = [];
|
|
@@ -11791,15 +11793,41 @@ class Room$1 extends Emitter {
|
|
|
11791
11793
|
return;
|
|
11792
11794
|
}
|
|
11793
11795
|
|
|
11794
|
-
|
|
11796
|
+
const streamId = this._getStreamIdFrTrackId(trackId);
|
|
11797
|
+
const key = this._getUnassociatedMapIdFromTrackIdOrStreamId(trackId, streamId);
|
|
11798
|
+
const stream = this._unassociatedVideoStreams[key];
|
|
11799
|
+
|
|
11800
|
+
if (stream) {
|
|
11795
11801
|
// Try to associate stream
|
|
11796
|
-
this._associateStreamTo(
|
|
11802
|
+
this._associateStreamTo(stream, participant);
|
|
11797
11803
|
|
|
11798
|
-
delete this._unassociatedVideoStreams[
|
|
11804
|
+
delete this._unassociatedVideoStreams[key];
|
|
11799
11805
|
delete this._unassociatedParticipants[participant.callId];
|
|
11800
11806
|
}
|
|
11801
11807
|
}
|
|
11802
11808
|
|
|
11809
|
+
_getUnassociatedMapIdFromTrackIdOrStreamId(trackId , streamId ) {
|
|
11810
|
+
// Find by trackId
|
|
11811
|
+
if (trackId in this._unassociatedVideoStreams) {
|
|
11812
|
+
return trackId;
|
|
11813
|
+
}
|
|
11814
|
+
|
|
11815
|
+
// Find by streamId
|
|
11816
|
+
if (streamId && streamId in this._unassociatedVideoStreams) {
|
|
11817
|
+
return streamId;
|
|
11818
|
+
}
|
|
11819
|
+
|
|
11820
|
+
// Find in all the streams by streamId (used on FF where we can't map by trackId)
|
|
11821
|
+
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) => stream.id === streamId);
|
|
11822
|
+
return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
|
|
11823
|
+
}
|
|
11824
|
+
|
|
11825
|
+
_getStreamIdFrTrackId(trackId ) {
|
|
11826
|
+
const mapping = Object.values(this._callIdStreamIdMap).find((map ) => map.trackId === trackId);
|
|
11827
|
+
|
|
11828
|
+
return mapping ? mapping.streamId : null;
|
|
11829
|
+
}
|
|
11830
|
+
|
|
11803
11831
|
_associateStreamTo(rawStream , participant ) {
|
|
11804
11832
|
const stream = new Wazo.Stream(rawStream, participant);
|
|
11805
11833
|
participant.streams.push(stream);
|
package/package.json
CHANGED
package/src/simple/room/Room.js
CHANGED
|
@@ -754,9 +754,11 @@ class Room extends Emitter {
|
|
|
754
754
|
_onParticipantTrackUpdate(oldParticipant: Participant, update: string): Participant {
|
|
755
755
|
const newParticipant = oldParticipant;
|
|
756
756
|
|
|
757
|
-
const { trackId } = this._callIdStreamIdMap[newParticipant.callId] || {};
|
|
757
|
+
const { trackId, streamId } = this._callIdStreamIdMap[newParticipant.callId] || {};
|
|
758
758
|
const pc = Wazo.Phone.phone.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
759
|
-
|
|
759
|
+
// Can't use `getReceivers` here because on FF we make the mapping based on the streamId
|
|
760
|
+
const stream = pc.getRemoteStreams().find(someStream =>
|
|
761
|
+
someStream.id === streamId || someStream.getTracks().some(track => track.id === trackId));
|
|
760
762
|
|
|
761
763
|
if (update === 'downgrade') {
|
|
762
764
|
newParticipant.streams = [];
|
|
@@ -786,15 +788,41 @@ class Room extends Emitter {
|
|
|
786
788
|
return;
|
|
787
789
|
}
|
|
788
790
|
|
|
789
|
-
|
|
791
|
+
const streamId = this._getStreamIdFrTrackId(trackId);
|
|
792
|
+
const key = this._getUnassociatedMapIdFromTrackIdOrStreamId(trackId, streamId);
|
|
793
|
+
const stream = this._unassociatedVideoStreams[key];
|
|
794
|
+
|
|
795
|
+
if (stream) {
|
|
790
796
|
// Try to associate stream
|
|
791
|
-
this._associateStreamTo(
|
|
797
|
+
this._associateStreamTo(stream, participant);
|
|
792
798
|
|
|
793
|
-
delete this._unassociatedVideoStreams[
|
|
799
|
+
delete this._unassociatedVideoStreams[key];
|
|
794
800
|
delete this._unassociatedParticipants[participant.callId];
|
|
795
801
|
}
|
|
796
802
|
}
|
|
797
803
|
|
|
804
|
+
_getUnassociatedMapIdFromTrackIdOrStreamId(trackId: string, streamId: ?string) {
|
|
805
|
+
// Find by trackId
|
|
806
|
+
if (trackId in this._unassociatedVideoStreams) {
|
|
807
|
+
return trackId;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// Find by streamId
|
|
811
|
+
if (streamId && streamId in this._unassociatedVideoStreams) {
|
|
812
|
+
return streamId;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
// Find in all the streams by streamId (used on FF where we can't map by trackId)
|
|
816
|
+
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream: Object) => stream.id === streamId);
|
|
817
|
+
return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
_getStreamIdFrTrackId(trackId: string) {
|
|
821
|
+
const mapping: Object = Object.values(this._callIdStreamIdMap).find((map: Object) => map.trackId === trackId);
|
|
822
|
+
|
|
823
|
+
return mapping ? mapping.streamId : null;
|
|
824
|
+
}
|
|
825
|
+
|
|
798
826
|
_associateStreamTo(rawStream: any, participant: Participant) {
|
|
799
827
|
const stream = new Wazo.Stream(rawStream, participant);
|
|
800
828
|
participant.streams.push(stream);
|