in reply to Re: Playing video with perl / perltk
in thread Playing video with perl / perltk

Thanks PodMaster and Courage,
> But first you must install Tcl/Tk with said widget
I don't want to deal with a full Tcl install, so I bailed on this idea. But thanks for the suggestion, Courage.
> Take a look at Win32::MultiMedia
This worked great! I got it up and running in 5 mins. It did require some debug on the code example, though:
use strict; use Tk; use Win32::MultiMedia::Mci; my $file = shift || 'test.wmv'; my $mw = MainWindow->new(); my $video_frame = $mw->Frame( -width => 352, -height => 240, -background => 'black' )->pack(-expand => 1); my $mci = Win32::MultiMedia::Mci->open($file, shareable => 1, style => 'child', parent => hex($video_frame->id) ); $mci->play(''); MainLoop();

There are 3 bugs in the code:
  • $mw was not defined, so I added a MainWindow-new().
  • The mci parent pointed to $frame. It needs to point to $video_frame.
  • Without the MainLoop(), the program exits immediately without playing the video.

    The above code displays a nice little test video window on my screen. This is why I love perl. :)

    Thanks again,
    TROGDOR

    Janitored by Arunbear - replaced pre tags with code tags, as per Monastery guidelines