Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extends fields for join/leave commands #522

Merged
merged 7 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/main/js/webrtc_adaptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,15 +550,22 @@ export class WebRTCAdaptor {
* @param {string=} mode : legacy for older implementation (default value)
* mcu for merging streams
* amcu: audio only conferences with mixed audio
* @param {string=} streamName : name of the stream
* @param {string=} role : role for the stream. It is used for selective forwarding of subtracks in conference mode.
* @param {string=} metadata : a free text information for the stream to AMS.
*/
joinRoom(roomName, streamId, mode) {
joinRoom(roomName, streamId, mode, streamName, role, metadata) {
this.roomName = roomName;

let jsCmd = {
command: "joinRoom",
room: roomName,
mainTrack: roomName,
streamId: streamId,
mode: mode,
streamName: streamName,
role: role,
metadata: metadata,
}
this.webSocketAdaptor.send(JSON.stringify(jsCmd));
}
Expand Down Expand Up @@ -758,15 +765,18 @@ export class WebRTCAdaptor {
* Called to leave from a conference room. AMS responds with leavedTheRoom message.
* Parameters:
* @param {string} roomName : unique id for the conference room
* @param {string=} streamId : unique id for the stream that is streamed by this @WebRTCAdaptor
*/
leaveFromRoom(roomName) {
leaveFromRoom(roomName, streamId) {
for (var key in this.remotePeerConnection) {
this.closePeerConnection(key);
}
this.roomName = roomName;
var jsCmd = {
command: "leaveFromRoom",
room: roomName,
mainTrack: roomName,
streamId: streamId,
};
Logger.debug("leave request is sent for " + roomName);

Expand Down
7 changes: 6 additions & 1 deletion src/test/js/webrtc_adaptor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,15 +897,20 @@ describe("WebRTCAdaptor", function() {
let jsCmd = {
command: "joinRoom",
room: roomId,
mainTrack: roomId,
streamId: streamId,
mode: "multitrack",
streamName: "streamName",
role: "role",
metadata: "metadata",

}

let webSocketAdaptor = sinon.mock(adaptor.webSocketAdaptor);

let sendExpectation = webSocketAdaptor.expects("send").once().withArgs(JSON.stringify(jsCmd));

adaptor.joinRoom(roomId, streamId, "multitrack");
adaptor.joinRoom(roomId, streamId, "multitrack", "streamName", "role", "metadata");

sendExpectation.verify()

Expand Down
Loading