commit | 74389a9725513fc4efe18a1532b90178fd7851c4 | [log] [tgz] |
---|---|---|
author | Sebastiano Barezzi <seba@sebaubuntu.dev> | Mon Aug 21 02:21:59 2023 +0200 |
committer | Sebastiano Barezzi <seba@sebaubuntu.dev> | Mon Aug 21 02:21:59 2023 +0200 |
tree | d9a52f80fe1a0f6678a555d0d3390ddd9640b489 | |
parent | 44e74bfdfad7f3dde456654801f219f3941c0ef5 [diff] |
Glimpse: Always prepare ExoPlayer when media type is video * Fixes video loading when a video is selected from reels Change-Id: I62f5d20e041f83fc0384e7f9e4a7c4f08a75268f
diff --git a/app/src/main/java/org/lineageos/glimpse/fragments/MediaViewerFragment.kt b/app/src/main/java/org/lineageos/glimpse/fragments/MediaViewerFragment.kt index 2b1dcf8..d9ca651 100644 --- a/app/src/main/java/org/lineageos/glimpse/fragments/MediaViewerFragment.kt +++ b/app/src/main/java/org/lineageos/glimpse/fragments/MediaViewerFragment.kt
@@ -189,10 +189,12 @@ ) if (media.mediaType == MediaType.VIDEO) { - exoPlayer?.setMediaItem(MediaItem.fromUri(media.externalContentUri)) - exoPlayer?.seekTo(C.TIME_UNSET) - exoPlayer?.prepare() - exoPlayer?.playWhenReady = true + with(exoPlayerLazy.value) { + setMediaItem(MediaItem.fromUri(media.externalContentUri)) + seekTo(C.TIME_UNSET) + prepare() + playWhenReady = true + } } else { exoPlayer?.stop() }