mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 04:04:18 +00:00 
			
		
		
		
	Can switch camera
This commit is contained in:
		@@ -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")),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user