Skip to content

Commit

Permalink
add max participant capacity feature to conference room
Browse files Browse the repository at this point in the history
  • Loading branch information
lastpeony committed Oct 24, 2023
1 parent 343d8b4 commit 8597d17
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
22 changes: 21 additions & 1 deletion src/main/java/io/antmedia/datastore/db/types/ConferenceRoom.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
public class ConferenceRoom {
public static final String MULTI_TRACK_MODE = "multitrack";

public static final int UNLIMITED_PARTICIPANT_CAPACITY = -1;

public static final String LEGACY_MODE = "legacy";

@JsonIgnore
Expand All @@ -43,7 +45,10 @@ public class ConferenceRoom {

@ApiModelProperty(value = "Conference Room Mode: legacy | mcu | multi-track")
private String mode = "legacy";


@ApiModelProperty(value = "Maximum number of participants/streams that can participate in conference room. Default is unlimited.")
private int maxParticipantCapacity = UNLIMITED_PARTICIPANT_CAPACITY;

@JsonIgnore
private boolean zombi;

Expand Down Expand Up @@ -109,5 +114,20 @@ public void setOriginAdress(String originAdress) {
this.originAdress = originAdress;
}

public boolean isCapacityFull(){
if(maxParticipantCapacity == UNLIMITED_PARTICIPANT_CAPACITY){
return false;
}
return roomStreamList.size() >= maxParticipantCapacity;
}

public int getMaxParticipantCapacity() {
return maxParticipantCapacity;
}

public void setMaxParticipantCapacity(int maxParticipantCapacity) {
this.maxParticipantCapacity = maxParticipantCapacity;
}

}

4 changes: 4 additions & 0 deletions src/main/java/io/antmedia/rest/RestServiceBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -1782,6 +1782,10 @@ public static boolean addStreamToConferenceRoom(String roomId, String streamId,
return false;
}

if(conferenceRoom.isCapacityFull()){
return false;
}

List<String> roomStreamList = conferenceRoom.getRoomStreamList();
if (roomStreamList.contains(streamId)) {
return false;
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/io/antmedia/websocket/WebSocketConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,12 @@ private WebSocketConstants() {
* joining the video conference
*/
public static final String ROOM_TIME_INVALID = "room_not_active_or_expired";



/**
* This is sent back to the user when conference room participant capacity is full.
*/
public static final String ROOM_CAPACITY_FULL = "room_capacity_full";

/**
* This is sent back to the user when stream plannedStartDate and plannedEndDate
* values are in interval or not.
Expand Down

0 comments on commit 8597d17

Please sign in to comment.