@webex/plugin-meetings 3.0.0-next.24 → 3.0.0-next.26
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/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/media/MediaConnectionAwaiter.d.ts +61 -0
- package/dist/media/MediaConnectionAwaiter.js +163 -0
- package/dist/media/MediaConnectionAwaiter.js.map +1 -0
- package/dist/media/properties.js +4 -24
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/index.js +116 -109
- package/dist/meeting/index.js.map +1 -1
- package/dist/webinar/index.js +1 -1
- package/package.json +5 -5
- package/src/media/MediaConnectionAwaiter.ts +174 -0
- package/src/media/properties.ts +6 -31
- package/src/meeting/index.ts +19 -15
- package/test/unit/spec/media/MediaConnectionAwaiter.ts +344 -0
- package/test/unit/spec/media/properties.ts +16 -70
- package/test/unit/spec/meeting/index.js +7 -18
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {assert} from '@webex/test-helper-chai';
|
|
2
2
|
import sinon from 'sinon';
|
|
3
|
-
import {ConnectionState
|
|
3
|
+
import {ConnectionState} from '@webex/internal-media-core';
|
|
4
4
|
import MediaProperties from '@webex/plugin-meetings/src/media/properties';
|
|
5
|
-
import MediaUtil from '@webex/plugin-meetings/src/media/util';
|
|
6
5
|
import testUtils from '../../../utils/testUtils';
|
|
7
|
-
import {ICE_AND_DTLS_CONNECTION_TIMEOUT} from '@webex/plugin-meetings/src/constants';
|
|
8
6
|
import {Defer} from '@webex/common';
|
|
7
|
+
import MediaConnectionAwaiter from '../../../../src/media/MediaConnectionAwaiter';
|
|
9
8
|
|
|
10
9
|
describe('MediaProperties', () => {
|
|
11
10
|
let mediaProperties;
|
|
@@ -31,80 +30,27 @@ describe('MediaProperties', () => {
|
|
|
31
30
|
sinon.restore();
|
|
32
31
|
});
|
|
33
32
|
describe('waitForMediaConnectionConnected', () => {
|
|
34
|
-
it('resolves
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
it('rejects after timeout if ice state does not reach connected/completed', async () => {
|
|
38
|
-
mockMC.getConnectionState.returns(ConnectionState.Connecting);
|
|
39
|
-
|
|
40
|
-
let promiseResolved = false;
|
|
41
|
-
let promiseRejected = false;
|
|
42
|
-
|
|
43
|
-
mediaProperties
|
|
44
|
-
.waitForMediaConnectionConnected()
|
|
45
|
-
.then(() => {
|
|
46
|
-
promiseResolved = true;
|
|
47
|
-
})
|
|
48
|
-
.catch(() => {
|
|
49
|
-
promiseRejected = true;
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
assert.equal(promiseResolved, false);
|
|
53
|
-
assert.equal(promiseRejected, false);
|
|
54
|
-
|
|
55
|
-
await clock.tickAsync(ICE_AND_DTLS_CONNECTION_TIMEOUT);
|
|
56
|
-
await testUtils.flushPromises();
|
|
33
|
+
it('resolves if media connection is connected', async () => {
|
|
34
|
+
const waitForMediaConnectionConnectedResult = new Defer();
|
|
57
35
|
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
sinon
|
|
37
|
+
.stub(MediaConnectionAwaiter.prototype, 'waitForMediaConnectionConnected')
|
|
38
|
+
.returns(waitForMediaConnectionConnectedResult.promise);
|
|
60
39
|
|
|
61
|
-
|
|
62
|
-
assert.calledOnce(mockMC.on);
|
|
63
|
-
assert.equal(mockMC.on.getCall(0).args[0], Event.CONNECTION_STATE_CHANGED);
|
|
64
|
-
const listener = mockMC.on.getCall(0).args[1];
|
|
40
|
+
waitForMediaConnectionConnectedResult.resolve();
|
|
65
41
|
|
|
66
|
-
|
|
67
|
-
assert.calledWith(mockMC.off, Event.CONNECTION_STATE_CHANGED, listener);
|
|
42
|
+
await mediaProperties.waitForMediaConnectionConnected();
|
|
68
43
|
});
|
|
44
|
+
it('rejects if media connection is not connected', async () => {
|
|
45
|
+
const waitForMediaConnectionConnectedResult = new Defer();
|
|
69
46
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const clearTimeoutSpy = sinon.spy(clock, 'clearTimeout');
|
|
74
|
-
|
|
75
|
-
let promiseResolved = false;
|
|
76
|
-
let promiseRejected = false;
|
|
77
|
-
|
|
78
|
-
mediaProperties
|
|
79
|
-
.waitForMediaConnectionConnected()
|
|
80
|
-
.then(() => {
|
|
81
|
-
promiseResolved = true;
|
|
82
|
-
})
|
|
83
|
-
.catch(() => {
|
|
84
|
-
promiseRejected = true;
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
assert.equal(promiseResolved, false);
|
|
88
|
-
assert.equal(promiseRejected, false);
|
|
89
|
-
|
|
90
|
-
// check the right listener was registered
|
|
91
|
-
assert.calledOnce(mockMC.on);
|
|
92
|
-
assert.equal(mockMC.on.getCall(0).args[0], Event.CONNECTION_STATE_CHANGED);
|
|
93
|
-
const listener = mockMC.on.getCall(0).args[1];
|
|
94
|
-
|
|
95
|
-
// call the listener and pretend we are now connected
|
|
96
|
-
mockMC.getConnectionState.returns(ConnectionState.Connected);
|
|
97
|
-
listener();
|
|
98
|
-
await testUtils.flushPromises();
|
|
99
|
-
|
|
100
|
-
assert.equal(promiseResolved, true);
|
|
101
|
-
assert.equal(promiseRejected, false);
|
|
47
|
+
sinon
|
|
48
|
+
.stub(MediaConnectionAwaiter.prototype, 'waitForMediaConnectionConnected')
|
|
49
|
+
.returns(waitForMediaConnectionConnectedResult.promise);
|
|
102
50
|
|
|
103
|
-
|
|
104
|
-
assert.calledOnce(mockMC.off);
|
|
105
|
-
assert.calledWith(mockMC.off, Event.CONNECTION_STATE_CHANGED, listener);
|
|
51
|
+
waitForMediaConnectionConnectedResult.reject();
|
|
106
52
|
|
|
107
|
-
assert.
|
|
53
|
+
await assert.isRejected(mediaProperties.waitForMediaConnectionConnected());
|
|
108
54
|
});
|
|
109
55
|
});
|
|
110
56
|
|
|
@@ -1011,15 +1011,14 @@ describe('plugin-meetings', () => {
|
|
|
1011
1011
|
});
|
|
1012
1012
|
|
|
1013
1013
|
describe('transcription events', () => {
|
|
1014
|
+
beforeEach(() => {
|
|
1015
|
+
meeting.trigger = sinon.stub();
|
|
1016
|
+
});
|
|
1017
|
+
|
|
1014
1018
|
it('should trigger meeting:caption-received event', () => {
|
|
1015
1019
|
meeting.voiceaListenerCallbacks[VOICEAEVENTS.NEW_CAPTION]({});
|
|
1016
1020
|
assert.calledWith(
|
|
1017
|
-
|
|
1018
|
-
sinon.match.instanceOf(Meeting),
|
|
1019
|
-
{
|
|
1020
|
-
file: 'meeting/index',
|
|
1021
|
-
function: 'setUpVoiceaListeners',
|
|
1022
|
-
},
|
|
1021
|
+
meeting.trigger,
|
|
1023
1022
|
EVENT_TRIGGERS.MEETING_CAPTION_RECEIVED
|
|
1024
1023
|
);
|
|
1025
1024
|
});
|
|
@@ -1027,12 +1026,7 @@ describe('plugin-meetings', () => {
|
|
|
1027
1026
|
it('should trigger meeting:receiveTranscription:started event', () => {
|
|
1028
1027
|
meeting.voiceaListenerCallbacks[VOICEAEVENTS.VOICEA_ANNOUNCEMENT]({});
|
|
1029
1028
|
assert.calledWith(
|
|
1030
|
-
|
|
1031
|
-
sinon.match.instanceOf(Meeting),
|
|
1032
|
-
{
|
|
1033
|
-
file: 'meeting/index',
|
|
1034
|
-
function: 'setUpVoiceaListeners',
|
|
1035
|
-
},
|
|
1029
|
+
meeting.trigger,
|
|
1036
1030
|
EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION
|
|
1037
1031
|
);
|
|
1038
1032
|
});
|
|
@@ -1040,12 +1034,7 @@ describe('plugin-meetings', () => {
|
|
|
1040
1034
|
it('should trigger meeting:caption-received event', () => {
|
|
1041
1035
|
meeting.voiceaListenerCallbacks[VOICEAEVENTS.NEW_CAPTION]({});
|
|
1042
1036
|
assert.calledWith(
|
|
1043
|
-
|
|
1044
|
-
sinon.match.instanceOf(Meeting),
|
|
1045
|
-
{
|
|
1046
|
-
file: 'meeting/index',
|
|
1047
|
-
function: 'setUpVoiceaListeners',
|
|
1048
|
-
},
|
|
1037
|
+
meeting.trigger,
|
|
1049
1038
|
EVENT_TRIGGERS.MEETING_CAPTION_RECEIVED
|
|
1050
1039
|
);
|
|
1051
1040
|
});
|