diff --git a/example/lib/pages/room.dart b/example/lib/pages/room.dart index f1820c6..bc05a44 100644 --- a/example/lib/pages/room.dart +++ b/example/lib/pages/room.dart @@ -32,7 +32,9 @@ class _RoomPageState extends State { @override void initState() { super.initState(); + // add callback for a `RoomEvent` as opposed to a `ParticipantEvent` widget.room.addListener(_onRoomDidUpdate); + // add callbacks for finer grained events _setUpListeners(); _sortParticipants(); WidgetsBindingCompatible.instance?.addPostFrameCallback((_) { @@ -53,6 +55,7 @@ class _RoomPageState extends State { super.dispose(); } + /// for more information, see [event types](https://docs.livekit.io/client/events/#events) void _setUpListeners() => _listener ..on((event) async { if (event.reason != null) { @@ -61,6 +64,11 @@ class _RoomPageState extends State { WidgetsBindingCompatible.instance ?.addPostFrameCallback((timeStamp) => Navigator.pop(context)); }) + ..on((event) { + print('Participant event'); + // sort participants on many track events as noted in documentation linked above + _sortParticipants(); + }) ..on((event) { context.showRecordingStatusChangedDialog(event.activeRecording); }) diff --git a/lib/src/options.dart b/lib/src/options.dart index 677e7ee..133d96d 100644 --- a/lib/src/options.dart +++ b/lib/src/options.dart @@ -16,6 +16,9 @@ class TrackOption { const TrackOption({this.enabled, this.track}); } +/// This will enable the local participant to publish tracks on connect, +/// instead of having to explicitly publish them. +/// Defaults to false for all three tracks: microphone, camera, and screen. class FastConnectOptions { FastConnectOptions({ this.microphone = const TrackOption(enabled: false),