Glimpse: Always prepare ExoPlayer when media type is video

* Fixes video loading when a video is selected from reels

Change-Id: I62f5d20e041f83fc0384e7f9e4a7c4f08a75268f
This commit is contained in:
Sebastiano Barezzi 2023-08-21 02:21:59 +02:00
parent 44e74bfdfa
commit 74389a9725
No known key found for this signature in database
GPG Key ID: 763BD3AE91A7A13F
1 changed files with 6 additions and 4 deletions

View File

@ -189,10 +189,12 @@ class MediaViewerFragment : Fragment(R.layout.fragment_media_viewer) {
)
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()
}