Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sound not found inside cache folder - app crash #1778

Open
2 tasks done
prok155 opened this issue Mar 21, 2024 · 1 comment
Open
2 tasks done

Sound not found inside cache folder - app crash #1778

prok155 opened this issue Mar 21, 2024 · 1 comment
Labels

Comments

@prok155
Copy link

prok155 commented Mar 21, 2024

Checklist

  • I read the troubleshooting guide before raising this issue
  • I made sure that the issue I am raising doesn't already exist

Current bug behaviour

I published my app to google play store, I use crashlytics and I see following stacktraces:

PlatformException(AndroidAudioError, Failed to set source. For troubleshooting, see: https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, java.io.FileNotFoundException: /data/user/0/com.companyname.myPackageName/cache/audio/AnswerCorrect.mp3: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:574) at java.io.FileInputStream.<init>(FileInputStream.java:160) at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1272) at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1243) at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1208) at ra.d.a(Unknown Source:7) at qa.m.h(Unknown Source:10) at qa.s.K(Unknown Source:15) at pa.m.L(Unknown Source:552) at pa.m.o(Unknown Source:0) at pa.m$b.b(Unknown Source:14) at pa.m$b.invoke(Unknown Source:4) at pa.m$d.invokeSuspend(Unknown Source:16) at kotlin.coroutines.jvm.internal.a.resumeWith(Unknown Source:11) at ba.y0.run(Unknown Source:93) at ga.o$a.run(Unknown Source:3) at ia.k.run(Unknown Source:2) at ia.a.R(Unknown Source:0) at ia.a$c.d(Unknown Source:14) at ia.a$c.p(Unknown Source:28) at ia.a$c.run(Unknown Source:0) Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) at libcore.io.Linux.open(Native Method) at libcore.io.ForwardingOs.open(ForwardingOs.java:563) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:274) at libcore.io.ForwardingOs.open(ForwardingOs.java:563) at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8641) at libcore.io.IoBridge.open(IoBridge.java:560) ... 20 more , null)

I have my sound files in my 'assets', but it seems that your package creates sounds files inside temp cache directory, look : java.io.FileNotFoundException: /data/user/0/com.companyname.myPackageName/cache/audio/AnswerCorrect.mp3.

Android sometimes deletes cache directory, for example when there is not enough space on the disk, you should keep those temp files inside app data directory instead of temp folder.

Expected behaviour

You should not keep temp files inside cache folder, it will fix this issue.

Steps to reproduce

  1. Execute flutter run on the code sample
  2. ...
  3. ...

Code sample

static void playSound() async { final player = AudioPlayer(); await player.play(AssetSource('audio/AnswerCorrect.mp3')); }

Affected platforms

Android

Platform details

No response

AudioPlayers Version

6.0.0

Build mode

debug, profile, release

Audio Files/URLs/Sources

No response

Screenshots

No response

Logs

my relevant 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

@prok155 prok155 added the bug label Mar 21, 2024
@prok155
Copy link
Author

prok155 commented Mar 21, 2024

If I do somthing wrong, please explain me how can I fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant