Phonon  4.7.0
All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Phonon::VideoPlayer Class Reference

Playback class for simple tasks. More...

#include <phonon/VideoPlayer>

Inheritance diagram for Phonon::VideoPlayer:

Public Slots

void load (const Phonon::MediaSource &source)
 
void play (const Phonon::MediaSource &source)
 
void play ()
 
void pause ()
 
void stop ()
 
void seek (qint64 ms)
 
void setVolume (float volume)
 

Signals

void finished ()
 

Public Member Functions

 VideoPlayer (Phonon::Category category, QWidget *parent=0)
 
 VideoPlayer (QWidget *parent=0)
 
 ~VideoPlayer ()
 
qint64 totalTime () const
 
qint64 currentTime () const
 
float volume () const
 
bool isPlaying () const
 
bool isPaused () const
 
MediaObjectmediaObject () const
 
AudioOutputaudioOutput () const
 
VideoWidgetvideoWidget () const
 

Protected Member Functions

bool event (QEvent *)
 

Protected Attributes

VideoPlayerPrivate *const d
 

Detailed Description

Playback class for simple tasks.

With VideoPlayer you can get results quickly and easily. You can do the standard playback tasks like play, pause and stop, but also set a playback volume and seek (there's no guarantee that the seek will work, though).

Keep in mind that when the VideoPlayer instance is deleted the playback will stop.

A play and forget code example:

VideoPlayer *player = new VideoPlayer(parentWidget);
connect(player, SIGNAL(finished()), player, SLOT(deleteLater()));
player->play(url);
Author
Matthias Kretz kretz.nosp@m.@kde.nosp@m..org

Constructor & Destructor Documentation

Phonon::VideoPlayer::VideoPlayer ( Phonon::Category  category,
QWidget *  parent = 0 
)
explicit

Constructs a new VideoPlayer instance.

Parameters
categoryThe category used for the audio output device.
parentThe QObject parent.
Phonon::VideoPlayer::VideoPlayer ( QWidget *  parent = 0)

Constructs a new video widget with a parent using Phonon::VideoCategory as its category.

Parameters
parentThe QObject parent.
Phonon::VideoPlayer::~VideoPlayer ( )

On destruction the playback is stopped, also the audio output is removed so that the desktop mixer will not show the application anymore. If you need a persistent audio output don't use VideoPlayer but MediaObject, VideoPath and VideoOutput.

Member Function Documentation

AudioOutput * Phonon::VideoPlayer::audioOutput ( ) const

getter for the AudioOutput.

qint64 Phonon::VideoPlayer::currentTime ( ) const

Get the current time (in milliseconds) of the file currently being played.

void Phonon::VideoPlayer::finished ( )
signal

This signal is emitted when the playback finished.

bool Phonon::VideoPlayer::isPaused ( ) const
Returns
true if it is currently paused
false if it is currently playing or stopped
bool Phonon::VideoPlayer::isPlaying ( ) const
Returns
true if it is currently playing
false if it is currently stopped or paused
void Phonon::VideoPlayer::load ( const Phonon::MediaSource source)
slot

Starts preloading the media data and fill audiobuffers in the backend.

When there's already a media playing (or paused) it will be stopped (the finished signal will not be emitted).

MediaObject * Phonon::VideoPlayer::mediaObject ( ) const

getter for the MediaObject.

void Phonon::VideoPlayer::pause ( )
slot

Pauses the playback.

void Phonon::VideoPlayer::play ( const Phonon::MediaSource source)
slot

Play the media at the given URL. Starts playback as fast as possible. This can take a considerable time depending on the URL and the backend.

If you need low latency between calling play() and the sound actually starting to play on your output device you need to use MediaObject and be able to set the URL before calling play(). Note that

audioPlayer->load(url);
audioPlayer->play();

doesn't make a difference: the application should be idle between the load and play calls so that the backend can start preloading the media and fill audio buffers.

void Phonon::VideoPlayer::play ( )
slot

Continues playback of a paused media. Restarts playback of a stopped media.

void Phonon::VideoPlayer::seek ( qint64  ms)
slot

Seeks to the requested time. Note that the backend is free to ignore the seek request if the media source isn't seekable.

Parameters
msTime in milliseconds from the start of the media.
void Phonon::VideoPlayer::setVolume ( float  volume)
slot

Sets the volume of the output as voltage factor.

1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means 0%

void Phonon::VideoPlayer::stop ( )
slot

Stops the playback.

qint64 Phonon::VideoPlayer::totalTime ( ) const

Get the total time (in milliseconds) of the file currently being played.

VideoWidget * Phonon::VideoPlayer::videoWidget ( ) const

getter for the VideoWidget.

float Phonon::VideoPlayer::volume ( ) const

This is the current volume of the output as voltage factor.

1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means 0%


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