Prevent video reload if same video, refs

This commit is contained in:
Kelvin 2024-01-16 16:46:30 +01:00
parent ea4fea4401
commit 982d251126
5 changed files with 14 additions and 5 deletions

View file

@ -1003,6 +1003,9 @@ class VideoDetailView : ConstraintLayout {
fun setVideo(url: String, resumeSeconds: Long = 0, playWhenReady: Boolean = true) {
Logger.i(TAG, "setVideo url=$url resumeSeconds=$resumeSeconds playWhenReady=$playWhenReady")
if(this.video?.url == url)
return;
_searchVideo = null;
video = null;
_playbackTracker = null;
@ -1033,6 +1036,9 @@ class VideoDetailView : ConstraintLayout {
fun setVideoOverview(video: IPlatformVideo, fetch: Boolean = true, resumeSeconds: Long = 0) {
Logger.i(TAG, "setVideoOverview")
if(this.video?.url == video.url)
return;
val cachedVideo = StateDownloads.instance.getCachedVideo(video.id);
if(cachedVideo != null) {
setVideoDetails(cachedVideo, true);
@ -1131,6 +1137,9 @@ class VideoDetailView : ConstraintLayout {
fun setVideoDetails(videoDetail: IPlatformVideoDetails, newVideo: Boolean = false) {
Logger.i(TAG, "setVideoDetails (${videoDetail.name})")
if(newVideo && this.video?.url == videoDetail.url)
return;
if (newVideo) {
_lastVideoSource = null;
_lastAudioSource = null;
@ -2551,7 +2560,7 @@ class VideoDetailView : ConstraintLayout {
}
else
withContext(Dispatchers.Main) {
setVideoDetails(videoDetail);
setVideoDetails(videoDetail, true);
_liveTryJob = null;
}
}

@ -1 +1 @@
Subproject commit 139444608dbd561a317fc4666dfe01b868335e80
Subproject commit bc13b38411bdb8ad7c48d869ec9bc2068e671bd0

@ -1 +1 @@
Subproject commit b7864b910172659d29602f05d968427bffcc95f0
Subproject commit c86c73db0cdde3371c7944dd82c34ea4e5c725d9

@ -1 +1 @@
Subproject commit 139444608dbd561a317fc4666dfe01b868335e80
Subproject commit bc13b38411bdb8ad7c48d869ec9bc2068e671bd0

@ -1 +1 @@
Subproject commit b7864b910172659d29602f05d968427bffcc95f0
Subproject commit c86c73db0cdde3371c7944dd82c34ea4e5c725d9