JUCE  v4.3.1-6-gf5dafc4
JUCE API
QuickTimeMovieComponent Class Reference

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

#include <juce_QuickTimeMovieComponent.h>

Inheritance diagram for QuickTimeMovieComponent:
Collaboration diagram for QuickTimeMovieComponent:

Public Member Functions

 QuickTimeMovieComponent ()
 Creates a QuickTimeMovieComponent, initially blank. More...
 
 ~QuickTimeMovieComponent ()
 Destructor. More...
 
void closeMovie ()
 Closes the movie, if one is open. More...
 
File getCurrentMovieFile () const
 Returns the movie file that is currently 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...
 
float getMovieVolume () const
 Returns the movie's playback volume. More...
 
double getPosition () const
 Returns the current play position of the movie. More...
 
void goToStart ()
 Moves the movie's position back to the start. More...
 
bool isControllerVisible () const
 True if the native QuickTime controller bar is shown in the window. More...
 
bool isLooping () const
 Returns true if the movie is currently looping. More...
 
bool isMovieOpen () const
 Returns true if there's currently a movie open. More...
 
bool isPlaying () const
 Returns true if the movie is currently playing. 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 paint (Graphics &) override
 
void play ()
 Starts the movie playing. 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 setLooping (bool shouldLoop)
 Tells the movie whether it should loop. More...
 
void setMovieVolume (float newVolume)
 Changes the movie's playback volume. More...
 
void setPosition (double seconds)
 Sets the movie's position to a given time. More...
 
void setSpeed (float newSpeed)
 Changes the movie playback rate. More...
 
void stop ()
 Stops the movie playing. More...
 

Static Public Member Functions

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

Private Member Functions

void createControlIfNeeded ()
 
bool isControlCreated () const
 
void parentHierarchyChanged () override
 
void visibilityChanged () override
 

Private Attributes

bool controllerVisible
 
bool looping
 
File movieFile
 
bool movieLoaded
 
ScopedPointer< Pimpl > pimpl
 

Friends

struct ContainerDeletePolicy< Pimpl >
 

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

void QuickTimeMovieComponent::closeMovie ( )

Closes the movie, if one is open.

void QuickTimeMovieComponent::createControlIfNeeded ( )
private
File QuickTimeMovieComponent::getCurrentMovieFile ( ) const

Returns the movie file that is currently open.

If there isn't one, this returns File()

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.

float QuickTimeMovieComponent::getMovieVolume ( ) const

Returns the movie's playback volume.

Returns
the volume in the range 0 (silent) to 1.0 (full)
double QuickTimeMovieComponent::getPosition ( ) const

Returns the current play position of the movie.

void QuickTimeMovieComponent::goToStart ( )

Moves the movie's position back to the start.

bool QuickTimeMovieComponent::isControlCreated ( ) const
private
bool QuickTimeMovieComponent::isControllerVisible ( ) const

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

See also
loadMovie
bool QuickTimeMovieComponent::isLooping ( ) const

Returns true if the movie is currently looping.

See also
setLooping
bool QuickTimeMovieComponent::isMovieOpen ( ) const

Returns true if there's currently a movie open.

bool QuickTimeMovieComponent::isPlaying ( ) const

Returns true if the movie is currently playing.

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::paint ( Graphics )
override
void QuickTimeMovieComponent::parentHierarchyChanged ( )
overrideprivate
void QuickTimeMovieComponent::play ( )

Starts the movie playing.

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::setLooping ( bool  shouldLoop)

Tells the movie whether it should loop.

void QuickTimeMovieComponent::setMovieVolume ( float  newVolume)

Changes the movie's playback volume.

Parameters
newVolumethe volume in the range 0 (silent) to 1.0 (full)
void QuickTimeMovieComponent::setPosition ( double  seconds)

Sets the movie's position to a given time.

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::stop ( )

Stops the movie playing.

void QuickTimeMovieComponent::visibilityChanged ( )
overrideprivate

Friends And Related Function Documentation

friend struct ContainerDeletePolicy< Pimpl >
friend

Member Data Documentation

bool QuickTimeMovieComponent::controllerVisible
private
bool QuickTimeMovieComponent::looping
private
File QuickTimeMovieComponent::movieFile
private
bool QuickTimeMovieComponent::movieLoaded
private
ScopedPointer<Pimpl> QuickTimeMovieComponent::pimpl
private

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