1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-26 04:48:51 +00:00

Can switch camera

This commit is contained in:
Pierre HUBERT 2020-04-22 18:45:01 +02:00
parent 565f351d1e
commit d083728251

View File

@ -20,7 +20,7 @@ import 'package:flutter_webrtc/webrtc.dart';
///
/// @author Pierre Hubert
enum _PopupMenuOption { STOP_STREAMING }
enum _PopupMenuOption { STOP_STREAMING, SWITCH_CAMERA }
class CallScreen extends StatefulWidget {
final int convID;
@ -393,6 +393,11 @@ class _CallScreenState extends SafeState<CallScreen> {
/// Handles menu selection
void _handleSelectedMenuOption(_PopupMenuOption option) async {
switch (option) {
// Switch camera
case _PopupMenuOption.SWITCH_CAMERA:
await _localStream.getVideoTracks()[0].switchCamera();
break;
// Stop streaming
case _PopupMenuOption.STOP_STREAMING:
await _stopStreaming();
@ -534,6 +539,12 @@ class _CallScreenState extends SafeState<CallScreen> {
Expanded(
child: PopupMenuButton<_PopupMenuOption>(
itemBuilder: (c) => [
// Switch camera
PopupMenuItem(
enabled: isStreamingVideo,
child: Text(tr("Switch camera")),
value: _PopupMenuOption.SWITCH_CAMERA),
// Interrupt streaming
PopupMenuItem(
child: Text(tr("Stop streaming")),