InnerTune
InnerTune copied to clipboard
Downloads wont play
Checklist
- [X] I am able to reproduce the bug with the latest version.
- [X] I've checked that there is no issue about this bug.
- [X] This issue contains only one bug.
- [X] The title of this issue accurately describes the bug.
Steps to reproduce the bug
Download a song After a while the downloads won't play
Expected behavior
Downloads should play and work all the time.
Actual behavior
After a while my downloads will not play and have to redownload them all but happens again.
Screenshots/Screen recordings
https://user-images.githubusercontent.com/96526481/174396431-bcddd90b-4f64-42ca-9a3d-559f3b7e9b11.mp4
Logs
Unable to provide as waiting on a new pc hope someone has the same issue
Music version
0.3 1
Android version
Android 12
Additional information
If no one has this issue I'll send a log as soon as my new computer arrives thanks
Go to /Android/data/com.zionhuang.music/files/media
and if there are files. Then copy them out, add .mp3
suffix, and open them with a music player. This will check if the downloaded media is valid.
Just checked I'm on samsung and the file explorer doesn't show a lot of android data files I think samsung is giving up on there file explorer lol so I had to download Google file explorer instead but it's saying I have 15 songs in the files but actually iv downloaded 99 songs so some reason something is deleting my songs even tho I keep having download them all again and again.
As u can see I have 99 songs that say there all downloaded and apparently all I have is what's in the file explorer which is only 14
How often does this happen? i.e. How long between the time that you downloaded the songa and the songs were deleted?
Can happen the same day it randomly starts to play up or over time but not sure if it's doing it when I'm not on the app to but yeah iv had to redownload my songs everyday dude but doesn't last long till 1 by 1 they start to do it again mate
Kinda hard to say how long it does it as newer music I download works but like 90% of my downloaded music isn't working π
Let's see if other people have the same issue.
No worries mate its definitely confusing and hope someone has the same issue
I have the same problem with my galaxy a8. after a certain time, downloads will no longer be played. I can then remove it and download it again but after a while the problem comes back and the process starts all over again.
I'm glad I'm not the only one haha hopefully this can be a easy and quick fix
Are u able to provide a log file for this issue mate as its driving crazy haha
I can reproduce this as well. @Alliba described it perfectly.
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: Playback error
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: com.google.android.exoplayer2.ExoPlaybackException: Sourceerror
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:5)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:39)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at android.os.Handler.dispatchMessage(Handler.java:102)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at android.os.Looper.loop(Looper.java:223)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at android.os.HandlerThread.run(HandlerThread.java:67)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: Caused by: com.google.android.exoplayer2.upstream.FileDataSource$FileDataSourceException: java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.zionhuang.music/files/media/69d5e05e155c7117cf377f0a9363916d: open failed: ENOENT (No such file or directory)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at com.google.android.exoplayer2.upstream.FileDataSource.open(FileDataSource.java:20)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:60)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at com.google.android.exoplayer2.upstream.ResolvingDataSource.open(ResolvingDataSource.java:5)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:3)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:4)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:6)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at java.lang.Thread.run(Thread.java:923)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: Caused by: java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.zionhuang.music/files/media/69d5e05e155c7117cf377f0a9363916d: open failed: ENOENT (No such fileor directory)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at libcore.io.IoBridge.open(IoBridge.java:492)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at java.io.RandomAccessFile.<init>(RandomAccessFile.java:289)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at java.io.RandomAccessFile.<init>(RandomAccessFile.java:152)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at com.google.android.exoplayer2.upstream.FileDataSource.open(FileDataSource.java:6)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: ... 8 more
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at libcore.io.Linux.open(Native Method)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7584)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: at libcore.io.IoBridge.open(IoBridge.java:478)
06-29 18:27:45.248 2792 7798 E ExoPlayerImplInternal: ... 11 more
Managed to get the exception that is occurring when the song is being played. But nothing surprising here just File Not Found exception. Something else is deleting the songs.
The file name (/storage/emulated/0/Android/data/com.zionhuang.music/files/media/69d5e05e155c7117cf377f0a9363916d
) looks weird though, maybe that's the reason?
Edit: I am running Android 11 with Stock Android
The file name (/storage/emulated/0/Android/data/com.zionhuang.music/files/media/69d5e05e155c7117cf377f0a9363916d) looks weird though, maybe that's the reason?
The file name is the md5 hash of the song id.
I'll use another phone to test.
Had any issues on this been found π
Not yet. I tested on an Android 11 Xiaomi phone and an Android 10 Samsung phone, and didn't find downloaded files missing. Hope if any developer who has this issue can help me figure out the cause.
Is it possible to do with permissions as there isn't any and maybe android 12 is removing the files
Feels like a android 12 feature that's cleaning my device to free up storage and that's causing them files to be deleted ill be checking to see if I can change something for the app
@owencz1998 I am on Android 11 and have lots of storage. Android won't delete it, since the songs are saved as User data.
One thing I noticed is that Album art is saved but only songs are getting deleted.
https://github.com/z-huang/music/blob/6ca40149a01e047d3bf3673b168c255ca1b58f7f/app/src/main/java/com/zionhuang/music/repos/SongRepository.kt#L116-L118
@z-huang Isn't this supposed to work when the songs are loaded? If this works, we can at least see exactly when the song is deleted.
EDIT:
My bad. Looks like there is no check of whether the song actually exists when the app is loaded. All the entries are just fetched from the local DB. I think it would be wise to make some checks before displaying the songs.
So for downloading the songs, the app is using Android's download manager service, which has had some changes in API 29 (Android 10).
The problem is occurring because Android's DownloadIdleService deletes the files that are not visible in the Downloads UI. Here's a stack-overflow issue describing the problem: https://stackoverflow.com/questions/46501822/downloaded-files-get-deleted-automatically
In the code, setVisibleInDownloadsUi
is set to false and it is also deprecated on API 29 and above. Which means Android 29 or higher will automatically delete files after some time.
Also found this javadoc for .setDestinationUri
function
@bacteriostat nice work hope this is the exact problem πnice job
I was close with saying the system is deleting the music π€£π€£I'm new to this and learning the coding side but your knowledge is brilliant @bacteriostat
I was close with saying the system is deleting
Yeah you were right. I am working on a solution. Been years since I touched Android development, so finding a little hard.
Nice one man π
@bacteriostat Thanks for your research! So, a quick fix is to rename the file after download completes. But eventually, I'll discard Android download manager and create a download service for #13.
@z-huang I am not so familiar with the code base so not able to figure out file renaming. You can go ahead with the change if it is easy to implement.