Skip to content

CacheWriter doesn't correctly implement allowShortContent case #7326

@temq09

Description

@temq09

[REQUIRED] Searched documentation and issues

Found the article about video preloading here - https://medium.com/google-exoplayer/pre-caching-downloading-progressive-streams-in-exoplayer-3a816c75e8f6

[REQUIRED] Question

Hi! I have an issue when trying to preload the first part of a video. I don't know the exact size of the video so just trying to preload the first 800kb. In case the video is less than 800kb I get com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: java.io.EOFException even when enableEOFException==false. Is it intentional and how can I solve the issue in the application?

A full bug report captured from the device

Not a bug report, just stacktrace

     Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: java.io.EOFException
        at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.read(DefaultHttpDataSource.java:359)
        at com.google.android.exoplayer2.upstream.DefaultDataSource.read(DefaultDataSource.java:182)
        at com.google.android.exoplayer2.upstream.cache.CacheDataSource.read(CacheDataSource.java:308)
        at com.google.android.exoplayer2.upstream.TeeDataSource.read(TeeDataSource.java:71)
        at com.google.android.exoplayer2.upstream.cache.CacheDataSource.read(CacheDataSource.java:308)
        at com.google.android.exoplayer2.upstream.cache.CacheUtil.readAndDiscard(CacheUtil.java:314)
        at com.google.android.exoplayer2.upstream.cache.CacheUtil.cache(CacheUtil.java:210)
        at com.google.android.exoplayer2.upstream.cache.CacheUtil.cache(CacheUtil.java:128)
        at dev.temq.testexoplayercacheutil.MainActivity$onCreate$1.run(MainActivity.kt:55)
        at io.reactivex.rxjava3.internal.operators.completable.CompletableFromAction.subscribeActual(CompletableFromAction.java:36)
        at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850)
        at io.reactivex.rxjava3.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(CompletableSubscribeOn.java:64)
        at io.reactivex.rxjava3.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:41)
        at io.reactivex.rxjava3.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:28)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: java.io.EOFException
        at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.readInternal(DefaultHttpDataSource.java:700)
        at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.read(DefaultHttpDataSource.java:357)
        at com.google.android.exoplayer2.upstream.DefaultDataSource.read(DefaultDataSource.java:182) 
        at com.google.android.exoplayer2.upstream.cache.CacheDataSource.read(CacheDataSource.java:308) 
        at com.google.android.exoplayer2.upstream.TeeDataSource.read(TeeDataSource.java:71) 
        at com.google.android.exoplayer2.upstream.cache.CacheDataSource.read(CacheDataSource.java:308) 
        at com.google.android.exoplayer2.upstream.cache.CacheUtil.readAndDiscard(CacheUtil.java:314) 
        at com.google.android.exoplayer2.upstream.cache.CacheUtil.cache(CacheUtil.java:210) 
        at com.google.android.exoplayer2.upstream.cache.CacheUtil.cache(CacheUtil.java:128) 
        at dev.temq.testexoplayercacheutil.MainActivity$onCreate$1.run(MainActivity.kt:55) 
        at io.reactivex.rxjava3.internal.operators.completable.CompletableFromAction.subscribeActual(CompletableFromAction.java:36) 
        at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850) 
        at io.reactivex.rxjava3.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(CompletableSubscribeOn.java:64) 
        at io.reactivex.rxjava3.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:41) 
        at io.reactivex.rxjava3.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:28) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 

Link to test content

Reproducible sample - https://github.com/temq09/TestExoPlayerCacheUtil

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions