Skip to content

Commit

Permalink
update.
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwebrtc committed Oct 28, 2024
1 parent ca32ae3 commit 0bb2949
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 18 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ Use this SDK to add realtime video, audio and data features to your Flutter app.

## Introduction

LiveKit component state management is based on [provider](https://pub.dev/packages/provider), including `RoomContext`, `MediaDeviceContext`, `ParticipantContext`, `TrackContext`, and `ChatContext`. You can render components in the corresponding Context, such as `Chat`, `ParticipantLoop`, `ControlBar`, `StatusBar`, `AudioTrack`, `VideoTrack`, `Toggle Buttons`.

and you can create video conferencing, live streaming, or AI Agents apps with minimal lines of code.
LiveKit component state management is based on [provider](https://pub.dev/packages/provider), you can create video conferencing, live streaming, or AI Agents apps with minimal lines of code.

Please refer to the [flowchart](./docs/flowchart.md) for the widgets topology structure.

Expand All @@ -31,9 +29,13 @@ Add the following to your `pubspec.yaml`:

```yaml
dependencies:
livekit_components: ^0.1.0
livekit_components: ^1.0.0
```
Then run `flutter pub get`.

and follow this docs to configure your project for [iOS](https://github.com/livekit/client-sdk-flutter#ios) and [Android](https://github.com/livekit/client-sdk-flutter#android).

## Usage

Here is a simple example of how to use the components in your Flutter app:
Expand Down Expand Up @@ -80,6 +82,9 @@ class MyApp extends StatelessWidget {
/// participant builder
participantBuilder: (context) {
/// build participant widget for each Track
/// return ParticipantTileWidget for each participant
/// you can customize the widget as you want, please refer to the example
/// https://github.com/livekit/components-flutter/blob/main/example/lib/main.dart#L130-L168
return const ParticipantTileWidget();
},
),
Expand All @@ -98,6 +103,10 @@ class MyApp extends StatelessWidget {
}
```

## Example

You can find a complete example in the [example](./example) folder.

<!--BEGIN_REPO_NAV-->
<br/><table>
<thead><tr><th colspan="2">LiveKit Ecosystem</th></tr></thead>
Expand Down
24 changes: 13 additions & 11 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,18 @@ class MyHomePage extends StatelessWidget {
children: [
/// video track widget in the background
IsSpeakingIndicator(builder:
(context, isSpeaking) {
return isSpeaking != null
? IsSpeakingIndicatorWidget(
isSpeaking: isSpeaking,
child:
const VideoTrackWidget(),
)
: const VideoTrackWidget();
}),
IsSpeakingIndicator(
builder: (context, isSpeaking) {
return isSpeaking != null
? IsSpeakingIndicatorWidget(
isSpeaking:
isSpeaking,
child:
const VideoTrackWidget(),
)
: const VideoTrackWidget();
},
),

/// TODO: Add AudioTrackWidget or AgentVisualizerWidget later
Expand All @@ -154,7 +156,7 @@ class MyHomePage extends StatelessWidget {
child: FocusToggle(),
),

/// track stats at the bottom right
/// track stats at the top left
const Positioned(
top: 8,
left: 0,
Expand Down
6 changes: 3 additions & 3 deletions lib/src/ui/widgets/participant/participant_tile_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ class ParticipantTileWidget extends StatelessWidget {
child: FocusToggle(),
),

/// track stats at the bottom right
/// track stats at the top left
const Positioned(
bottom: 30,
right: 0,
top: 8,
left: 0,
child: TrackStatsWidget(),
),

Expand Down

0 comments on commit 0bb2949

Please sign in to comment.