JUCE
Public Member Functions | Static Public Member Functions | List of all members
QuickTimeMovieComponent Class Reference

A window that can play back a QuickTime movie. More...

+ Inheritance diagram for QuickTimeMovieComponent:

Public Member Functions

 QuickTimeMovieComponent ()
 Creates a QuickTimeMovieComponent, initially blank. More...
 
 ~QuickTimeMovieComponent ()
 Destructor. More...
 
bool loadMovie (const File &movieFile, bool isControllerVisible)
 Tries to load a QuickTime movie from a file into the player. More...
 
bool loadMovie (const URL &movieURL, bool isControllerVisible)
 Tries to load a QuickTime movie from a URL into the player. More...
 
bool loadMovie (InputStream *movieStream, bool isControllerVisible)
 Tries to load a QuickTime movie from a stream into the player. More...
 
void closeMovie ()
 Closes the movie, if one is open. More...
 
File getCurrentMovieFile () const
 Returns the movie file that is currently open. More...
 
bool isMovieOpen () const
 Returns true if there's currently a movie open. More...
 
double getMovieDuration () const
 Returns the length of the movie, in seconds. More...
 
void getMovieNormalSize (int &width, int &height) const
 Returns the movie's natural size, in pixels. More...
 
void setBoundsWithCorrectAspectRatio (const Rectangle< int > &spaceToFitWithin, RectanglePlacement placement)
 This will position the component within a given area, keeping its aspect ratio correct according to the movie's normal size. More...
 
void play ()
 Starts the movie playing. More...
 
void stop ()
 Stops the movie playing. More...
 
bool isPlaying () const
 Returns true if the movie is currently playing. More...
 
void goToStart ()
 Moves the movie's position back to the start. More...
 
void setPosition (double seconds)
 Sets the movie's position to a given time. More...
 
double getPosition () const
 Returns the current play position of the movie. More...
 
void setSpeed (float newSpeed)
 Changes the movie playback rate. More...
 
void setMovieVolume (float newVolume)
 Changes the movie's playback volume. More...
 
float getMovieVolume () const
 Returns the movie's playback volume. More...
 
void setLooping (bool shouldLoop)
 Tells the movie whether it should loop. More...
 
bool isLooping () const
 Returns true if the movie is currently looping. More...
 
bool isControllerVisible () const
 True if the native QuickTime controller bar is shown in the window. More...
 
void paint (Graphics &) override
 

Static Public Member Functions

static bool isQuickTimeAvailable () noexcept
 Returns true if QT is installed and working on this machine. More...
 

Detailed Description

A window that can play back a QuickTime movie.

Constructor & Destructor Documentation

QuickTimeMovieComponent::QuickTimeMovieComponent ( )

Creates a QuickTimeMovieComponent, initially blank.

Use the loadMovie() method to load a movie once you've added the component to a window, (or put it on the desktop as a heavyweight window). Loading a movie when the component isn't visible can cause problems, as QuickTime needs a window handle to initialise properly.

QuickTimeMovieComponent::~QuickTimeMovieComponent ( )

Destructor.

Member Function Documentation

static bool QuickTimeMovieComponent::isQuickTimeAvailable ( )
staticnoexcept

Returns true if QT is installed and working on this machine.

bool QuickTimeMovieComponent::loadMovie ( const File movieFile,
bool  isControllerVisible 
)

Tries to load a QuickTime movie from a file into the player.

It's best to call this function once you've added the component to a window, (or put it on the desktop as a heavyweight window). Loading a movie when the component isn't visible can cause problems, because QuickTime needs a window handle to do its stuff.

Parameters
movieFilethe .mov file to open
isControllerVisiblewhether to show a controller bar at the bottom
Returns
true if the movie opens successfully
bool QuickTimeMovieComponent::loadMovie ( const URL movieURL,
bool  isControllerVisible 
)

Tries to load a QuickTime movie from a URL into the player.

It's best to call this function once you've added the component to a window, (or put it on the desktop as a heavyweight window). Loading a movie when the component isn't visible can cause problems, because QuickTime needs a window handle to do its stuff.

Parameters
movieURLthe .mov file to open
isControllerVisiblewhether to show a controller bar at the bottom
Returns
true if the movie opens successfully
bool QuickTimeMovieComponent::loadMovie ( InputStream movieStream,
bool  isControllerVisible 
)

Tries to load a QuickTime movie from a stream into the player.

It's best to call this function once you've added the component to a window, (or put it on the desktop as a heavyweight window). Loading a movie when the component isn't visible can cause problems, because QuickTime needs a window handle to do its stuff.

Parameters
movieStreama stream containing a .mov file. The component may try to read the whole stream before playing, rather than streaming from it.
isControllerVisiblewhether to show a controller bar at the bottom
Returns
true if the movie opens successfully
void QuickTimeMovieComponent::closeMovie ( )

Closes the movie, if one is open.

File QuickTimeMovieComponent::getCurrentMovieFile ( ) const

Returns the movie file that is currently open.

If there isn't one, this returns File::nonexistent

bool QuickTimeMovieComponent::isMovieOpen ( ) const

Returns true if there's currently a movie open.

double QuickTimeMovieComponent::getMovieDuration ( ) const

Returns the length of the movie, in seconds.

void QuickTimeMovieComponent::getMovieNormalSize ( int &  width,
int &  height 
) const

Returns the movie's natural size, in pixels.

You can use this to resize the component to show the movie at its preferred scale.

If no movie is loaded, the size returned will be 0 x 0.

void QuickTimeMovieComponent::setBoundsWithCorrectAspectRatio ( const Rectangle< int > &  spaceToFitWithin,
RectanglePlacement  placement 
)

This will position the component within a given area, keeping its aspect ratio correct according to the movie's normal size.

The component will be made as large as it can go within the space, and will be aligned according to the justification value if this means there are gaps at the top or sides.

void QuickTimeMovieComponent::play ( )

Starts the movie playing.

void QuickTimeMovieComponent::stop ( )

Stops the movie playing.

bool QuickTimeMovieComponent::isPlaying ( ) const

Returns true if the movie is currently playing.

void QuickTimeMovieComponent::goToStart ( )

Moves the movie's position back to the start.

void QuickTimeMovieComponent::setPosition ( double  seconds)

Sets the movie's position to a given time.

double QuickTimeMovieComponent::getPosition ( ) const

Returns the current play position of the movie.

void QuickTimeMovieComponent::setSpeed ( float  newSpeed)

Changes the movie playback rate.

A value of 1 is normal speed, greater values play it proportionately faster, smaller values play it slower.

void QuickTimeMovieComponent::setMovieVolume ( float  newVolume)

Changes the movie's playback volume.

Parameters
newVolumethe volume in the range 0 (silent) to 1.0 (full)
float QuickTimeMovieComponent::getMovieVolume ( ) const

Returns the movie's playback volume.

Returns
the volume in the range 0 (silent) to 1.0 (full)
void QuickTimeMovieComponent::setLooping ( bool  shouldLoop)

Tells the movie whether it should loop.

bool QuickTimeMovieComponent::isLooping ( ) const

Returns true if the movie is currently looping.

See also
setLooping
bool QuickTimeMovieComponent::isControllerVisible ( ) const

True if the native QuickTime controller bar is shown in the window.

See also
loadMovie
void QuickTimeMovieComponent::paint ( Graphics )
override

The documentation for this class was generated from the following file: