diff --git a/webapp/src/main/java/io/antmedia/enterprise/streamapp/AMSBroadcastManager.java b/webapp/src/main/java/io/antmedia/enterprise/streamapp/AMSBroadcastManager.java index 08f224ef..44a29268 100644 --- a/webapp/src/main/java/io/antmedia/enterprise/streamapp/AMSBroadcastManager.java +++ b/webapp/src/main/java/io/antmedia/enterprise/streamapp/AMSBroadcastManager.java @@ -34,25 +34,7 @@ public void setApplicationContext(@NotNull ApplicationContext applicationContext IAntMediaStreamHandler app = getApplication(); appSettings = app.getAppSettings(); - - Object circleSettingsString = appSettings.getCustomSetting("circle"); - if (circleSettingsString == null) { - logger.error("Using default settings for Conference Room Settings because no Circle settings in the AppSettings"); - - conferenceRoomSettings = new ConferenceRoomSettings(); - } - else { - try { - conferenceRoomSettings = gson.fromJson(circleSettingsString.toString(), ConferenceRoomSettings.class); - } - catch (Exception e) - { - logger.error("Invalid Conference room settings, using default conference room settings"); - conferenceRoomSettings = new ConferenceRoomSettings(); - } - } - conferenceRoomSettings.init(); - + fetchConferenceRoomSettings(); } public AntMediaApplicationAdapter getApplication() { @@ -103,6 +85,36 @@ public boolean updateBroadcastRole(String streamId, String role) { return result; } + public void fetchConferenceRoomSettings() { + Object circleSettingsString = appSettings.getCustomSetting("circle"); + if (circleSettingsString == null) { + logger.error("Using default settings for Conference Room Settings because no Circle settings in the AppSettings"); + + conferenceRoomSettings = new ConferenceRoomSettings(); + } + else { + try { + conferenceRoomSettings = gson.fromJson(circleSettingsString.toString(), ConferenceRoomSettings.class); + } + catch (Exception e) + { + logger.error("Invalid Conference room settings, using default conference room settings"); + conferenceRoomSettings = new ConferenceRoomSettings(); + } + } + conferenceRoomSettings.init(); + + String participantVisibilityMatrix = appSettings.getParticipantVisibilityMatrix().toString(); + + if (participantVisibilityMatrix != null && conferenceRoomSettings.getParticipantVisibilityMatrix() == null) { + conferenceRoomSettings.setParticipantVisibilityMatrix(participantVisibilityMatrix); + } + + int maxVideoTrackCount = appSettings.getMaxVideoTrackCount(); + + conferenceRoomSettings.setMaxVideoTrackCount(maxVideoTrackCount); + } + public ConferenceRoomSettings getConferenceRoomSettings() { return conferenceRoomSettings; } diff --git a/webapp/src/main/java/io/antmedia/enterprise/streamapp/WebSocketApplicationHandler.java b/webapp/src/main/java/io/antmedia/enterprise/streamapp/WebSocketApplicationHandler.java index dd92fe81..6e550182 100644 --- a/webapp/src/main/java/io/antmedia/enterprise/streamapp/WebSocketApplicationHandler.java +++ b/webapp/src/main/java/io/antmedia/enterprise/streamapp/WebSocketApplicationHandler.java @@ -122,6 +122,7 @@ private AMSBroadcastManager getAMSBroadcastManager() { } private void setConferenceRoomSettings(){ + getAMSBroadcastManager().fetchConferenceRoomSettings(); conferenceRoomSettings = getAMSBroadcastManager().getConferenceRoomSettings(); } @@ -321,17 +322,6 @@ private Object getMediaPushPlugin() { } private void responseRoomSettings(Session session) { - - String participantVisibilityMatrix = appSettings.getParticipantVisibilityMatrix().toString(); - - if (participantVisibilityMatrix != null && conferenceRoomSettings.getParticipantVisibilityMatrix() == null) { - conferenceRoomSettings.setParticipantVisibilityMatrix(participantVisibilityMatrix); - } - - int maxVideoTrackCount = appSettings.getMaxVideoTrackCount(); - - conferenceRoomSettings.setMaxVideoTrackCount(maxVideoTrackCount); - JSONObject jsonResponse = new JSONObject(); jsonResponse.put(WebSocketConstants.COMMAND, WebSocketApplicationConstants.SET_SETTINGS_COMMAND); jsonResponse.put(WebSocketApplicationConstants.SETTINGS, gsonOnlyExposedFields.toJson(conferenceRoomSettings));