1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-26 14:59:22 +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 /// @author Pierre Hubert
enum _PopupMenuOption { STOP_STREAMING } enum _PopupMenuOption { STOP_STREAMING, SWITCH_CAMERA }
class CallScreen extends StatefulWidget { class CallScreen extends StatefulWidget {
final int convID; final int convID;
@ -393,6 +393,11 @@ class _CallScreenState extends SafeState<CallScreen> {
/// Handles menu selection /// Handles menu selection
void _handleSelectedMenuOption(_PopupMenuOption option) async { void _handleSelectedMenuOption(_PopupMenuOption option) async {
switch (option) { switch (option) {
// Switch camera
case _PopupMenuOption.SWITCH_CAMERA:
await _localStream.getVideoTracks()[0].switchCamera();
break;
// Stop streaming // Stop streaming
case _PopupMenuOption.STOP_STREAMING: case _PopupMenuOption.STOP_STREAMING:
await _stopStreaming(); await _stopStreaming();
@ -534,6 +539,12 @@ class _CallScreenState extends SafeState<CallScreen> {
Expanded( Expanded(
child: PopupMenuButton<_PopupMenuOption>( child: PopupMenuButton<_PopupMenuOption>(
itemBuilder: (c) => [ itemBuilder: (c) => [
// Switch camera
PopupMenuItem(
enabled: isStreamingVideo,
child: Text(tr("Switch camera")),
value: _PopupMenuOption.SWITCH_CAMERA),
// Interrupt streaming // Interrupt streaming
PopupMenuItem( PopupMenuItem(
child: Text(tr("Stop streaming")), child: Text(tr("Stop streaming")),