NAME

Tk::MultiMediaControls - Create media player control buttons.

SYNOPSIS

$mmc = $parent->MultiMediaControls(-option => value, ... );

DESCRIPTION

Create multimedia controls similar to that found on Apple applications like QuickTime, iMovie, iDVD, iTunes, etcetera. This mega-widget accepts a -buttons option that specifies a list of controller buttons, and a series of specialized options that bind callbacks to those buttons.

-buttons

A list of controller buttons: [ qw/ home rewind play stop fastforward / ]. You supply the callbacks that implement the above buttons, which nominally have this effect on the movie:

home - reset movie to first frame

rewind - play movie in fast reverse

play - a toggle: play movie at normal speed / pause movie

stop - stop movie (reset to first frame?)

fastforward - play movie in fast forward

-fastcommand
-fasthighlightcommand
-homecommand
-homehighlightcommand
-leftcommand
-pausecommand
-pausehighlightcommand
-playcommand
-playhighlightcommand
-rewindcommand
-rewindhighlightcommand
-rightcommand
-stopcommand
-stophighlightcommand

Callbacks that are invoked when control buttons are pressed or released. Callbacks that include the string highlight are invoked when Button-1 is pressed and held. With the exception of the -leftcommand and -rightcommand, all other callbacks are invoked when Button-1 is released.

Three keys have special meanings that parallel Apple's bindings. The space bar (space) is bound to toggle the play/pause button. The left-arrow (Left) and right-arrow (Right) should, if possible, display the previous or next movie frame. Use -leftcommand and -rightcommand for this.

METHODS

A MultiMediaControls widget has no additional methods.

EXAMPLE

This example creates a MultiMediaControls widget appropriate for a Tk::Animation widget:

my $p   = $mw->Animation( -format => 'gif', -file => ' ... ' );
my $mmc = $mw->MultiMediaControls(

    # Define, from left to right, the window's controller buttons.

    -buttons                     => [ qw/ home rewind play stop fastforward / ],

    # Define callbacks for the buttons' various states.

    -fastforwardhighlightcommand => [ $p => 'fast_forward',   4 ],
    -fastforwardcommand          => [ $p => 'fast_forward',   1 ],
    -homecommand                 => [ $p => 'set_image',      0 ],
    -pausecommand                => [ $p => 'pause_animation'   ],
    -playcommand                 => [ $p => 'resume_animation'  ],
    -rewindhighlightcommand      => [ $p => 'fast_reverse',  -4 ],
    -rewindcommand               => [ $p => 'fast_reverse',   1 ],
    -stopcommand                 => [ $p => 'stop_animation'    ],

    # Define callbacks for the left and right arrow keys.

    -leftcommand                 => [ $p => 'prev_image'        ],
    -rightcommand                => [ $p => 'next_image'        ],

)->pack;

AUTHOR

sol0@Lehigh.EDU

Copyright (C) 2003 - 2004, Steve Lidie. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

KEYWORDS

Apple, QuickTime, animation, multimedia, iMovie, iTunes

BUGS

I'm sure there are end cases and errors that I've neglected to catch.