# class VideoPlayer

###

Module | phonon
Namespace | Phonon
Class | VideoPlayer
Inherits | QWidget

\class VideoPlayer videoplayer.h Phonon/VideoPlayer 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(Phonon.VideoCategory, parentWidget);
    connect(player, SIGNAL(finished()), player, SLOT(deleteLater()));
    player->play(url);

Author Matthias Kretz <kretz@kde.org>

### methods

- VideoPlayer (category, parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  category | Phonon.Category |
  parent | QWidget | 0

  Constructs a new %VideoPlayer instance.

  category - The category used for the audio output device.

  parent - The QObject parent.

- audioOutput ( )

  returns Phonon.AudioOutput

  getter for the AudioOutput.

- currentTime ( )

  returns qint64

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

- finished ( )

  returns Nothing
  SIGNAL ("finished ()")

  This signal is emitted when the playback finished.

- isPaused ( )

  returns bool

  \returns true if it is currently paused \returns false if it is currently playing or stopped

- isPlaying ( )

  returns bool

  \returns true if it is currently playing \returns false if it is currently stopped or paused

- load (source)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  source | Phonon.MediaSource |

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

  returns Phonon.MediaObject

  getter for the MediaObject.

- pause ( )

  returns Nothing

  Pauses the playback.

- play (source)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  source | Phonon.MediaSource |

  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.

- play ( )

  returns Nothing

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

- seek (ms)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  ms | qint64 |

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

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

- setVolume (volume)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  volume | float |

  Sets the volume of the output as voltage factor.

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

- stop ( )

  returns Nothing

  Stops the playback.

- totalTime ( )

  returns qint64

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

- videoWidget ( )

  returns Phonon.VideoWidget

  getter for the VideoWidget.

- volume ( )

  returns float

  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%