1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-26 04:48:51 +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
enum _PopupMenuOption { STOP_STREAMING }
class CallScreen extends StatefulWidget {
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
Widget build(BuildContext context) {
return Scaffold(
@ -473,6 +484,20 @@ class _CallScreenState extends SafeState<CallScreen> {
: Icons.videocam_off),
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),
),
)
],
),
);