Skip to content

Commit 84ecea8

Browse files
author
evgeny-nadymov
committed
Fix group call settings
1 parent 6d3603d commit 84ecea8

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"homepage": "https://evgeny-nadymov.github.io/telegram-react",
33
"name": "telegram_react",
4-
"version": "0.0.954",
4+
"version": "0.0.955",
55
"private": true,
66
"dependencies": {
77
"@arseny30/tdweb": "^1.7.6",

src/Components/Calls/GroupCallSettings.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,17 @@ class GroupCallSettings extends React.Component {
119119
// navigator.permissions.removeEventListener('onchange', this.onDeviceChange);
120120
KeyboardManager.remove(this.keyboardHandler);
121121
CallStore.off('updateGroupCall', this.onUpdateGroupCall);
122+
123+
this.closeStreams();
124+
}
125+
126+
closeStreams() {
127+
const { inputAudioStream, inputAudioDeviceId } = this.state;
128+
if (inputAudioStream && (!CallStore.currentGroupCall || inputAudioDeviceId === CallStore.getInputAudioDeviceId())) {
129+
inputAudioStream.getAudioTracks().forEach(x => {
130+
x.stop();
131+
});
132+
}
122133
}
123134

124135
onUpdateGroupCall = update => {
@@ -291,28 +302,15 @@ class GroupCallSettings extends React.Component {
291302
const { onClose } = this.props;
292303
const { inputAudioDeviceId, inputAudioStream } = this.state;
293304

294-
if (inputAudioStream) {
295-
if (inputAudioDeviceId !== CallStore.getInputAudioDeviceId()) {
296-
await CallStore.setInputAudioDeviceId(inputAudioDeviceId, inputAudioStream);
297-
} else {
298-
inputAudioStream.getAudioTracks().forEach(t => {
299-
t.stop();
300-
});
301-
}
305+
if (inputAudioStream && inputAudioDeviceId !== CallStore.getInputAudioDeviceId()) {
306+
await CallStore.setInputAudioDeviceId(inputAudioDeviceId, inputAudioStream);
302307
}
303308

304309
onClose && onClose();
305310
};
306311

307312
handleCancel = () => {
308313
const { onClose } = this.props;
309-
const { inputAudioStream } = this.state;
310-
311-
if (inputAudioStream) {
312-
inputAudioStream.getAudioTracks().forEach(x => {
313-
x.stop();
314-
});
315-
}
316314

317315
onClose && onClose();
318316
};

src/Stores/CallStore.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class CallStore extends EventEmitter {
100100
break;
101101
}
102102
case 'callStateReady': {
103-
this.p2p2SendCallSignalingData(id, 'Hello world!');
103+
this.p2pSendCallSignalingData(id, 'Hello world!');
104104
break;
105105
}
106106
}
@@ -534,6 +534,9 @@ class CallStore extends EventEmitter {
534534
connection.onsignalingstatechange = event => {
535535
LOG_CALL('[conn] onsignalingstatechange', connection.signalingState);
536536
};
537+
connection.onconnectionstatechange = event => {
538+
LOG_CALL('[conn] onconnectionstatechange', connection.connectionState);
539+
};
537540
connection.onnegotiationneeded = event => {
538541
LOG_CALL('[conn] onnegotiationneeded', connection.signalingState);
539542
this.startNegotiation(muted, rejoin);
@@ -1262,8 +1265,8 @@ class CallStore extends EventEmitter {
12621265
'@type': 'callProtocol',
12631266
udp_p2p: true,
12641267
udp_reflector: true,
1265-
min_layer: 65,
1266-
max_layer: 65,
1268+
min_layer: 126,
1269+
max_layer: 126,
12671270
library_versions: []
12681271
};
12691272
}

0 commit comments

Comments
 (0)