mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-26 06:49:22 +00:00
Notify when we stop streaming
This commit is contained in:
parent
b9a329c8f0
commit
565f351d1e
@ -66,4 +66,15 @@ class CallsHelper {
|
||||
/// Mark ourselves as ready to stream to other peers
|
||||
static Future<void> markPeerReady(int callID) async =>
|
||||
await ws("calls/mark_ready", {"callID": callID});
|
||||
|
||||
/// Notify other peers that we stopped streaming
|
||||
///
|
||||
/// This method never throw
|
||||
static Future<void> notifyStoppedStreaming(int callID) async {
|
||||
try {
|
||||
await ws("calls/stop_streaming", {"callID": callID});
|
||||
} catch (e, stack) {
|
||||
print("$e\n$stack");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ class _CallScreenState extends SafeState<CallScreen> {
|
||||
final offer = await peerConnection.createOffer({
|
||||
"mandatory": {
|
||||
"OfferToReceiveAudio": true,
|
||||
"OfferToReceiveVideo": true,
|
||||
"OfferToReceiveVideo": includeVideo,
|
||||
},
|
||||
"optional": [],
|
||||
});
|
||||
@ -245,6 +245,8 @@ class _CallScreenState extends SafeState<CallScreen> {
|
||||
if (_peersConnections.containsKey(userID())) {
|
||||
_peersConnections[userID()].close();
|
||||
_peersConnections.remove(userID());
|
||||
|
||||
await CallsHelper.notifyStoppedStreaming(convID);
|
||||
}
|
||||
|
||||
// Stop local stream
|
||||
@ -313,6 +315,8 @@ class _CallScreenState extends SafeState<CallScreen> {
|
||||
|
||||
// Request an offer to establish a peer connection
|
||||
await CallsHelper.requestOffer(convID, memberID);
|
||||
|
||||
setState(() {});
|
||||
} catch (e, stack) {
|
||||
print("Could not connect to remote peer $e\n$stack!");
|
||||
showSimpleSnack(context, tr("Could not connect to a remote peer!"));
|
||||
|
Loading…
Reference in New Issue
Block a user