quicktime.app.players
Class QTPlayer

java.lang.Object
  |
  +--quicktime.app.time.Tasking
        |
        +--quicktime.app.players.QTPlayer
All Implemented Interfaces:
AudioSpec, Drawable, Listener, Playable, QTDrawable, Taskable, Timeable, Transformable

public class QTPlayer
extends Tasking
implements QTDrawable, Playable, AudioSpec

The QTPlayer class allows your application to display, play and control any QuickTime movie with the standard QuickTime movie controller.

The QTPlayer does not handle its own events but delegates the event handling to some kind of QTPlayerEventHandler object.

See Also:
QTPlayerEventHandler, MovieController

Fields inherited from interface quicktime.app.players.Playable
kDurationUnknown
 
Fields inherited from interface quicktime.app.time.Taskable
tasker
 
Constructor Summary
QTPlayer(MovieController mc)
          This constructor creates a QTPlayer object given a QuickTime MovieController object.
 
Method Summary
 void addedTo(java.lang.Object interest)
          This method is called by the specified object when the instance of the class that implements this interface is added to the object that is the source of the interest.
 Region getClip()
          This method allows you to obtain information describing a QTPlayer's clipping regions.
 QDRect getDisplayBounds()
          This method is called automatically via the QTCanvas object associated with this client to set the boundary of the movie.
 int getDuration()
          Returns the duration of the media attached to the player.
 QDGraphics getGWorld()
          QTCanvas calls this method to get the destination QDGraphics of its client.
 java.awt.Dimension getInitialSize()
          Deprecated. since QTJava 4.0
 Matrix getMatrix()
          This will return the client's current display transformations
 MovieController getMovieController()
          This allows you to access the contained movie controller.
 QDDimension getOriginalSize()
          This method returns the original size before the transformations specified in the returned matrix are applied.
 float getRate()
          Returns the current rate of the player.
 int getScale()
          Returns the time scale of the player - how many ticks per second.
 int getTime()
          Returns the current time value of the object.
 TimeBase getTimeBase()
          Returns the current time base that provides the time foundation of this object.
 float getVolume()
          Returns the volume setting (0 is silent or muted, 1 is unity gain)
 boolean isControllerSizeReserved()
          Returns true if display space is being reserved for the size of the controller
 boolean isControllerVisible()
          Returns the visible state of the controller.
 boolean isMuted()
          Returns the current mute status
 void redraw(Region invalidRgn)
          QTCanvas calls this method when the client should redraw itself.
 void removedFrom(java.lang.Object interest)
          This method is called by the specified object when the instance of the class that implements this interface is removed from the object that is the source of the interest.
 void setClip(Region theClip)
          This method allows you to set a QTPlayer's clipping region.
 void setControllerSizeReserved(boolean flag)
          Sets parameters on the resize of the controller.
 void setControllerVisible(boolean flag)
          If true makes the MovieController visible, otherwise makes it invisible
 void setDisplayBounds(QDRect bounds)
          This method is called automatically via the QTCanvas object associated with this client to set the boundary of the movie.
 void setGWorld(QDGraphics cgp)
          QTCanvas calls this method to give the client the QDGraphics object it should use to do its drawing.
 void setLocation(int x, int y)
          A convenience method to set the position of a QTDrawable object.
 void setMatrix(Matrix matrix)
          This method sets the current matrix of the Transformable object to the new matrix.
 void setMuted(boolean flag)
          Allows the muting of the specific channel.
 void setRate(float rate)
          Sets the player to the playback rate.
 void setTime(int time)
          Sets the player to the time specified.
 void setVolume(float val)
          Sets the volume.
 void task()
          This method performs idle processing for the QTPlayer and will be automatically called if this object is added to the TaskThread object.
 
Methods inherited from class quicktime.app.time.Tasking
addedToTasker, getDefaultTasker, getTasker, removedFromTasker, setDefaultTasker, startTasking, stopTasking
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QTPlayer

public QTPlayer(MovieController mc)
         throws StdQTException
This constructor creates a QTPlayer object given a QuickTime MovieController object.
Parameters:
mc - a MovieController object
Method Detail

addedTo

public void addedTo(java.lang.Object interest)
This method is called by the specified object when the instance of the class that implements this interface is added to the object that is the source of the interest. The QTPlayer expects that the incoming object is some kind of java.awt.Component - in which case it registers its interest in mouse events from that Component source. If the incoming object is not some kind of Component then nothing is done.
Specified by:
addedTo in interface Listener
Parameters:
interest - the object that is to be the source of interest for the the object that implements this interface.

removedFrom

public void removedFrom(java.lang.Object interest)
This method is called by the specified object when the instance of the class that implements this interface is removed from the object that is the source of the interest. The QTPlayer expects that the incoming object is some kind of java.awt.Component - in which case it removes its interest in mouse events from that Component source. If the incoming object is not some kind of Component then nothing is done.
Specified by:
removedFrom in interface Listener
Parameters:
interest - the object that was the source of interest for the the object that implements this interface.

getMovieController

public MovieController getMovieController()
This allows you to access the contained movie controller.

getInitialSize

public java.awt.Dimension getInitialSize()
                                  throws QTException
Deprecated. since QTJava 4.0

This method returns the original size before the transformations specified in the returned matrix are applied.
See Also:
()

getOriginalSize

public QDDimension getOriginalSize()
                            throws QTException
This method returns the original size before the transformations specified in the returned matrix are applied.
Specified by:
getOriginalSize in interface Transformable
Returns:
the original size of the movie and its controller

getMatrix

public Matrix getMatrix()
                 throws StdQTException
This will return the client's current display transformations
Specified by:
getMatrix in interface Transformable
Returns:
the display transformations of the client

