The Gazelle player JAR is designed for easy incusion inside Java applets and applications.
Gazelle encapsulates all of it's functionality in three classes: GazelleProject, MoviePlayer and PlayerThread. There is also a PlayerThreadListener interface to allow feedback of important movie events. Note that GazellePlayer.jar is a subset of GazelleEditor.jar, so the following description will apply to both JARs.
An example applet that uses the Gazelle JAR can be found here.
Classes:
com.kitfox.gazelle.project.GazelleProject
This contains the data of the Gazelle movie.
public GazelleProject(URL pr, String pn, Component comp) throws Exception
- Loads a Gazelle project from a url. 'pr' must be a URL of the path of the project, not including the project name itself. 'pn' is the name of the project. 'comp' is a pointer to any component in your project that can be used as a refrence for loading images. For example, to load the movie 'sunrise.spj':
class MyMovie extends JFrame {
GazelleProject project;
MyMovie() {
URL url = new URL("http://www.mydomain.com/movies/");
project = new GazelleProject(url, "sunrise.spj",
this);
}
}
public void setCurFrame(int frame)
- Sets the frame displayed by the MoviePlayer.
This will be called by the PlayerThread if you use one.
com.kitfox.gazelle.project.graphics.MoviePlayer
This is a control that extends JComponent
that displays Gazelle movies within it's window area.
public MoviePlayer ()
- Contructs a window capable of showing
Gazelle movies.
public void setProject(GazelleProject p)
- Sets the project the movie player is
showing.
com.kitfox.gazelle.project.graphics.PlayerThread
This is an optional class you can use to
simplify the playing of movies. This class extends Thread.
public PlayerThread (MoviePlayer mp)
- Builds a new player thread. 'mp'
must be a pointer to the MoviePlayer.
public void addPlayerThreadListener(PlayerThreadListener
ptl)
public void removePlayerThreadListener(PlayerThreadListener
ptl)
- Adds/removes classes implementing PlayerThreadListener
public boolean isPlaying()
- True if the movie is currently playing.
public void reverse()
- Plays the movie in reverse
public void forward()
- Plays the movie normally
public void pause()
- Stops movie play
public void firstFrame()
public void lastFrame()
- Set movie to it's first/last frame
com.kitfox.gazelle.project.graphics.PlayerThreadListener
This is an interface you can use to be
notified of PlayerThread events.
public void playerThreadEvent(int evt)
- Method which reports on the event which occurred. The type of event is an integer which is one of the following:
static final int EV_STOP = 1;
static final int EV_PLAY = 2;
static final int EV_END_OF_MOVIE = 3;
static final int EV_START_OF_MOVIE = 4;
EV_STOP - The movie has halted play.
EV_PLAY - The movie has begun playing.
EV_END_OF_MOVIE - The movie has just hit
it's last frame.
EV_START_OF_MOVIE - The movie has just
hit it's first frame.
Note that if the movie is looping, if it
is playing forward only EV_END_OF_MOVIE will be thrown, while if playing
in reverse EV_START_OF_MOVIE will be thrown.