Only generate Thumbnails once seek has started

This commit is contained in:
Felix 2019-11-12 21:09:05 +01:00
parent 88db031214
commit a4b5b2f528

View file

@ -28,7 +28,7 @@ class ChaosflixSeekDataProvider(
private val scope = CoroutineScope(Dispatchers.IO + Job())
private var canceled = false
private var canceled = true
private var generateThumbsJob: Job? = null
private val mediaMetadataRetriever = MediaMetadataRetriever()
@ -36,11 +36,6 @@ class ChaosflixSeekDataProvider(
private val thumbnails: MutableMap<Long, Bitmap> = mutableMapOf()
private val dummyThumbnails: MutableMap<Long, Bitmap> = mutableMapOf()
init {
mediaMetadataRetriever.setDataSource(url, mapOf("User-Agent" to ApiFactory.buildUserAgent()))
generateThumbs()
}
private val positions: LongArray by lazy {
val list = mutableListOf<Long>()
for (i in 0..(length * 1000) step calculateInterval(length)) {