1.4.8
[鈭歖 Flutter (Channel stable, v1.9.1+hotfix.4, on Microsoft Windows [Versione 10.0.18362.388], locale it-IT)
[鈭歖 Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] Android Studio (version 3.4)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[鈭歖 VS Code (version 1.38.1)
[鈭歖 VS Code, 64-bit edition
[鈭歖 Connected device (1 available)
Android
Play the audio file
Gives PlatformException
Emulator
This is my code:
void startPlayer() async {
print(_filePath);
String path = await flutterSound.startPlayer(_filePath);
await flutterSound.setVolume(1.0);
try {
_playerSubscription = flutterSound.onPlayerStateChanged.listen((e) {
if (e != null) {
sliderCurrentPosition = e.currentPosition;
maxDuration = e.duration;
DateTime date = new DateTime.fromMillisecondsSinceEpoch(
e.currentPosition.toInt(),
);
String txt = DateFormat('mm:ss:SS', "it_IT").format(date);
this.setState(() {
this._playerTxt = txt.substring(0, 8);
if (_isPlaying == false) {
_isPlaying = true;
}
});
} else {
this.setState(() {
_isPlaying = false;
});
}
});
} catch (e) {}
}
It could be that the problem is the custom path that is passed as parameter in _flutterSound.startPlayer()?
This is the exception when i press on the button that fire my callback startPlayer (code above):
[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Exception: PlatformException(ERR_UNKNOWN, ERR_UNKNOWN, Prepare failed.: status=0x1)
E/flutter (15855): #0 FlutterSound.startPlayer
package:flutter_sound/flutter_sound.dart:18
Tell me if I have to give you more info.
Could you also try the example project and compare the differences?
I tried to reproduce the same issue on your example project and I found the "problem", my file path contained colon and blank spaces, these caused the exception. So, I replaced them with underscore and now works properly in both project.
Sounds great! I'll close the issue now~
Thank you for the suggestion. Have a good day.
I tried to reproduce the same issue on your example project and I found the "problem", my file path contained colon and blank spaces, these caused the exception. So, I replaced them with underscore and now works properly in both project.
This needs to be in the docs!
Most helpful comment
I tried to reproduce the same issue on your example project and I found the "problem", my file path contained colon and blank spaces, these caused the exception. So, I replaced them with underscore and now works properly in both project.