MiniAudioPlayer class

A Flutter widget for playing audio streams with optional waveform visualization.

The MiniAudioPlayer widget plays an audio stream and can display visual audio waveforms to indicate active audio levels. It monitors audio decibels, participant status, and room configurations, providing real-time visual feedback based on audio activity.

This widget supports functionalities such as muting/unmuting, waveform display toggling, updating audio decibels, and managing audio activity for participants in breakout rooms.

Parameters:

  • options: An instance of MiniAudioPlayerOptions containing:
    • stream: A MediaStream object representing the audio stream.
    • consumer: A Consumer object for managing audio consumers.
    • remoteProducerId: The ID of the audio producer.
    • parameters: An instance of MiniAudioPlayerParameters with participant and room data.
    • miniAudioComponent: A function that returns a widget for audio visualization (e.g., a waveform).
    • miniAudioProps: Additional properties for customizing the audio component.

Example Usage:

// Define options for MiniAudioPlayer
final miniAudioPlayerOptions = MiniAudioPlayerOptions(
  stream: myMediaStream,
  consumer: myConsumer,
  remoteProducerId: 'audio123',
  parameters: myAudioPlayerParameters,
  miniAudioComponent: (props) => MyWaveformWidget(props),
  miniAudioProps: {
    'waveColor': Colors.blue,
    'backgroundColor': Colors.grey[200],
  },
);

// Use MiniAudioPlayer widget in the UI
MiniAudioPlayer(options: miniAudioPlayerOptions);

This example sets up MiniAudioPlayer with an audio stream, participant details, and a custom miniAudioComponent to display waveforms based on the audio activity.

Inheritance

Constructors

MiniAudioPlayer({Key? key, required MiniAudioPlayerOptions options})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
options MiniAudioPlayerOptions
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _MiniAudioPlayerState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited