1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-12-26 13:38:52 +00:00

Notify peers call was interrputed

This commit is contained in:
Pierre HUBERT 2020-04-14 09:27:29 +02:00
parent c50e9d3d23
commit 1e1c2050a2
2 changed files with 27 additions and 0 deletions

View File

@ -237,6 +237,31 @@ export class CallsController {
h.success()
}
/**
* Notify the user stopped to stream
*
* @param h Request handler
*/
public static async UserInterruptedStreaming(h: UserWebSocketRequestsHandler) {
const callID = h.postCallId("callID");
// Propagate notification only if required
if(h.wsClient.activeCalls.get(callID).ready) {
h.wsClient.activeCalls.get(callID).ready = false;
// Notify all other users
await UserWebSocketController.SendToSpecifcClients(
(c) => c.activeCalls.has(callID) && c.userID != h.getUserId(),
() => WsMessage.NoIDMessage("call_peer_interrupted_streaming", {
callID: callID,
peerID: h.getUserId()
})
)
}
h.success();
}
/**
* Make the client leave the call
*

View File

@ -46,4 +46,6 @@ export const UserWebSocketRoutes: UserWebSocketRoute[] = [
{title: "calls/mark_ready", handler: (h) => CallsController.MarkUserReady(h)},
{title: "calls/request_offer", handler: (h) => CallsController.RequestOffer(h)},
{title: "calls/stop_streaming", handler: (h) => CallsController.UserInterruptedStreaming(h)},
]