Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/tagstudio/qt/widgets/media_player.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (C) 2024 Travis Abendshien (CyanVoxel).
# Licensed under the GPL-3.0 License.
# Created for TagStudio: https://github.com/CyanVoxel/TagStudio
Expand Down Expand Up @@ -101,8 +101,8 @@
self.setCursor(Qt.CursorShape.PointingHandCursor)
self.setStyleSheet("""
QGraphicsView {
background: transparent;
border: none;
background: transparent;
border: none;
}
""")
self.setObjectName("mediaPlayer")
Expand Down Expand Up @@ -409,6 +409,8 @@
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
Expand Down Expand Up @@ -454,6 +456,10 @@
duration = self.format_time(self.player.duration())
self.position_label.setText(f"{current} / {duration}")

# The key change: if autoplay is off, pause the player after the media is 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())

Expand Down
Loading