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

fix(mv): clapper: GIFV handling fixes #1075

Merged
merged 4 commits into from
Aug 5, 2024
Merged
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
38 changes: 19 additions & 19 deletions src/Views/MediaViewer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
if (!is_video) return;
if (is_done) {
#if CLAPPER
Clapper.Player player = ((ClapperGtk.Video) child_widget).player;

if (value) {
((ClapperGtk.Video) child_widget).player.play ();
} else {
((ClapperGtk.Video) child_widget).player.pause ();
player.play ();
} else if (player.state > Clapper.PlayerState.STOPPED) {
player.pause ();
Rafostar marked this conversation as resolved.
Show resolved Hide resolved
}
#else
((Gtk.Video) child_widget).media_stream.playing = value;
Expand Down Expand Up @@ -275,14 +277,16 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {

if (is_video) {
#if CLAPPER
Clapper.Player player = ((ClapperGtk.Video) child_widget).player;

if (pre_playing) {
((ClapperGtk.Video) child_widget).player.play ();
} else {
((ClapperGtk.Video) child_widget).player.pause ();
player.play ();
} else if (player.state > Clapper.PlayerState.STOPPED) {
player.pause ();
}

((ClapperGtk.Video) child_widget).player.volume = last_used_volume;
((ClapperGtk.Video) child_widget).player.notify["volume"].connect (on_manual_volume_change);
player.volume = last_used_volume;
player.notify["volume"].connect (on_manual_volume_change);
#else
((Gtk.Video) child_widget).media_stream.volume = 1.0 - last_used_volume;
((Gtk.Video) child_widget).media_stream.volume = last_used_volume;
Expand Down Expand Up @@ -944,15 +948,6 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
var video = new ClapperGtk.Video () {
auto_inhibit = true
};
#if CLAPPER_MPRIS
var mpris = new Clapper.Mpris (
"org.mpris.MediaPlayer2.Tuba",
Build.NAME,
Build.DOMAIN
);
video.player.add_feature (mpris);
#endif
video.player.audio_filter = Gst.ElementFactory.make ("scaletempo", null);
#else
var video = new Gtk.Video () {
#if GTK_4_16
Expand All @@ -967,13 +962,18 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
if (media_type == Tuba.Attachment.MediaType.GIFV) {
#if CLAPPER
video.player.queue.progression_mode = Clapper.QueueProgressionMode.REPEAT_ITEM;
video.player.autoplay = true;
#else
video.loop = true;
video.autoplay = true;
#endif
} else {
#if CLAPPER
#if CLAPPER_MPRIS
video.player.add_feature (new Clapper.Mpris (
"org.mpris.MediaPlayer2.Tuba",
Build.NAME,
Build.DOMAIN
));
#endif
video.add_fading_overlay (new ClapperGtk.SimpleControls () {
valign = Gtk.Align.END,
fullscreenable = false
Expand Down
Loading