CLASS:: MovieView
summary:: A view responding to Wacom tablet
categories:: GUI>Views
related:: Classes/Image

DESCRIPTION::

MovieView can play movies such as .mov and mpg, and image files like jpg, png, tiff and others.

note:: Not available in strong::Qt GUI:: ::

note:: strong:: prerequisites in SwingOSC ::

JSCMovieView is currently based on the Java Media Framework (JMF) which is not part of the standard java environment (Java SE) but needs to be installed separately. There is a reference implementation from Sun available for Linux, Windows and Mac OS X. It can be downloaded from http://java.sun.com/products/java-media/jmf/index.jsp (note: for Mac OS X you need the generic cross-platform version).

The reference implementation has rather poor media support (check this page: http://java.sun.com/products/java-media/jmf/2.1.1/formats.html ), so you might need to convert your movies or look out for extra JMF plug-ins. A really good plug-in is fobs4j !(ffpmeg objects for java) -> http://fobs.sourceforge.net/ !
You need to install the "jmf.jar" file in your system's java extensions folder, e.g. on Mac OS X that's "/Library/Java/Extensions". For fobs, do the same with "fobs4jmf.jar" and copy "jmf.properties" into "SwingOSC/build".

(in the future, FMJ (freedom for media in java) might be an alternative: http://fmj-sf.net)
::

CLASSMETHODS::
PRIVATE:: key


INSTANCEMETHODS::

METHOD:: path
    The path to the movie.

SUBSECTION:: Movie Control

METHOD:: start
METHOD:: stop
METHOD:: stepForward
METHOD:: stepBack
METHOD:: gotoEnd
METHOD:: gotoBeginning

METHOD:: frame
    Go to frame.

    argument::
        The frame index; an Integer.

METHOD:: playSelectionOnly

    argument::
        A Boolean.

METHOD:: skipFrames

    argument::
        An Integer.

METHOD:: muted

    argument::
        A Boolean.

METHOD:: loopMode

    Possible loop modes:
    list::
    ## 0 - Playback runs forward and backward between both endpoints.
    ## 1 - Restarts playback at beginning when end is reached.
    ## 2 - Playback stops when end is reached.
    ::

    argument::
        One of the above Integers.

METHOD:: rate

    argument::
        An instance of Float. 1.0 is the normal rate.


SUBSECTION:: Movie Editing

METHOD:: copy
METHOD:: clear
METHOD:: cut
METHOD:: paste

METHOD:: editable
    argument::
        A Boolean.

METHOD:: currentTime
    The current time.
    argument::
        Defaults to code::nil::.


SUBSECTION:: Appearance

METHOD:: showControllerAndAdjustSize

    argument:: show
        A Boolean. Default is code::true::.
    argument:: adjust
        A Boolean. Default is code::true::.

METHOD:: resizeWithMagnification
    Resizes the whole view, adjusts its contents.

    argument:: size
        A Float.

METHOD:: fixedAspectRatio
    argument::
        A Boolean.


EXAMPLES::

code::
(
w = Window("mov").front;
b = Button(w, Rect(0, 0, 150, 20))
    .states_([["pick a file"]])
    .action_({ File.openDialog("", { |path| m.path_(path) }) });
m = MovieView(w, Rect(0,20,360, 260));
)
    // random-pick a tiff from the Help folder
m.path_("Help/*/*/*.tiff".pathMatch.choose);

    // or point it to a movie (you may have that one too):
m.path_("/Library/Application\ Support/iDVD/Tutorial/Movies/Our\ First\ Snowman.mov");


m.start;            // playback
m.muted_(false);    // thank god
m.stop;

    //rate
m.rate_(1);
    // backwards
m.gotoEnd.rate_(-1).start;

    // select a range on the controller and play it
m.rate_(1).playSelectionOnly_(true).start;

    // loopModes:
m.loopMode_(1); // only one direction
m.loopMode_(0).start;   // back and forth



m.stop;
m.gotoBeginning;

    // single steps
m.stepForward;

10.do { m.stepForward; };
m.stepBack;

    // select with shift-drag, copy paste between movieviews or quicktime player
m.editable_(true);


m.showControllerAndAdjustSize(true, true);
    // resize compared to image size:
m.resizeWithMagnification(0.25);

    //goto time (in seconds)
m.currentTime_(1);

    // not there yet, but would be nice to have:
    // startFrame, length
m.setSelection_(20, 15);


m.frame_(frame);    // jump to frame
m.frame.postln; // poll current frame pos
::
