Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add audio volume slider #691

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions docs/updates/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ Features are broken up into the following priority levels, with nested prioritie
- [ ] Timeline scrubber [HIGH]
- [ ] Fullscreen [MEDIUM]
- [ ] Audio Playback [HIGH] [#450](https://github.com/TagStudioDev/TagStudio/issues/450)
- [ ] Play/Pause [HIGH]
- [x] Play/Pause [HIGH]
- [ ] Loop [HIGH]
- [ ] Toggle Autoplay [MEDIUM]
- [ ] Volume Control [HIGH]
- [ ] Toggle Mute [HIGH]
- [x] Volume Control [HIGH]
- [x] Toggle Mute [HIGH]
- [x] Timeline scrubber [HIGH]
- [ ] Fullscreen [MEDIUM]
- [ ] Optimizations [HIGH]
Expand Down
11 changes: 11 additions & 0 deletions tagstudio/src/qt/widgets/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ def __init__(self, driver: "QtDriver") -> None:

self.media_btns_layout.addWidget(self.mute)

self.volume_slider = QSlider()
self.volume_slider.setOrientation(Qt.Orientation.Horizontal)
# set slider value to current volume
self.volume_slider.setValue(int(self.player.audioOutput().volume() * 100))
self.volume_slider.valueChanged.connect(self.volume_slider_changed)

self.media_btns_layout.addWidget(self.volume_slider)

self.position_label = QLabel("0:00")
self.position_label.setAlignment(Qt.AlignmentFlag.AlignRight)

Expand Down Expand Up @@ -207,3 +215,6 @@ def media_status_changed(self, status: QMediaPlayer.MediaStatus) -> None:
current = self.format_time(self.player.position())
duration = self.format_time(self.player.duration())
self.position_label.setText(f"{current} / {duration}")

def volume_slider_changed(self, position: int) -> None:
self.player.audioOutput().setVolume(position / 100)
Loading