# Embedding an Audio player or a Video player in a ruby-gtk app

**URL:** <https://www.ruby-forum.com/t/embedding-an-audio-player-or-a-video-player-in-a-ruby-gtk-app/214468>\
**Category:** Ruby-Gnome 2\
**Created:** [December 2, 2011, 2:30pm UTC](https://www.ruby-forum.com/t/embedding-an-audio-player-or-a-video-player-in-a-ruby-gtk-app/214468 "2011-12-02T14:30:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [December 2, 2011, 2:30pm UTC](https://www.ruby-forum.com/t/embedding-an-audio-player-or-a-video-player-in-a-ruby-gtk-app/214468/1 "2011-12-02T14:30:40Z")

</div>

Hi,

Is there any way to include a minimal videoplayer or audioplayer in a  
ruby-gtk program? Perhaps with GTK3?

Right now I mostly use mplayer, but I also have VLC installed. And  
Gstreamer and gnome-mplayer.

What I am curious is the minimal code that would be required to actually  
embed these into a small ruby-gtk application.

My goal is to create a pseudo “Desktop Environment” where all my useful  
ruby-gtk programs can be started and controlled from within a set of  
widgets. And it would be really great if I could watch videos inside.

In HTML5 this should not be a big problem anymore. And I saw that with  
GTK3, we can embed applications into a browser, i.e. embed and run gimp  
into firefox.

I find this all quite exciting, but I also feel too dumb to dig into  
this, as this seems to all be in the language C, and I suck at C.

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [December 2, 2011, 3:44pm UTC](https://www.ruby-forum.com/t/embedding-an-audio-player-or-a-video-player-in-a-ruby-gtk-app/214468/2 "2011-12-02T15:44:36Z")

</div>

There is no Ruby GTK3 to play with yet, although I know they are working  
on it.

With Gtk2, you can (theoretically) do this on Linux using mplayer.

With a Gtk2 window “win” open, ask for its xwindows window id:

win.window.xid

Now execute mplayer and pass it the -wid parameter, passing your xid.  
Mplayer should embed itself for you on your window. I’m guessing since  
xid is defined on Gdk::Drawable that you can do this with any control,  
so  
you can embed the video in a container.

-dh

From: Marc H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: removed\_email\_address@domain.invalid,  
Date: 12/02/2011 08:31 AM  
Subject: [ruby-gnome2-devel-en] Embedding an Audio player or a  
Video player in a ruby-gtk app

Hi,

Is there any way to include a minimal videoplayer or audioplayer in a  
ruby-gtk program? Perhaps with GTK3?

Right now I mostly use mplayer, but I also have VLC installed. And  
Gstreamer and gnome-mplayer.

What I am curious is the minimal code that would be required to actually  
embed these into a small ruby-gtk application.

My goal is to create a pseudo “Desktop Environment” where all my useful  
ruby-gtk programs can be started and controlled from within a set of  
widgets. And it would be really great if I could watch videos inside.

In HTML5 this should not be a big problem anymore. And I saw that with  
GTK3, we can embed applications into a browser, i.e. embed and run gimp  
into firefox.

I find this all quite exciting, but I also feel too dumb to dig into  
this, as this seems to all be in the language C, and I suck at C.

–  
Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [December 3, 2011, 9:36pm UTC](https://www.ruby-forum.com/t/embedding-an-audio-player-or-a-video-player-in-a-ruby-gtk-app/214468/3 "2011-12-03T21:36:17Z")

</div>

Marc H. wrote in post #1034742:

> Hi,
> 
> Is there any way to include a minimal videoplayer or audioplayer in a  
> ruby-gtk program? Perhaps with GTK3?

see this code from green\_shoes:

> <https://github.com/ashbb/green_shoes/blob/master/lib/plugins/video.rb>

it use gstreamer.
