Skip to content

Commit 77bad79

Browse files
Merge pull request #28 from SimformSolutionsPvtLtd/feature/new-example-update
📝 updated example app 🐛 fixed stream would not re-initialise
2 parents f568d88 + 6164c66 commit 77bad79

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

example/lib/main.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
4242
String? path;
4343
String? musicFile;
4444
bool isRecording = false;
45-
late Directory tempDir;
45+
late Directory appDirectory;
4646

4747
@override
4848
void initState() {
@@ -52,9 +52,9 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
5252
}
5353

5454
void _getDir() async {
55-
tempDir = await getApplicationDocumentsDirectory();
55+
appDirectory = await getApplicationDocumentsDirectory();
5656
_preparePlayers();
57-
path = "${tempDir.path}/music.aac";
57+
path = "${appDirectory.path}/music.aac";
5858
}
5959

6060
Future<ByteData> _loadAsset(String path) async {
@@ -95,25 +95,25 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
9595

9696
void _preparePlayers() async {
9797
///audio-1
98-
final file1 = File('${tempDir.path}/audio1.mp3');
98+
final file1 = File('${appDirectory.path}/audio1.mp3');
9999
await file1.writeAsBytes(
100100
(await _loadAsset('assets/audios/audio1.mp3')).buffer.asUint8List());
101101
playerController1.preparePlayer(file1.path);
102102

103103
///audio-2
104-
final file2 = File('${tempDir.path}/audio2.mp3');
104+
final file2 = File('${appDirectory.path}/audio2.mp3');
105105
await file2.writeAsBytes(
106106
(await _loadAsset('assets/audios/audio2.mp3')).buffer.asUint8List());
107107
playerController2.preparePlayer(file2.path);
108108

109109
///audio-3
110-
final file3 = File('${tempDir.path}/audio3.mp3');
110+
final file3 = File('${appDirectory.path}/audio3.mp3');
111111
await file3.writeAsBytes(
112112
(await _loadAsset('assets/audios/audio3.mp3')).buffer.asUint8List());
113113
playerController3.preparePlayer(file3.path);
114114

115115
///audio-4
116-
final file4 = File('${tempDir.path}/audio4.mp3');
116+
final file4 = File('${appDirectory.path}/audio4.mp3');
117117
await file4.writeAsBytes(
118118
(await _loadAsset('assets/audios/audio4.mp3')).buffer.asUint8List());
119119
playerController4.preparePlayer(file4.path);

lib/src/audio_file_waveforms.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class _AudioFileWaveformsState extends State<AudioFileWaveforms>
185185
waveCap: widget.playerWaveStyle.waveCap,
186186
showBottom: widget.playerWaveStyle.showBottom,
187187
showTop: widget.playerWaveStyle.showTop,
188-
waveThickness: widget.playerWaveStyle.waveThickness,
188+
waveThickness: widget.playerWaveStyle.waveThickness,
189189
animValue: _animProgress,
190190
),
191191
size: widget.size,

0 commit comments

Comments
 (0)