
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheVideoPlayer widget is used to perform playback of video.More...
| Header: | #include <Phonon/VideoPlayer> |
| Since: | Qt 4.4 |
| Inherits: | QWidget |
| VideoPlayer(Phonon::Category category, QWidget * parent = 0) | |
| VideoPlayer(QWidget * parent = 0) | |
| ~VideoPlayer() | |
| AudioOutput * | audioOutput() const |
| qint64 | currentTime() const |
| bool | isPaused() const |
| bool | isPlaying() const |
| MediaObject * | mediaObject() const |
| qint64 | totalTime() const |
| VideoWidget * | videoWidget() const |
| float | volume() const |
| void | load(const Phonon::MediaSource & source) |
| void | pause() |
| void | play(const Phonon::MediaSource & source) |
| void | play() |
| void | seek(qint64 ms) |
| void | setVolume(float volume) |
| void | stop() |
| void | finished() |
TheVideoPlayer widget is used to perform playback of video.
WithVideoPlayer you can get results quickly and easily. You can do the standard playback tasks likeplay(),pause(), andstop(), but also set a playback volume and seek - if the media and backend supports seeking.
VideoPlayer is provided for convenience and removes the need to create a media graph with aMediaObject,AudioOutput, andVideoWidget. If you need functionality not supported by the player, you can build thisgraph yourself.
Keep in mind that when theVideoPlayer instance is deleted the playback will stop.
Note also that most of the functions in this class are asynchronous. For instance, a media source may not play immediately after you call theplay() function.
A play and forget code example:
VideoPlayer*player=newVideoPlayer(Phonon::VideoCategory, parentWidget);connect(player, SIGNAL(finished()), player, SLOT(deleteLater()));player->play(url);
See alsoPhonon Module andMediaObject.
Constructs a newVideoPlayer instance with the specifiedparent.
category is the category used for the audio output device.
Constructs a new video widget with aparent usingPhonon::VideoCategory as its category.
parent TheQObject parent.
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 useVideoPlayer butMediaObject, VideoPath and VideoOutput.
Returns the audio output object being used by the player.
Get the current time (in milliseconds) of the file currently being played.
[signal]void VideoPlayer::finished()This signal is emitted when the playback finished.
Returns true if it is currently paused; otherwise returns false if it is currently playing or stopped.
Returns true if it is currently playing; otherwise returns false if it is currently stopped or paused
[slot]void VideoPlayer::load(constPhonon::MediaSource & source)Starts pre-loading the media data from the specifiedsource and filling audio buffers in the backend.
When there's already a media playing (or paused) it will be stopped (the finished signal will not be emitted).
See alsoMediaObject::setCurrentSource().
Returns the media object being used by the player.
The media object can be accessed directly instead of using theVideoPlayers convenience functions, e.g.,play() andstop(). It is also possible to give the object to other Phonon widgets, e.g., aSeekSlider or aVolumeSlider.
See alsoPhonon::SeekSlider andPhonon::MediaObject.
[slot]void VideoPlayer::pause()Pauses the playback.
See alsoMediaObject::pause().
[slot]void VideoPlayer::play(constPhonon::MediaSource & source)Plays the media from the givensource. 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 useMediaObject 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.
[slot]void VideoPlayer::play()Continues playback of paused media. Restarts playback of a stopped (or newly loaded) media.
See alsoMediaObject::play() andplay().
[slot]void VideoPlayer::seek(qint64 ms)Seeks to the requested time. Note that the backend is free to ignore the seek request if the media source isn't seekable; you can check this by asking the media object of theVideoPlayer.
player->mediaObject()->isSeekable();
Thems parameter is the time in milliseconds from the start of the media.
The call is asynchronous, socurrentTime() can still be the old value right after this method was called. If all you need is a slider that shows the current position and allows the user to seek, use the classSeekSlider.
See alsoMediaObject::seek(),MediaObject::isSeekable(), andmediaObject().
[slot]void VideoPlayer::setVolume(float volume)Sets thevolume of the output as voltage factor.
1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means 0%
See alsovolume().
[slot]void VideoPlayer::stop()Stops the playback.
See alsoMediaObject::stop().
Get the total time (in milliseconds) of the file currently being played.
Returns the video widget being used by the player.
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%
See alsosetVolume().
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.