fix: always show first frame of video; autoplay will always play (#1104)

Co-authored-by: Sumith <109025648+sumithsudheer@users.noreply.github.com>
This commit is contained in:
Travis Abendshien
2025-09-06 15:00:50 -07:00
committed by GitHub
parent cee64a8c31
commit 47baa6f09e

View File

@@ -404,12 +404,12 @@ class MediaPlayer(QGraphicsView):
if not self.is_paused:
self.player.stop()
self.player.setSource(QUrl.fromLocalFile(self.filepath))
if self.autoplay.isChecked():
self.player.play()
else:
self.player.setSource(QUrl.fromLocalFile(self.filepath))
if self.autoplay.isChecked():
self.player.play()
def load_toggle_play_icon(self, playing: bool) -> None:
icon = self.driver.rm.pause_icon if playing else self.driver.rm.play_icon
self.play_pause.load(icon)
@@ -454,6 +454,10 @@ class MediaPlayer(QGraphicsView):
duration = self.format_time(self.player.duration())
self.position_label.setText(f"{current} / {duration}")
# Ensures first frame of non-autoplay videos are loaded
if not self.autoplay.isChecked():
self.player.pause()
def _update_controls(self, size: QSize) -> None:
self.scene().setSceneRect(0, 0, size.width(), size.height())