Hello, I'm trying to use Mac::Movies but I can't find any documentation anywhere
beyond the crumbs that are in the shucked module and I'm pulling my hair out. I
need to finish this script this week for the sake of my senior thesis but I've
been smacking my head up against the wall that is this module for weeks (in
addition to other routs to the same goal.) Anyways, if you can direct me towards
any documentation on it or would be so kind as to help walk me through it I'd be
eternally grateful.

All I'm trying to do is the most basic: play (.aiff sound) file, wait until file
is done, continue program. Whenever I try OpenMovieFile() I get the error that
fileSpec is not a valid file specification. But I haven't the faintest idea what
this means or how to correct it since what makes a valid fileSpec is never
discussed anywhere.

Again I'd be grateful for any help you could give. If you think there's some
better way to do what little I'm trying to do feel free to direct me there (as
long as there's documentation.) If it'd be helpful to see more of the program,
it follows. (The error is in the first lin eof the last subroutine.)

Desperate frazzled senior,
~wren

#!perl -w
use strict;
use Mac::Events;
use Mac::Movies;
use Mac::Windows;
use vars qw($filename $movie $window $movie_controller
        $x1 $x2 $y1 $y2 $bounds);

EnterMovies() or die $^E;
$filename = shift @ARGV; # for argument's sake
make_window();
start_movie($filename);
WaitNextEvent unless IsMovieDone($movie) # only time Mac::Events is used
ExitMovies();

sub make_window {
    $x1 = $y1 = 100; $x2 = 300; $y2 = 115;
    my $bounds = Rect->new($x1, $y1, $x1 + $x2, $y1 + $y2);
    $window =
        MacWindow->new( NewCWindow($bounds, 'Title', 1, noGrowDocProc, 1) );
    $window->sethook( redraw => \&draw_window );
    $window->sethook( drawgrowicon => sub {1} );
    $window->sethook( key => \&handle_keys );
}

sub start_movie {
    if (get_movie(shift)) {
    $movie_controller =
        $window->new_movie($movie, Rect->new(-1, 108, $x2 + 1, $y2));
    MCDoAction($movie_controller->movie, mcActionPlay(), 1);
    }
}

sub get_movie {
    my $resfile = OpenMovieFile(shift) or die $^E;
    $movie = NewMovieFromFile($resfile, 0, newMovieActive) or die $^E;
    CloseMovieFile($resfile);
    return $movie;
}

END {
    DisposeMovie($movie)         if defined $movie;
    $movie_controller->dispose if defined $movie_controller;
    $window->dispose               if defined $window;
}
__END__

Reply via email to