VoiceController class

A controller for managing voice playback.

The VoiceController class provides functionality for playing, pausing, stopping, and seeking voice playback. It uses the just_audio package for audio playback. The controller also supports changing the playback speed and provides UI updates through a ValueNotifier.

Example usage:

VoiceController voiceController = VoiceController(
  audioSrc: 'path/to/audio.mp3',
  maxDuration: Duration(minutes: 5),
  isFile: true,
  onComplete: () {
  },
  onPause: () {
  },
  onPlaying: () {
  },
);
Inheritance

Constructors

VoiceController({required String audioSrc, required Duration maxDuration, required bool isFile, required dynamic onComplete(), required dynamic onPause(), required dynamic onPlaying(), int noiseCount = 24, dynamic onError(Object)?, List<double>? randoms, String? cacheKey})
Creates a new VoiceController instance.

Properties

animController AnimationController
getter/setter pair
audioSrc String
final
cacheKey String?
final
currentDuration Duration
getter/setter pair
currentMillSeconds double
Gets the current playback position of the voice.
no setter
downloadProgress double?
getter/setter pair
downloadStreamSubscription StreamSubscription<FileResponse>?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isDownloadError bool
no setter
isDownloading bool
no setter
isFile bool
final
isInit bool
no setter
isPause bool
no setter
isPlaying bool
no setter
isSeeking bool
getter/setter pair
isStop bool
no setter
maxDuration Duration
getter/setter pair
maxMillSeconds double
no setter
noiseCount int
final
noiseWidth double
final
onComplete → dynamic Function()
final
onError → dynamic Function(Object)?
final
onPause → dynamic Function()
final
onPlaying → dynamic Function()
final
playerStateStream StreamSubscription?
getter/setter pair
playStatus ↔ PlayStatus
getter/setter pair
positionStream StreamSubscription?
getter/setter pair
randoms List<double>?
getter/setter pair
remindingTime String
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
speed ↔ PlaySpeed
getter/setter pair
updater ValueNotifier
getter/setter pair

Methods

cancelDownload() → void
changeSpeed() → void
Changes the speed of the voice playback.
createTicker(TickerCallback onTick) Ticker
Creates a new ticker.
inherited
dispose() Future<void>
init() Future
Initializes the voice controller.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onChangeSliderStart(double value) → void
Changes the speed of the voice playback.
onChanging(double d) → void
Changes the speed of the voice playback.
onSeek(Duration duration) → void
Seeks to the given duration.
pausePlaying() → void
Pauses the voice playback.
play() Future
setMaxDuration(String path) Future
Sets the maximum duration of the voice.
startPlaying(String path) Future
Starts playing the voice.
stopPlaying() → void
toString() String
A string representation of this object.
inherited

Operators

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