mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 00:05:16 +00:00
Handles peer ready & peer destroyed streams events
This commit is contained in:
@ -86,6 +86,22 @@ class UserLeftCallEvent {
|
||||
UserLeftCallEvent(this.callID, this.userID);
|
||||
}
|
||||
|
||||
/// Call peer ready event
|
||||
class CallPeerReadyEvent {
|
||||
final int callID;
|
||||
final int peerID;
|
||||
|
||||
CallPeerReadyEvent(this.callID, this.peerID);
|
||||
}
|
||||
|
||||
/// Call peer interrupted streaming event
|
||||
class CallPeerInterruptedStreamingEvent {
|
||||
final int callID;
|
||||
final int peerID;
|
||||
|
||||
CallPeerInterruptedStreamingEvent(this.callID, this.peerID);
|
||||
}
|
||||
|
||||
/// Call closed event
|
||||
class CallClosedEvent {
|
||||
final int callID;
|
||||
|
@ -26,7 +26,6 @@ class WebSocketHelper {
|
||||
}
|
||||
|
||||
/// Get WebSocket access token
|
||||
//TODO : Handles the case user tokens were destroyed (auto sign-out user)
|
||||
static Future<String> _getWsToken() async =>
|
||||
(await APIRequest(uri: "ws/token", needLogin: true).exec())
|
||||
.assertOk()
|
||||
@ -173,7 +172,19 @@ class WebSocketHelper {
|
||||
UserLeftCallEvent(msg.data["callID"], msg.data["userID"]));
|
||||
break;
|
||||
|
||||
// The call has been close
|
||||
// Call peer ready event
|
||||
case "call_peer_ready":
|
||||
EventsHelper.emit(
|
||||
CallPeerReadyEvent(msg.data["callID"], msg.data["peerID"]));
|
||||
break;
|
||||
|
||||
// Call peer interrupted streaming event
|
||||
case "call_peer_interrupted_streaming":
|
||||
EventsHelper.emit(CallPeerInterruptedStreamingEvent(
|
||||
msg.data["callID"], msg.data["peerID"]));
|
||||
break;
|
||||
|
||||
// The call has been closed
|
||||
case "call_closed":
|
||||
EventsHelper.emit(CallClosedEvent(msg.data));
|
||||
break;
|
||||
|
Reference in New Issue
Block a user