mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-26 14:59:22 +00:00
Simplify code
This commit is contained in:
parent
2927f72674
commit
de1dceae9b
@ -47,6 +47,9 @@ class _CallScreenState extends SafeState<CallScreen> {
|
|||||||
final _renderers = Map<int, RTCVideoRenderer>();
|
final _renderers = Map<int, RTCVideoRenderer>();
|
||||||
MediaStream _localStream;
|
MediaStream _localStream;
|
||||||
|
|
||||||
|
bool get _canMakeVideoCall =>
|
||||||
|
_conversation.callCapabilities == CallCapabilities.VIDEO;
|
||||||
|
|
||||||
bool get isStreamingAudio =>
|
bool get isStreamingAudio =>
|
||||||
_localStream != null && _localStream.getAudioTracks().length > 0;
|
_localStream != null && _localStream.getAudioTracks().length > 0;
|
||||||
|
|
||||||
@ -217,7 +220,7 @@ class _CallScreenState extends SafeState<CallScreen> {
|
|||||||
|
|
||||||
/// Toggle local video streaming
|
/// Toggle local video streaming
|
||||||
Future<void> _toggleStreaming(bool isVideo) async {
|
Future<void> _toggleStreaming(bool isVideo) async {
|
||||||
if (isVideo && _conversation.callCapabilities != CallCapabilities.VIDEO) {
|
if (isVideo && !_canMakeVideoCall) {
|
||||||
print("Attempting to switch video call on a non-capable video stream!");
|
print("Attempting to switch video call on a non-capable video stream!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -250,8 +253,7 @@ class _CallScreenState extends SafeState<CallScreen> {
|
|||||||
final peerConnection = await createPeerConnection(_conf.pluginConfig, {
|
final peerConnection = await createPeerConnection(_conf.pluginConfig, {
|
||||||
"mandatory": {
|
"mandatory": {
|
||||||
"OfferToReceiveAudio": true,
|
"OfferToReceiveAudio": true,
|
||||||
"OfferToReceiveVideo":
|
"OfferToReceiveVideo": _canMakeVideoCall,
|
||||||
_conversation.callCapabilities == CallCapabilities.VIDEO,
|
|
||||||
},
|
},
|
||||||
"optional": [],
|
"optional": [],
|
||||||
});
|
});
|
||||||
@ -401,6 +403,7 @@ class _CallScreenState extends SafeState<CallScreen> {
|
|||||||
// Remove peers videos
|
// Remove peers videos
|
||||||
Column(
|
Column(
|
||||||
children: _membersList.readyPeers
|
children: _membersList.readyPeers
|
||||||
|
.where((f) => _renderers.containsKey(f.userID))
|
||||||
.map((f) => _buildMemberVideo(f.userID))
|
.map((f) => _buildMemberVideo(f.userID))
|
||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user