Session migration (#72)

* impl

* retry logic

* simulate

* pass checks

* adjust log level

* retry condition

* fix simulate scenario params

* format

* use `RTCPeerConnectionState` instead of `RTCIceConnectionState`

* adjust retry

* additional check for completer

* more logging

* fix id

* pub

* change package

* doc update

* retry tests

* format

* apply suggestions
This commit is contained in:
Hiroshi Horie
2022-01-25 00:53:18 +07:00
committed by GitHub
parent 3d37f4491d
commit 224047c31f
25 changed files with 575 additions and 275 deletions
+21
View File
@@ -154,4 +154,25 @@ extension LKExampleExt on BuildContext {
],
),
);
Future<SimulateScenarioResult?> showSimulateScenarioDialog() =>
showDialog<SimulateScenarioResult>(
context: this,
builder: (ctx) => SimpleDialog(
title: const Text('Simulate Scenario'),
children: SimulateScenarioResult.values
.map((e) => SimpleDialogOption(
child: Text(e.name),
onPressed: () => Navigator.pop(ctx, e),
))
.toList(),
),
);
}
enum SimulateScenarioResult {
nodeFailure,
migration,
serverLeave,
clear,
}
+1 -2
View File
@@ -2,10 +2,9 @@ import 'package:flutter/material.dart';
import 'package:livekit_example/theme.dart';
import 'package:logging/logging.dart';
import 'package:intl/intl.dart';
import 'pages/connect.dart';
void main() {
void main() async {
final format = DateFormat('HH:mm:ss');
// configure logs for debugging
Logger.root.level = Level.FINE;
+17
View File
@@ -149,6 +149,18 @@ class _ControlsWidgetState extends State<ControlsWidget> {
}
}
void _onTapSimulateScenario() async {
final result = await context.showSimulateScenarioDialog();
if (result != null) {
print('${result}');
await widget.room.simulateScenario(
nodeFailure: result == SimulateScenarioResult.nodeFailure ? true : null,
migration: result == SimulateScenarioResult.migration ? true : null,
serverLeave: result == SimulateScenarioResult.serverLeave ? true : null,
);
}
}
void _onTapSendData() async {
final result = await context.showSendDataDialog();
if (result == true) {
@@ -238,6 +250,11 @@ class _ControlsWidgetState extends State<ControlsWidget> {
icon: const Icon(EvaIcons.settings2),
tooltip: 'Subscribe permission',
),
IconButton(
onPressed: _onTapSimulateScenario,
icon: const Icon(EvaIcons.alertTriangle),
tooltip: 'Simulate scenario',
),
],
),
);
+36 -15
View File
@@ -50,6 +50,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.1"
dart_webrtc:
dependency: transitive
description:
@@ -84,7 +91,7 @@ packages:
name: device_info_plus_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.3.0+1"
device_info_plus_web:
dependency: transitive
description:
@@ -184,6 +191,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.0"
http:
dependency: transitive
description:
@@ -338,13 +352,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
platform_detect:
dependency: transitive
description:
name: platform_detect
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
plugin_platform_interface:
dependency: transitive
description:
@@ -373,13 +380,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.2"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
shared_preferences:
dependency: "direct main"
description:
@@ -497,6 +497,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
universal_html:
dependency: transitive
description:
name: universal_html
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
universal_io:
dependency: transitive
description:
name: universal_io
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
uuid:
dependency: transitive
description:
@@ -511,6 +525,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
web_browser_detect:
dependency: transitive
description:
name: web_browser_detect
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
webrtc_interface:
dependency: transitive
description: