Media player plugin for playing video files

Trying to build a simple media player juce application in Linux, that has start, stop, and pause buttons and can play common video file containers, such avi, mp3/mp4, ogg. I saw the lack of quicktime support for Linux.

Wanted to get your insight on the best way to accomplish this in Linux. Has anyone done this?

Was thinking a media player plugin implementation within a Juce component, such as the VLC Video Player -

Since VLC is cross-platform, I would think that a media player plugin would not only work for Linux, but also Mac and Windows.

Any help or insight appreciated.


After some research, I discovered that I can easily build a media player using LibVLC - How do I embed the libvlc media player into a juce component, so that the media player draws centered within the juce component window?

Here is the code for creating a libvlc program, when you link to libvlc. I’ve installed libvlc headers and it compiles as a standalone C application. There are even instructions for doing this with a QT Qwidget. I would think that we could easily do this with Juce as well:

#include <stdio.h>
#include <stdlib.h>
#include <vlc/vlc.h>

static void raise(libvlc_exception_t * ex)
    if (libvlc_exception_raised (ex))
         fprintf (stderr, "error: %s\n", libvlc_exception_get_message(ex));
         exit (-1);
int main(int argc, char* argv[])
    const char * const vlc_args[] = {
              "-I", "dummy", /* Don't use any interface */
              "--ignore-config", /* Don't use VLC's config */
              "--plugin-path=/set/your/path/to/libvlc/module/if/you/are/on/windows/or/macosx" };
    libvlc_exception_t ex;
    libvlc_instance_t * inst;
    libvlc_media_player_t *mp;
    libvlc_media_t *m;
    libvlc_exception_init (&ex);
    /* init vlc modules, should be done only once */
    inst = libvlc_new (sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args, &ex);
    raise (&ex);
    /* Create a new item */
    m = libvlc_media_new (inst, "blah.ogv", &ex);
    raise (&ex);
    /* XXX: demo art and meta information fetching */
    /* Create a media player playing environement */
    mp = libvlc_media_player_new_from_media (m, &ex);
    raise (&ex);
    /* No need to keep the media now */
    libvlc_media_release (m);

#if 0
    /* This is a non working code that show how to hooks into a window,
     * if we have a window around */
     libvlc_drawable_t drawable = xdrawable;
    /* or on windows */
     libvlc_drawable_t drawable = hwnd;

     libvlc_media_player_set_drawable (mp, drawable, &ex);
     raise (&ex);

    /* play the media_player */
    libvlc_media_player_play (mp, &ex);
    raise (&ex);
    sleep (10); /* Let it play a bit */
    /* Stop playing */
    libvlc_media_player_stop (mp, &ex);

    /* Free the media_player */
    libvlc_media_player_release (mp);

    libvlc_release (inst);
    raise (&ex);

    return 0;

LibVLC Tutorial:

1 Like