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:
parent
c50e9d3d23
commit
1e1c2050a2
@ -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
|
||||
*
|
||||
|
@ -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)},
|
||||
]
|
Loading…
Reference in New Issue
Block a user