Skip to content

Commit eb7cd99

Browse files
authored
Improve visualizer docs (#48)
1 parent 0c1420a commit eb7cd99

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

.changes/audio-visualizer-docs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
patch type="docs" "Add AudioVisualizerWidget documentation"

lib/src/ui/widgets/track/audio_visualizer_widget.dart

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import '../../../context/track_reference_context.dart';
1111

1212
enum VisualizerState { thinking, listening, active }
1313

14+
/// Configuration options for [AudioVisualizerWidget].
15+
///
16+
/// These options control the number of bars, sizing, animation cadence, and
17+
/// styling used to render a simple audio spectrum / agent-state indicator.
1418
class AudioVisualizerWidgetOptions {
1519
final int barCount;
1620
final bool centeredBands;
@@ -77,6 +81,24 @@ class AudioVisualizerWidget extends StatelessWidget {
7781
final AudioVisualizerWidgetOptions options;
7882
final Color backgroundColor;
7983

84+
/// Renders an animated bar visualizer for the current audio track.
85+
///
86+
/// The widget consumes a [TrackReferenceContext] from the widget tree to
87+
/// discover the `sdk.AudioTrack` and associated `sdk.Participant`. When the
88+
/// participant is an agent, the visualizer also reacts to agent state changes:
89+
///
90+
/// - `thinking`: highlights bars in sequence.
91+
/// - `initializing` / `listening`: renders a subtle "listening" pulse.
92+
/// - otherwise: uses live audio samples when available.
93+
///
94+
/// Example:
95+
/// ```dart
96+
/// ParticipantTrack(
97+
/// participant: participant,
98+
/// track: publication,
99+
/// builder: (context) => const AudioVisualizerWidget(),
100+
/// );
101+
/// ```
80102
const AudioVisualizerWidget({
81103
Key? key,
82104
this.backgroundColor = Colors.transparent,

0 commit comments

Comments
 (0)