Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

VideoPlayer Class

(Phonon::VideoPlayer)

TheVideoPlayer widget is used to perform playback of video.More...

Header:#include <Phonon/VideoPlayer>
Since: Qt 4.4
Inherits:QWidget

Public Functions

VideoPlayer(Phonon::Category category, QWidget * parent = 0)
VideoPlayer(QWidget * parent = 0)
~VideoPlayer()
AudioOutput *audioOutput() const
qint64currentTime() const
boolisPaused() const
boolisPlaying() const
MediaObject *mediaObject() const
qint64totalTime() const
VideoWidget *videoWidget() const
floatvolume() const

Public Slots

voidload(const Phonon::MediaSource & source)
voidpause()
voidplay(const Phonon::MediaSource & source)
voidplay()
voidseek(qint64 ms)
voidsetVolume(float volume)
voidstop()
  • 19 public slots inherited fromQWidget
  • 1 public slot inherited fromQObject

Signals

voidfinished()

Additional Inherited Members

  • 58 properties inherited fromQWidget
  • 1 property inherited fromQObject
  • 4 static public members inherited fromQWidget
  • 7 static public members inherited fromQObject
  • 37 protected functions inherited fromQWidget
  • 8 protected functions inherited fromQObject
  • 1 protected function inherited fromQPaintDevice
  • 1 protected slot inherited fromQWidget

Detailed Description

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.

Member Function Documentation

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

Constructs a newVideoPlayer instance with the specifiedparent.

category is the category used for the audio output device.

VideoPlayer::VideoPlayer(QWidget * parent = 0)

Constructs a new video widget with aparent usingPhonon::VideoCategory as its category.

parent TheQObject parent.

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 useVideoPlayer butMediaObject, VideoPath and VideoOutput.

AudioOutput * VideoPlayer::audioOutput() const

Returns the audio output object being used by the player.

qint64 VideoPlayer::currentTime() const

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

[signal]void VideoPlayer::finished()

This signal is emitted when the playback finished.

bool VideoPlayer::isPaused() const

Returns true if it is currently paused; otherwise returns false if it is currently playing or stopped.

bool VideoPlayer::isPlaying() const

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

MediaObject * VideoPlayer::mediaObject() const

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

qint64 VideoPlayer::totalTime() const

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

VideoWidget * VideoPlayer::videoWidget() const

Returns the video widget being used by the player.

float 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%

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.


[8]ページ先頭

©2009-2025 Movatter.jp