Looks like extractWaveformData in WaveformExtractionController gets stuck when using await
Describe the bug The callbacks onCurrentExtractedWaveformData and onExtractionProgress are working as expected, but when using await on extractWaveformData(), it neither throws an error nor returns — it just gets stuck To Reproduce
final waveformExtraction = WaveformExtractionController();
final style = PlayerWaveStyle(waveThickness: 0.5, spacing: 1);
final samples = style.getSamplesForWidth(5 * duration * 2);
try {
waveformExtraction.onCurrentExtractedWaveformData.listen((data) {
debugLog("data: $data");
}); // Provides latest data while extracting the waveforms.
waveformExtraction.onExtractionProgress.listen((progress) {
debugLog("progress: $progress");
}); // Provides progress of the waveform extractions.
final waveformData = await waveformExtraction.extractWaveformData(
path: path,
noOfSamples: samples,
);
debugLog("waveformData: $waveformData");
} catch (e, stackTrace) {
debugLog("error: $e");
debugLog("stackTrace: $stackTrace");
}
Expected behavior Make sure extractWaveformData returns correctly after finishing
Smartphone (please complete the following information):
- Device: [iPhone 16 Pro]
- OS: [iOS18.4]
- audio_waveforms branch: main
- Flutter version 3.29.2 on channel stable
- Dart version 3.7.2
Hello, new version available when with this issue fixed?
The extracting waveform is asynchronous process and it handled via call back in native so it looks like the result is never getting back to flutter because function's scope is over.
@gunatitsolutions
Hello, new version available when with this issue fixed?
We can not estimate timeline but you can use onCurrentExtractedWaveformData in combination with onExtractionProgress as workaround for now
That method takes too long. How can we get wavedata quickly? video
+1
That method takes too long. How can we get wavedata quickly? video
@inamhusain Since waveform extraction happens on device, it depends on platform, size of the audio file, and how powerful device is. In general ios should be faster than android.