elementary / granite

Library that extends GTK with common widgets and utilities
https://elementary.io
GNU Lesser General Public License v3.0
286 stars 60 forks source link

Abstract Videos player into a widget/library #268

Closed cassidyjames closed 2 years ago

cassidyjames commented 5 years ago

Somehow this didn't get moved from Launchpad. Moving here instead of to Videos since this code would live in Granite; feel free to move it if that assumption is wrong.

https://bugs.launchpad.net/audience/+bug/1176974

It would be nice if there was a simple "audience library" to make it possible to embed an audience window in another app. For example, Birdie could embed a video window for youtube videos inside the main window, instead of opening a new one. Just an idea.

@danrabbit:

From a design perspective: what I would imagine is we'd just want the video player itself with the overlay playback controls. To make sure this widget can be the same as used in Audience then I guess we'd want an API to add actions to the right side of the control bar

@nathandyer:

It should be pretty easy to create an audio/video library in Granite to do exactly what we're looking for. We could actually make it so that you initialize a player and then it returns a typical GTK widget, prepacked with all the clutter textures and playback controls, that a developer could then just add to any additional container they wanted. So, in theory, it would be basically 4 lines of code to play a video.

For instance:

var video = new Granite.Media.VideoPlayer();
video.uri = "https://foo.com/foo.mp4";
pack_start(video);
video.play();
show_all();
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/70573079-abstract-videos-player-into-a-widget-library?utm_campaign=plugin&utm_content=tracker%2F60830613&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F60830613&utm_medium=issues&utm_source=github).
Philip-Scott commented 5 years ago

I made it into its own widget some time ago (code might be old) in here https://gist.github.com/Philip-Scott/b164f35db426ece89c47b136d224b762

The problem with adding this in granite though is all the dependencies it would pull on all granite apps

cassidyjames commented 5 years ago

@Philip-Scott in that case a separate library could work?

Philip-Scott commented 5 years ago

Yeah, that could be the easiest option. We could probably have a granite-media library to handle things such as audio and video players as well as their specific widgets such as playback control

danirabbit commented 2 years ago

There's Gtk.Video and Gtk.MediaControls now which looks like this:

Screenshot from 2022-06-16 13 38 37

I'm inclined to close this for now and we can revisit the idea of a Granite.MediaControls widget if we have some novel functionality or design