Closed naveeez10 closed 8 months ago
I think that file was somehow deleted from the cache directory. getSingleObject
method has the check for this condition, but it's not there in the getSingleFile
method. I'll fix the issue soon.
Fixed in #17. Thanks for the issue report.
thanks for the quick fix!
In our app we encountered an issue where a video stored on Firebase Storage would not play if it wasn't already cached locally. Instead of fetching and playing the video from the server, the app would display a black screen and log a "file not found" exception.
Here are the error logs for reference:
The error logs :
E/ExoPlayerImplInternal(12046): at android.os.Looper.loopOnce(Looper.java:201) E/ExoPlayerImplInternal(12046): at android.os.Looper.loop(Looper.java:288) E/ExoPlayerImplInternal(12046): at android.os.HandlerThread.run(HandlerThread.java:67) E/ExoPlayerImplInternal(12046): Caused by: com.google.android.exoplayer2.upstream.FileDataSource$FileDataSourceException: java.io.FileNotFoundException: /data/user/0/jp.smartbooks.kodomamo.parentapp/cache/flutter_cached_image/81361b96-0d8b-5910-a5be-251b14dd9261.mp4: open failed: ENOENT (No such file or directory) E/ExoPlayerImplInternal(12046): at com.google.android.exoplayer2.upstream.FileDataSource.openLocalFile(FileDataSource.java:203) E/ExoPlayerImplInternal(12046): at com.google.android.exoplayer2.upstream.FileDataSource.open(FileDataSource.java:114) E/ExoPlayerImplInternal(12046): at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:263) E/ExoPlayerImplInternal(12046): at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:84) E/ExoPlayerImplInternal(12046): at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1005) E/ExoPlayerImplInternal(12046): at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:412) E/ExoPlayerImplInternal(12046): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) E/ExoPlayerImplInternal(12046): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) E/ExoPlayerImplInternal(12046): at java.lang.Thread.run(Thread.java:1012) E/ExoPlayerImplInternal(12046): Caused by: java.io.FileNotFoundException: /data/user/0/jp.smartbooks.kodomamo.parentapp/cache/flutter_cached_image/81361b96-0d8b-5910-a5be-251b14dd9261.mp4: open failed: ENOENT (No such file or directory) E/ExoPlayerImplInternal(12046): at libcore.io.IoBridge.open(IoBridge.java:574) E/ExoPlayerImplInternal(12046): at java.io.RandomAccessFile.To address this problem, we implemented a manual check to determine whether the video was already cached. If it was not found in the cache, we would explicitly set the source to
Source.server
. Conversely, if the video was cached, we usedSource.cacheServer
. This solution successfully resolved the playback issue.