better docs

This commit is contained in:
talksik
2023-07-13 13:12:20 -07:00
parent 49f22057f4
commit 42c529acd0
2 changed files with 11 additions and 0 deletions
+8
View File
@@ -32,7 +32,9 @@ class _RoomPageState extends State<RoomPage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
// add callback for a `RoomEvent` as opposed to a `ParticipantEvent`
widget.room.addListener(_onRoomDidUpdate); widget.room.addListener(_onRoomDidUpdate);
// add callbacks for finer grained events
_setUpListeners(); _setUpListeners();
_sortParticipants(); _sortParticipants();
WidgetsBindingCompatible.instance?.addPostFrameCallback((_) { WidgetsBindingCompatible.instance?.addPostFrameCallback((_) {
@@ -53,6 +55,7 @@ class _RoomPageState extends State<RoomPage> {
super.dispose(); super.dispose();
} }
/// for more information, see [event types](https://docs.livekit.io/client/events/#events)
void _setUpListeners() => _listener void _setUpListeners() => _listener
..on<RoomDisconnectedEvent>((event) async { ..on<RoomDisconnectedEvent>((event) async {
if (event.reason != null) { if (event.reason != null) {
@@ -61,6 +64,11 @@ class _RoomPageState extends State<RoomPage> {
WidgetsBindingCompatible.instance WidgetsBindingCompatible.instance
?.addPostFrameCallback((timeStamp) => Navigator.pop(context)); ?.addPostFrameCallback((timeStamp) => Navigator.pop(context));
}) })
..on<ParticipantEvent>((event) {
print('Participant event');
// sort participants on many track events as noted in documentation linked above
_sortParticipants();
})
..on<RoomRecordingStatusChanged>((event) { ..on<RoomRecordingStatusChanged>((event) {
context.showRecordingStatusChangedDialog(event.activeRecording); context.showRecordingStatusChangedDialog(event.activeRecording);
}) })
+3
View File
@@ -16,6 +16,9 @@ class TrackOption<E extends Object, T extends Object> {
const TrackOption({this.enabled, this.track}); 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 { class FastConnectOptions {
FastConnectOptions({ FastConnectOptions({
this.microphone = const TrackOption(enabled: false), this.microphone = const TrackOption(enabled: false),