Open fabiojansenbr opened 7 months ago
did you find solution ?
Any update on this? i am also facing the same issue
Same issue but with ByteSource: Flutter 3.19.5 audioplayers 6.0.0 iOS: 17.4
"PlatformException (PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl: Unknown error, null))"
I'm encountering the same error: PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://TROUBLESHOOTING_GUIDE, AVPlayerItem.Status.failed on setSourceUrl: Unknown error, null)
This issue occurs when I attempt to play audio using BytesSource
on iOS. Working on Android, but failing on iOS.
Flutter 3.19.6 audioplayers 6.0.0 iOS: 17.4
@novas1r1 Have you found any solution?
@narendra-vaniya nope, sorry. I switched to soundpool
You may can add some files in order to have a chance to reproduce the problem. Best regards.
@narendra-vaniya nope, sorry. I switched to soundpool
Thank @novas1r1
I've found a solution, we must provide the mimeType.
Sample.
await _audioPlayer.play(
BytesSource(bytes, mimeType: 'audio/mp3'),
);
It would be nice to handle this case directly within the BytesSource class if the mimeType is empty.
I am having a similar issue but it seems to be kind of random. I made this change f15b414135039b72760a908b95c01aa8c9da6422 so I can see the error.
AudioPlayers Exception: AudioPlayerException(
AssetSource(path: sounds/pop.wav, mimeType: null),
PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl: Error Domain=AVFoundationErrorDomain Code=-11819 "Cannot Complete Action" UserInfo={NSLocalizedDescription=Cannot Complete Action, NSLocalizedRecoverySuggestion=Try again later.}, null)<…>
The error is: Error Domain=AVFoundationErrorDomain Code=-11819 "Cannot Complete Action" UserInfo={NSLocalizedDescription=Cannot Complete Action, NSLocalizedRecoverySuggestion=Try again later.
The code I used is loading about 30 tracks using this code, but the issue does not always occur.
_audioContext =AudioContextConfig(respectSilence: Platform.isIOS).build();
var player = AudioPlayer();
await player.setReleaseMode(ReleaseMode.stop);
await player.setAudioContext(_audioContext);
await player.setVolume(volume);
await player.setSource(AssetSource('sounds/$filePath'));
Checklist
Current bug behaviour
Im getting this error when try to play audio on IOS only in a physical device. On simulator works fine.
Runner(Flutter)[4087]: DeviceFileSource(path: /var/mobile/Containers/Data/Application/387E8E16-458F-4F36-80AB-C2152228C985/Documents/audios/audio17120075.m4a), Apr 1 20:40:44 Runner(Flutter)[4087] : PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl, null)<\M-b\M^@\M-
Expected behaviour
The audio should play properly
Steps to reproduce
flutter run
on the code sampleCode sample
Code sample
```dart void main() { } ```Affected platforms
iOS
Platform details
No response
AudioPlayers Version
5.2.1
Build mode
No response
Audio Files/URLs/Sources
No response
Screenshots
No response
Logs
Full Logs
``` my full logs or a link to a gist ``` Flutter doctor: ``` Output of: flutter doctor -v ```Related issues / more information
No response
Working on PR
no way