I'm not exactly a fan of how Gtk::Video's controls look and I want to expand on them with my own custom controls, but I'm not sure how to hide the default media controls. Is there any way that I can do this?
Asked
Active
Viewed 145 times
1

NintendoZaedus
- 653
- 3
- 8
- 22
-
I've never seen this `GtkVideo` thing before; is it something that's specific to Gtk4? Just curious. You might be able to use CSS to style the video controls, but since I don't have Gtk4 with my version of Python, I don't know what CSS class names to use, etc. – Sylvester Kruin Jan 05 '22 at 21:34
2 Answers
1
From the documentation of Gtk.Video:
The controls are available separately as Gtk.MediaControls. If you just want to display a video without controls, you can treat it like any other paintable and for example put it into a Gtk.Picture.

swanux
- 67
- 7
1
I know how to do it in GTK. You will have to only find the corresponding methods in GTKMM. GtkVideo widget contains a GtkOverlay. In that overlay are three elements GtkPicture, GtkImage, GtkRevealer. GtkPicture is the video surface. GtkImage is that big play button in the center of video. And GtkRevealer is the block of controls. So basically I am hiding or removing the last child of the first child of GtkVideo.
GtkMediaFile* videoFile = GTK_MEDIA_FILE(gtk_media_file_new_for_file(g_file_new_for_path("GTK4Video.mp4")));
GtkVideo* videoPlayer = GTK_VIDEO(gtk_video_new_for_media_stream(GTK_MEDIA_STREAM(videoFile)));
GtkOverlay* videoOverlay = GTK_OVERLAY(gtk_widget_get_first_child(GTK_WIDGET(videoPlayer)));
GtkRevealer* videoControls = GTK_REVEALER(gtk_widget_get_last_child(GTK_WIDGET(videoOverlay)));
gtk_widget_hide(GTK_WIDGET(videoControls));
//gtk_overlay_remove_overlay(videoOverlay, GTK_WIDGET(videoControls));

Michał
- 11
- 3