Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Selects the datachannel that is ready for sending notifications to the bridge.

George Politise74d27bf88f9
diff --git a/app.js b/app.js
index 13dcea83eb..50ab11b760 100644
--- a/app.js
+++ b/app.js
@@ -1507,12 +1507,20 @@ $(document).bind('fatalError.jingle',
function onSelectedEndpointChanged(userJid)
{
console.log('selected endpoint changed: ', userJid);
- if (_dataChannels && _dataChannels.length != 0 && _dataChannels[0].readyState == "open") {
- _dataChannels[0].send(JSON.stringify({
- 'colibriClass': 'SelectedEndpointChangedEvent',
- 'selectedEndpoint': (!userJid || userJid == null)
- ? null : Strophe.getResourceFromJid(userJid)
- }));
+ if (_dataChannels && _dataChannels.length != 0)
+ {
+ _dataChannels.some(function (dataChannel) {
+ if (dataChannel.readyState == 'open')
+ {
+ dataChannel.send(JSON.stringify({
+ 'colibriClass': 'SelectedEndpointChangedEvent',
+ 'selectedEndpoint': (!userJid || userJid == null)
+ ? null : Strophe.getResourceFromJid(userJid)
+ }));
+
+ return true;
+ }
+ });
}
}