|
@@ -58,6 +58,10 @@ function JitsiConference(options) {
|
58
|
58
|
this.startAudioMuted = false;
|
59
|
59
|
this.startVideoMuted = false;
|
60
|
60
|
this.startMutedPolicy = {audio: false, video: false};
|
|
61
|
+ this.availableDevices = {
|
|
62
|
+ audio: undefined,
|
|
63
|
+ video: undefined
|
|
64
|
+ };
|
61
|
65
|
}
|
62
|
66
|
|
63
|
67
|
/**
|
|
@@ -962,6 +966,50 @@ function setupListeners(conference) {
|
962
|
966
|
}
|
963
|
967
|
});
|
964
|
968
|
|
|
969
|
+ conference.rtc.addListener(RTCEvents.AVAILABLE_DEVICES_CHANGED, function (devices) {
|
|
970
|
+ conference.room.updateDeviceAvailability(devices);
|
|
971
|
+ });
|
|
972
|
+ conference.room.addPresenceListener("devices", function (data, from) {
|
|
973
|
+ var isAudioAvailable = false;
|
|
974
|
+ var isVideoAvailable = false;
|
|
975
|
+ data.children.forEach(function (config) {
|
|
976
|
+ if (config.tagName === 'audio') {
|
|
977
|
+ isAudioAvailable = config.value === 'true';
|
|
978
|
+ }
|
|
979
|
+ if (config.tagName === 'video') {
|
|
980
|
+ isVideoAvailable = config.value === 'true';
|
|
981
|
+ }
|
|
982
|
+ });
|
|
983
|
+
|
|
984
|
+ var availableDevices;
|
|
985
|
+ if (conference.myUserId() === from) {
|
|
986
|
+ availableDevices = conference.availableDevices;
|
|
987
|
+ } else {
|
|
988
|
+ var participant = conference.getParticipantById(from);
|
|
989
|
+ if (!participant) {
|
|
990
|
+ return;
|
|
991
|
+ }
|
|
992
|
+
|
|
993
|
+ availableDevices = participant._availableDevices;
|
|
994
|
+ }
|
|
995
|
+
|
|
996
|
+ var updated = false;
|
|
997
|
+
|
|
998
|
+ if (availableDevices.audio !== isAudioAvailable) {
|
|
999
|
+ updated = true;
|
|
1000
|
+ availableDevices.audio = isAudioAvailable;
|
|
1001
|
+ }
|
|
1002
|
+
|
|
1003
|
+ if (availableDevices.video !== isVideoAvailable) {
|
|
1004
|
+ updated = true;
|
|
1005
|
+ availableDevices.video = isVideoAvailable;
|
|
1006
|
+ }
|
|
1007
|
+
|
|
1008
|
+ if (updated) {
|
|
1009
|
+ conference.eventEmitter.emit(JitsiConferenceEvents.AVAILABLE_DEVICES_CHANGED, from, availableDevices);
|
|
1010
|
+ }
|
|
1011
|
+ });
|
|
1012
|
+
|
965
|
1013
|
if(conference.statistics) {
|
966
|
1014
|
//FIXME: Maybe remove event should not be associated with the conference.
|
967
|
1015
|
conference.statistics.addAudioLevelListener(function (ssrc, level) {
|
|
@@ -976,10 +1024,6 @@ function setupListeners(conference) {
|
976
|
1024
|
function () {
|
977
|
1025
|
conference.statistics.dispose();
|
978
|
1026
|
});
|
979
|
|
- // FIXME: Maybe we should move this.
|
980
|
|
- // RTC.addListener(RTCEvents.AVAILABLE_DEVICES_CHANGED, function (devices) {
|
981
|
|
- // conference.room.updateDeviceAvailability(devices);
|
982
|
|
- // });
|
983
|
1027
|
|
984
|
1028
|
conference.room.addListener(XMPPEvents.PEERCONNECTION_READY,
|
985
|
1029
|
function (session) {
|