setMatrix

public void setMatrix(Matrix matrix)
               throws QTException
This method sets the current matrix of the Transformable object to the new matrix.
Specified by:
setMatrix in interface Transformable

getGWorld

public QDGraphics getGWorld()
                     throws StdQTException
QTCanvas calls this method to get the destination QDGraphics of its client.
Specified by:
getGWorld in interface QTDrawable
Returns:
a QDGraphics object or null

setGWorld

public void setGWorld(QDGraphics cgp)
               throws QDException,
                      StdQTException
QTCanvas calls this method to give the client the QDGraphics object it should use to do its drawing. If the incoming QDGraphics is the QDGraphics.scratch then the drawable will not be visible and can disable itself. If a client is unable to set the graphics world it should throw an exception.
Specified by:
setGWorld in interface QTDrawable
Parameters:
cgp - a QDGraphics object

redraw

public final void redraw(Region invalidRgn)
                  throws QTException
QTCanvas calls this method when the client should redraw itself. If the canvas is able to discern that only a part of the client's drawing area needs to be redrawn - then this area shall be passed in using the invalidRgn. Otherwise this will be null in which case the client should redraw itself entirely.
Specified by:
redraw in interface Drawable
Parameters:
invalidRgn - the invalidRgn that the client should redraw

setDisplayBounds

public void setDisplayBounds(QDRect bounds)
                      throws QTException
This method is called automatically via the QTCanvas object associated with this client to set the boundary of the movie.
Specified by:
setDisplayBounds in interface Drawable
Parameters:
bounds - a QDRect object describing the boundary

setLocation

public void setLocation(int x,
                        int y)
                 throws QTException
A convenience method to set the position of a QTDrawable object.
Specified by:
setLocation in interface QTDrawable
Parameters:
x - the new x location
y - the new y location

getDisplayBounds

public QDRect getDisplayBounds()
                        throws StdQTException
This method is called automatically via the QTCanvas object associated with this client to set the boundary of the movie.
Specified by:
getDisplayBounds in interface Drawable
Parameters:
bounds - a QDRect object describing the boundary

task

public final void task()
                throws QTException
This method performs idle processing for the QTPlayer and will be automatically called if this object is added to the TaskThread object.
See Also:
quicktime.util.TaskThread

setClip

public void setClip(Region theClip)
             throws QTException
This method allows you to set a QTPlayer's clipping region.
Specified by:
setClip in interface QTDrawable
Parameters:
theClip - a Region that defines the player's clipping region.

getClip

public Region getClip()
               throws QTException
This method allows you to obtain information describing a QTPlayer's clipping regions.
Specified by:
getClip in interface QTDrawable
Returns:
the clipping region of the entire QTPlayer object

setTime

public void setTime(int time)
             throws StdQTException
Sets the player to the time specified. This time value at this level is a totally arbitrary value - what time that means in "real time" is determined by the implementor of the interface, typically the scale value will determine what a "real" time of 1 second is.
Specified by:
setTime in interface Playable
Parameters:
time - the new time value

getTime

public int getTime()
            throws StdQTException
Returns the current time value of the object.
Specified by:
getTime in interface Playable
Returns:
the current time.

getDuration

public int getDuration()
                throws StdQTException
Returns the duration of the media attached to the player. If the player has no media, or does not know the duration of its media it can return the constant kDurationUnknown.
Specified by:
getDuration in interface Playable
Returns:
the media duration.

getTimeBase

public TimeBase getTimeBase()
                     throws QTException
Description copied from interface: Timeable
Returns the current time base that provides the time foundation of this object.
Specified by:
getTimeBase in interface Timeable
Following copied from interface: quicktime.app.time.Timeable
Returns:
a TimeBase

setRate

public void setRate(float rate)
             throws StdQTException
Sets the player to the playback rate. Typically a rate of zero will mean that the player is stopped, a positive value that the player is playing forwards, a negative value that the player is playing backwards.
Specified by:
setRate in interface Timeable
Parameters:
rate - the new playback rate.

getRate

public float getRate()
              throws StdQTException
Returns the current rate of the player.
Specified by:
getRate in interface Timeable
Returns:
the playback rate

getScale

public int getScale()
             throws QTException
Returns the time scale of the player - how many ticks per second.
Specified by:
getScale in interface Playable
Returns:
the current scale.

getVolume

public float getVolume()
                throws QTException
Returns the volume setting (0 is silent or muted, 1 is unity gain)
Specified by:
getVolume in interface AudioSpec

setVolume

public void setVolume(float val)
               throws QTException
Sets the volume.
Specified by:
setVolume in interface AudioSpec

isMuted

public boolean isMuted()
                throws QTException
Returns the current mute status
Specified by:
isMuted in interface AudioSpec

setMuted

public void setMuted(boolean flag)
              throws QTException
Allows the muting of the specific channel. When unmuted the AudioSpec object will return to its current volume setting.
Specified by:
setMuted in interface AudioSpec
Parameters:
flag - turn muting on - true or off - false.

setControllerVisible

public void setControllerVisible(boolean flag)
                          throws QTException
If true makes the MovieController visible, otherwise makes it invisible

isControllerVisible

public boolean isControllerVisible()
                            throws QTException
Returns the visible state of the controller.

setControllerSizeReserved

public void setControllerSizeReserved(boolean flag)
                               throws QTException
Sets parameters on the resize of the controller. If true then the size of controller and its movie will be set with the setDisplayBounds. If false then setDisplayBounds will resize the movie to the specified rectangle. Setting this flag will cause the movie and its controller to be resized.
Parameters:
flag - the resize flag

isControllerSizeReserved

public boolean isControllerSizeReserved()
Returns true if display space is being reserved for the size of the controller