Skip to content
Snippets Groups Projects
Commit 8f45335b authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

TV Channels: Wait for thumbnail

parent 52645b5c
No related branches found
No related tags found
No related merge requests found
Pipeline #6988 failed with stage
in 3 minutes and 58 seconds
......@@ -63,7 +63,7 @@ public class ThumbnailsProvider {
}
@WorkerThread
private static Bitmap getVideoThumbnail(final MediaWrapper media, int width) {
static Bitmap getVideoThumbnail(final MediaWrapper media, int width) {
final String filePath = media.getUri().getPath();
if (appDir == null) appDir = VLCApplication.getAppContext().getExternalFilesDir(null);
final boolean hasCache = appDir != null && appDir.exists();
......
......@@ -91,9 +91,10 @@ fun Context.launchChannelUpdate() = AppScope.launch {
updatePrograms(this@launchChannelUpdate, id)
}
fun setResumeProgram(context: Context, mw: MediaWrapper) {
suspend fun setResumeProgram(context: Context, mw: MediaWrapper) {
var cursor: Cursor? = null
var isProgramPresent = false
val mw = context.getFromMl { findMedia(mw) }
try {
cursor = context.contentResolver.query(
TvContractCompat.WatchNextPrograms.CONTENT_URI, WATCH_NEXT_MAP_PROJECTION, null,
......@@ -132,7 +133,10 @@ fun setResumeProgram(context: Context, mw: MediaWrapper) {
}
private fun MediaWrapper.artUri() : Uri {
private suspend fun MediaWrapper.artUri() : Uri {
if (!isThumbnailGenerated) {
withContext(Dispatchers.IO) { ThumbnailsProvider.getVideoThumbnail(this@artUri, 512) }
}
val mrl = artworkMrl ?: return Uri.parse("android.resource://${BuildConfig.APPLICATION_ID}/${R.drawable.ic_browser_video_big_normal}")
return try {
getFileUri(mrl)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment