1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-23 05:19:22 +00:00

Can interrupt local streaming

This commit is contained in:
Pierre HUBERT 2020-04-21 18:20:24 +02:00
parent e5ccedd180
commit 8609e4e169

View File

@ -20,6 +20,8 @@ import 'package:flutter_webrtc/webrtc.dart';
/// ///
/// @author Pierre Hubert /// @author Pierre Hubert
enum _PopupMenuOption { STOP_STREAMING }
class CallScreen extends StatefulWidget { class CallScreen extends StatefulWidget {
final int convID; final int convID;
@ -345,6 +347,15 @@ class _CallScreenState extends SafeState<CallScreen> {
}); });
} }
/// Handles menu selection
void _handleSelectedMenuOption(_PopupMenuOption option) {
switch (option) {
case _PopupMenuOption.STOP_STREAMING:
_stopStreaming();
break;
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -473,6 +484,20 @@ class _CallScreenState extends SafeState<CallScreen> {
: Icons.videocam_off), : Icons.videocam_off),
onPressed: () => _toggleStreaming(true), onPressed: () => _toggleStreaming(true),
), ),
// Interrupt local streaming
Expanded(
child: PopupMenuButton<_PopupMenuOption>(
itemBuilder: (c) => [
// Interrupt streaming
PopupMenuItem(
child: Text(tr("Stop streaming")),
value: _PopupMenuOption.STOP_STREAMING)
],
icon: Icon(Icons.menu),
onSelected: (d) => _handleSelectedMenuOption(d),
),
)
], ],
), ),
); );