Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changes/audio-visualizer-docs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patch type="docs" "Add AudioVisualizerWidget documentation"
22 changes: 22 additions & 0 deletions lib/src/ui/widgets/track/audio_visualizer_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import '../../../context/track_reference_context.dart';

enum VisualizerState { thinking, listening, active }

/// Configuration options for [AudioVisualizerWidget].
///
/// These options control the number of bars, sizing, animation cadence, and
/// styling used to render a simple audio spectrum / agent-state indicator.
class AudioVisualizerWidgetOptions {
final int barCount;
final bool centeredBands;
Expand Down Expand Up @@ -77,6 +81,24 @@ class AudioVisualizerWidget extends StatelessWidget {
final AudioVisualizerWidgetOptions options;
final Color backgroundColor;

/// Renders an animated bar visualizer for the current audio track.
///
/// The widget consumes a [TrackReferenceContext] from the widget tree to
/// discover the `sdk.AudioTrack` and associated `sdk.Participant`. When the
/// participant is an agent, the visualizer also reacts to agent state changes:
///
/// - `thinking`: highlights bars in sequence.
/// - `initializing` / `listening`: renders a subtle "listening" pulse.
/// - otherwise: uses live audio samples when available.
///
/// Example:
/// ```dart
/// ParticipantTrack(
/// participant: participant,
/// track: publication,
/// builder: (context) => const AudioVisualizerWidget(),
/// );
/// ```
const AudioVisualizerWidget({
Key? key,
this.backgroundColor = Colors.transparent,
Expand Down