mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Improve video appearance
This commit is contained in:
parent
ce908d1b51
commit
44f417a0f2
@ -1,4 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:comunic/helpers/calls_helper.dart';
|
import 'package:comunic/helpers/calls_helper.dart';
|
||||||
import 'package:comunic/helpers/conversations_helper.dart';
|
import 'package:comunic/helpers/conversations_helper.dart';
|
||||||
@ -478,7 +479,7 @@ class _CallScreenState extends SafeState<CallScreen> {
|
|||||||
return Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
_canHideMenuBar ? Container() : _buildMembersArea(),
|
_canHideMenuBar ? Container() : _buildMembersArea(),
|
||||||
_buildVideosArea()
|
Expanded(child: LayoutBuilder(builder: _buildVideosArea))
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -503,34 +504,56 @@ class _CallScreenState extends SafeState<CallScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Videos area
|
/// Videos area
|
||||||
Widget _buildVideosArea() {
|
Widget _buildVideosArea(BuildContext context, BoxConstraints constraints) {
|
||||||
return Expanded(
|
final availableVideos = _membersList.readyPeers
|
||||||
child: Stack(
|
.where((f) => f.hasVideoStream && _renderers.containsKey(f.userID))
|
||||||
fit: StackFit.expand,
|
.toList();
|
||||||
children: [
|
|
||||||
// Remove peers videos
|
|
||||||
Column(
|
|
||||||
children: _membersList.readyPeers
|
|
||||||
.where(
|
|
||||||
(f) => f.hasVideoStream && _renderers.containsKey(f.userID))
|
|
||||||
.map((f) => _buildMemberVideo(f.userID))
|
|
||||||
.toList(),
|
|
||||||
),
|
|
||||||
|
|
||||||
// Local peer video
|
final rows = List<Row>();
|
||||||
isStreamingVideo && _isLocalStreamVisible
|
|
||||||
? _buildLocalVideo()
|
|
||||||
: Container(),
|
|
||||||
|
|
||||||
// Buttons bar
|
var numberRows = sqrt(availableVideos.length).ceil();
|
||||||
_canHideMenuBar ? Container() : _buildFooterArea()
|
var numberCols = numberRows;
|
||||||
],
|
|
||||||
),
|
if (availableVideos.length == 2) numberRows = 1;
|
||||||
|
|
||||||
|
final videoWidth = constraints.maxWidth / numberCols;
|
||||||
|
final videoHeight = constraints.maxHeight / numberRows;
|
||||||
|
|
||||||
|
for (int i = 0; i < numberRows; i++) {
|
||||||
|
rows.add(Row(
|
||||||
|
children: availableVideos
|
||||||
|
.getRange(i * numberRows,
|
||||||
|
min(availableVideos.length, i * numberRows + numberCols))
|
||||||
|
.map((f) => Container(
|
||||||
|
width: videoWidth,
|
||||||
|
height: videoHeight,
|
||||||
|
child: _buildMemberVideo(f.userID),
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Stack(
|
||||||
|
fit: StackFit.expand,
|
||||||
|
children: [
|
||||||
|
// Remove peers videos
|
||||||
|
Column(
|
||||||
|
children: rows,
|
||||||
|
),
|
||||||
|
|
||||||
|
// Local peer video
|
||||||
|
isStreamingVideo && _isLocalStreamVisible
|
||||||
|
? _buildLocalVideo()
|
||||||
|
: Container(),
|
||||||
|
|
||||||
|
// Buttons bar
|
||||||
|
_canHideMenuBar ? Container() : _buildFooterArea()
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMemberVideo(int peerID) {
|
Widget _buildMemberVideo(int peerID) {
|
||||||
return Expanded(child: RTCVideoView(_renderers[peerID]));
|
return RTCVideoView(_renderers[peerID]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildLocalVideo() {
|
Widget _buildLocalVideo() {
|
||||||
|
Loading…
Reference in New Issue
Block a user