Skip to content

Commit

Permalink
fix(MediaViewer): volume not matching media controls
Browse files Browse the repository at this point in the history
  • Loading branch information
GeopJr committed Aug 4, 2023
1 parent a2c0d45 commit 1420811
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Views/MediaViewer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
public class Tuba.Views.MediaViewer : Gtk.Box {
const double MAX_ZOOM = 20;
private signal void zoom_changed ();
static double last_used_volume = 1.0;

public class Item : Adw.Bin {
private Gtk.Stack stack;
Expand Down Expand Up @@ -145,6 +146,7 @@ public class Tuba.Views.MediaViewer : Gtk.Box {
message ("Destroying MediaViewer.Item");

if (is_video) {
last_used_volume = ((Gtk.Video) child_widget).media_stream.muted ? 0.0 : ((Gtk.Video) child_widget).media_stream.volume;
((Gtk.Video) child_widget).media_stream.stream_unprepared ();
((Gtk.Video) child_widget).set_file (null);
((Gtk.Video) child_widget).set_media_stream (null);
Expand All @@ -158,6 +160,10 @@ public class Tuba.Views.MediaViewer : Gtk.Box {
public void done () {
spinner.spinning = false;
stack.visible_child_name = "child";
if (is_video) {
((Gtk.Video) child_widget).media_stream.volume = 1.0 - last_used_volume;
((Gtk.Video) child_widget).media_stream.volume = last_used_volume;
};
}

private Gtk.Widget setup_scrolledwindow (Gtk.Widget child) {
Expand Down

0 comments on commit 1420811

Please sign in to comment.