From 629f1a68e785e9b7efbddfd0dd2c99c44f72dcf8 Mon Sep 17 00:00:00 2001 From: aforge Date: Sun, 19 Feb 2023 17:36:46 -0800 Subject: [PATCH] Handle video ended event in video preview player. (cherry picked from commit 1ac7b7df713ae6f3a884fa215b63970085d2b308) --- Tinodios/VideoPreviewController.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Tinodios/VideoPreviewController.swift b/Tinodios/VideoPreviewController.swift index a2fdb1d3..cf54e9b3 100644 --- a/Tinodios/VideoPreviewController.swift +++ b/Tinodios/VideoPreviewController.swift @@ -320,7 +320,13 @@ extension VideoPreviewController: VLCMediaPlayerDelegate { controlsView.alpha = 1 playPauseButton.isHidden = false UiUtils.showToast(message: "Video playback error") - case .stopped, .paused, .ended: + case .ended: + // Update slider position and ts label + // in case the corresponding VLCMediaPlayer event doesn't fire for whatever reason. + videoSlider.value = 1 + currentTimeLabel.text = self.durationLabel.text + fallthrough + case .stopped, .paused: updatePlayPauseButton(isPlaying: false) default: break