- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Slots | Signals | Public Member Functions | Protected Attributes

# VideoPlayer Class Reference

Search for all occurrences

## 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@kde.org>

Definition at line 64 of file videoplayer.h.

`#include <Phonon/VideoPlayer>`

Inheritance diagram for VideoPlayer:
[legend]

List of all members.

## Public Slots
void | load (const Phonon::MediaSource &source)
| Starts preloading the media data and fill audiobuffers in the backend.
void | play (const Phonon::MediaSource &source)
| Play the media at the given URL.
void | play ()
| Continues playback of a paused media.
void | pause ()
| Pauses the playback.
void | stop ()
| Stops the playback.
void | seek (qint64 ms)
| Seeks to the requested time.
void | setVolume (float volume)
| Sets the volume of the output as voltage factor.
## Signals
void | finished ()
| This signal is emitted when the playback finished.
## Public Member Functions
| VideoPlayer (Phonon::Category category, QWidget *parent=0)
| Constructs a new VideoPlayer instance.
| VideoPlayer (QWidget *parent=0)
| Constructs a new video widget with a `parent` using Phonon::VideoCategory as its category.
| ~VideoPlayer ()
| On destruction the playback is stopped, also the audio output is removed so that the desktop mixer will not show the application anymore.
qint64 | totalTime () const
| Get the total time (in milliseconds) of the file currently being played.
qint64 | currentTime () const
| Get the current time (in milliseconds) of the file currently being played.
float | volume () const
| This is the current volume of the output as voltage factor.
bool | isPlaying () const
bool | isPaused () const
MediaObject * | mediaObject () const
| getter for the MediaObject.
AudioOutput * | audioOutput () const
| getter for the AudioOutput.
VideoWidget * | videoWidget () const
| getter for the VideoWidget.
## Protected Attributes
VideoPlayerPrivate *const | d

## Constructor & Destructor Documentation

VideoPlayer | ( | Phonon::Category | category,
|  | QWidget * | parent = `0`
| ) |  | `[explicit]`

Constructs a new VideoPlayer instance.

Parameters:

  category | The category used for the audio output device.
  parent | The QObject parent.

VideoPlayer | ( | QWidget * | parent = `0` | ) |

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

Parameters:

  parent | The QObject parent.

~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

qint64 totalTime | ( |  | ) | const

Search for all occurrences

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

qint64 currentTime | ( |  | ) | const

Search for all occurrences

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

float volume | ( |  | ) | const

Search for all occurrences

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%

bool isPlaying | ( |  | ) | const

Search for all occurrences

Returns:
  `true` if it is currently playing
  `false` if it is currently stopped or paused

bool isPaused | ( |  | ) | const

Search for all occurrences

Returns:
  `true` if it is currently paused
  `false` if it is currently playing or stopped

MediaObject* mediaObject | ( |  | ) | const

Search for all occurrences

getter for the MediaObject.

AudioOutput* audioOutput | ( |  | ) | const

Search for all occurrences

getter for the AudioOutput.

VideoWidget* videoWidget | ( |  | ) | const

Search for all occurrences

getter for the VideoWidget.

void load | ( | const Phonon::MediaSource & | source | ) | `[slot]`

Search for all occurrences

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).

void play | ( | const Phonon::MediaSource & | source | ) | `[slot]`

Search for all occurrences

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 play | ( |  | ) | `[slot]`

Search for all occurrences

Continues playback of a paused media.

Restarts playback of a stopped media.

void pause | ( |  | ) | `[slot]`

Search for all occurrences

Pauses the playback.

void stop | ( |  | ) | `[slot]`

Search for all occurrences

Stops the playback.

void seek | ( | qint64 | ms | ) | `[slot]`

Search for all occurrences

Seeks to the requested time.

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

Parameters:

  ms | Time in milliseconds from the start of the media.

void setVolume | ( | float | volume | ) | `[slot]`

Search for all occurrences

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 finished | ( |  | ) | `[signal]`

Search for all occurrences

This signal is emitted when the playback finished.

## Member Data Documentation

VideoPlayerPrivate* const d `[protected]`

Search for all occurrences

Definition at line 196 of file videoplayer.h.

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

- phonon/videoplayer.h

VideoPlayer VideoPlayer VideoPlayer VideoPlayer VideoPlayer VideoPlayer VideoPlayer VideoPlayer VideoPlayer VideoPlayer
VideoPlayer VideoPlayer VideoPlayer VideoPlayer VideoPlayer VideoPlayer VideoPlayer VideoPlayer VideoPlayer VideoPlayer