flutter_sound
flutter_sound copied to clipboard
ui_dart_state.cc(199)] Unhandled Exception: PlatformException(Audio Player, startPlayer failure, null, null)
Flutter Sound Version : 8.3.9
-
FULL or LITE flavor ? FULL
-
Important: Result of the command :
flutter pub deps | grep flutter_sound
Severity
- Crash ? yes
Platforms you faced the error
- iOS ? iphone x ios 14.7.1
Describe the bug
ui_dart_state.cc(199)] Unhandled Exception: PlatformException(Audio Player, startPlayer failure, null, null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:597:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
To Reproduce Steps to reproduce the behavior: Click on 'startPlayer'
Logs!!!!
(This is very important. Most of the time we cannot do anything if we do not have information on your bug).
ui_dart_state.cc(199)] Unhandled Exception: PlatformException(Audio Player, startPlayer failure, null, null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:597:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
same issue in android
Check :
- What is the file that you try to play
- What is its extension
- What is the codec that you specified to startPlayer()
@Larpoux what should be a codec for video picked from iOS device ?
Check :
- What is the file that you try to play
- What is its extension
- What is the codec that you specified to startPlayer()
i faced issue on real ios device only. extension: .aac codec: Codec.aacADTS file: /var/mobile/Containers/Data/Application/8E613239-E966-4244-B5AD-832263CBB5E6/Library/Caches/12323123.aac
I am not sure that /var/mobile/Containers/Data/Application/8E613239-E966-4244-B5AD-832263CBB5E6/Library/Caches/12323123.aac is in your sandbox
I am not sure that /var/mobile/Containers/Data/Application/8E613239-E966-4244-B5AD-832263CBB5E6/Library/Caches/12323123.aac is in your sandbox
what to do then? Any reccomendations?
Most of the time you must call the flutter plugin 'path_provider' to get a correct path where you can store or read your files.
Most of the time you must call the flutter plugin 'path_provider' to get a correct path where you can store or read your files.
tempDir = await getTemporaryDirectory();
this is the directory of the file where I uses pathprovider
That's correct.
But 'var/mobile/Containers/Data/Application/8E613239-E966-4244-B5AD-832263CBB5E6/Library/Caches/12323123.aac' seems to be a path for an ios emulator, not a correct path for a real device
I am using real device and nothing work for playing. This path is from real device var/mobile/Containers/Data/Application/8E613239-E966-4244-B5AD-832263CBB5E6/Library/Caches/12323123.aac
tempDir = await getTemporaryDirectory();
log(tempDir!.path.toString());
PermissionStatus status;
try {
status = await Permission.microphone.request();
} catch (e) {
throw e;
}
log(tempDir.path.toString());
if (status != PermissionStatus.granted)
throw RecordingPermissionException("You must give acces to mic");
pathToRecord =
"${tempDir.path}/${DateTime.now().millisecondsSinceEpoch.toString()}.aac";
await flutterSoundRecorder.startRecorder(
toFile: "$pathToRecord",
codec: Codec.aacADTS,
);
playing;
play(path) async {
await flutterSoundPlayer.startPlayer(
fromURI: path,
//fromDataBuffer: bytes,
codec: Codec.aacADTS);
update();
}
Your code seems correct. I don't see. Is your player correctly open?
Yes, it works on android debug, android release and ios debug. It doesnt work only release mode on iOS.
Is there any reason you use FS 8.x and not 9.2? Do you depend on another Flutter audio plugin, than Flutter Sound?
i am using fs 9.1.8 to 9.2.2 not 8
i have the same, I copy your code in the example project (SimpleRecorder), and try to record, then play audio, but it has an error (android working), i don't change anything, please tell me how i can fix this error @Larpoux thank you. flutter_sound: ^9.2.13 ios: 15.4.1
same issue, anyone found a solution?
Execute openPlayer first and then startPlayer, and the issue will be resolved
play() async {
await flutterSoundPlayer.openPlayer()
await flutterSoundPlayer.startPlayer()
}
This issue is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days.