protocol 8. (#134)

* protocol 8.

* add FastConnectOptions.

* update.

* fix.

* Deprecated the top connect method.

* Add fast connect button in example.

* Create a Listener before connecting.

* Force protocol-v7 for deprecated APIs.

* remove commented out line.

* relative path import.

* update.
This commit is contained in:
CloudWebRTC
2022-07-11 19:54:08 +08:00
committed by GitHub
parent 66d4052ada
commit 3d8bf96651
8 changed files with 122 additions and 18 deletions
+10 -5
View File
@@ -11,9 +11,11 @@ import '../widgets/participant.dart';
class RoomPage extends StatefulWidget {
//
final Room room;
final EventsListener<RoomEvent> listener;
const RoomPage(
this.room, {
this.room,
this.listener, {
Key? key,
}) : super(key: key);
@@ -24,16 +26,19 @@ class RoomPage extends StatefulWidget {
class _RoomPageState extends State<RoomPage> {
//
List<Participant> participants = [];
late final EventsListener<RoomEvent> _listener = widget.room.createListener();
EventsListener<RoomEvent> get _listener => widget.listener;
bool get fastConnection => widget.room.engine.fastConnectOptions != null;
@override
void initState() {
super.initState();
widget.room.addListener(_onRoomDidUpdate);
_setUpListeners();
_sortParticipants();
WidgetsBindingCompatible.instance
?.addPostFrameCallback((_) => _askPublish());
WidgetsBindingCompatible.instance?.addPostFrameCallback((_) {
if (!fastConnection) {
_askPublish();
}
});
}
@override