6
6
td.postheader { font-family: sans-serif }
7
7
tr.address { font-family: sans-serif }
8
8
body { background: #ffffff; color: black; }
9
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">Phonon.VideoPlayer Class Reference<br /><sup><sup>[<a href="phonon.html">phonon</a> module]</sup></sup></h1><p>The VideoPlayer widget is used to perform playback of video. <a href="#details">More...</a></p>
9
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">Phonon.VideoPlayer Class Reference<br /><sup><sup>[<a href="phonon.html">phonon</a> module]</sup></sup></h1><p>The VideoPlayer widget is used to perform playback of video.
10
<a href="#details">More...</a></p>
10
12
<p>Inherits <a href="qwidget.html">QWidget</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="phonon-videoplayer.html#VideoPlayer">__init__</a></b> (<i>self</i>, Category, QWidget <i>parent</i> = None)</li><li><div class="fn" /><b><a href="phonon-videoplayer.html#VideoPlayer-2">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" />AudioOutput <b><a href="phonon-videoplayer.html#audioOutput">audioOutput</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="phonon-videoplayer.html#currentTime">currentTime</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="phonon-videoplayer.html#isPaused">isPaused</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="phonon-videoplayer.html#isPlaying">isPlaying</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="phonon-videoplayer.html#load">load</a></b> (<i>self</i>, MediaSource)</li><li><div class="fn" />MediaObject <b><a href="phonon-videoplayer.html#mediaObject">mediaObject</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="phonon-videoplayer.html#pause">pause</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="phonon-videoplayer.html#play">play</a></b> (<i>self</i>, MediaSource)</li><li><div class="fn" /><b><a href="phonon-videoplayer.html#play-2">play</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="phonon-videoplayer.html#seek">seek</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="phonon-videoplayer.html#setVolume">setVolume</a></b> (<i>self</i>, float)</li><li><div class="fn" /><b><a href="phonon-videoplayer.html#stop">stop</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="phonon-videoplayer.html#totalTime">totalTime</a></b> (<i>self</i>)</li><li><div class="fn" />VideoWidget <b><a href="phonon-videoplayer.html#videoWidget">videoWidget</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="phonon-videoplayer.html#volume">volume</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="phonon-videoplayer.html#finished">finished</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The VideoPlayer widget is used to perform playback of video.</p>
11
<p>With VideoPlayer you can get results quickly and easily. You can do the standard playback tasks like <a href="phonon-videoplayer.html#play">play</a>(), <a href="phonon-videoplayer.html#pause">pause</a>(), and <a href="phonon-videoplayer.html#stop">stop</a>(), but also set a playback volume and seek - if the media and backend supports seeking.</p>
12
<p>VideoPlayer is provided for convenience and removes the need to create a media graph with a <a href="phonon-mediaobject.html">MediaObject</a>, <a href="phonon-audiooutput.html">AudioOutput</a>, and <a href="phonon-videowidget.html">VideoWidget</a>. If you need functionality not supported by the player, you can build this <a href="phonon-overview.html#building-graphs">graph</a> yourself.</p>
13
<p>Keep in mind that when the VideoPlayer instance is deleted the playback will stop.</p>
14
<p>Note also that most of the functions in this class are asynchronous. For instance, a media source may not play immediately after you call the <a href="phonon-videoplayer.html#play">play</a>() function.</p>
13
<p>With VideoPlayer you can get results quickly and easily. You can
14
do the standard playback tasks like <a href="phonon-videoplayer.html#play">play</a>(), <a href="phonon-videoplayer.html#pause">pause</a>(), and <a href="phonon-videoplayer.html#stop">stop</a>(), but also set a playback
15
volume and seek - if the media and backend supports seeking.</p>
16
<p>VideoPlayer is provided for convenience and removes the need to
17
create a media graph with a <a href="phonon-mediaobject.html">MediaObject</a>, <a href="phonon-audiooutput.html">AudioOutput</a>, and <a href="phonon-videowidget.html">VideoWidget</a>. If you need
18
functionality not supported by the player, you can build this
19
<a href="phonon-overview.html#building-graphs">graph</a>
21
<p>Keep in mind that when the VideoPlayer instance is deleted the
22
playback will stop.</p>
23
<p>Note also that most of the functions in this class are
24
asynchronous. For instance, a media source may not play immediately
25
after you call the <a href="phonon-videoplayer.html#play">play</a>() function.</p>
15
26
<p>A play and forget code example:</p>
16
<pre> VideoPlayer *player = new VideoPlayer(Phonon.VideoCategory, parentWidget);
27
<pre class="highlightedCode brush: cpp">
28
VideoPlayer *player = new VideoPlayer(Phonon.VideoCategory, parentWidget);
17
29
connect(player, SIGNAL(finished()), player, SLOT(deleteLater()));
18
player->play(url);</pre>
19
<p>See also <a href="phonon-module.html">Phonon Module</a> and <a href="phonon-mediaobject.html">MediaObject</a>.</p>
20
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="VideoPlayer" />VideoPlayer.__init__ (<i>self</i>, <a href="phonon.html#Category-enum">Category</a>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new <a href="phonon-videoplayer.html">VideoPlayer</a> instance with the specified <i>parent</i>.</p>
21
<p><i>category</i> is the category used for the audio output device.</p>
22
<h3 class="fn"><a name="VideoPlayer-2" />VideoPlayer.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new video widget with a <i>parent</i> using <a href="phonon.html#Category-enum">Phonon.VideoCategory</a> as its category.</p>
31
</pre><hr /><h2>Method Documentation</h2><h3 class="fn"><a name="VideoPlayer" />VideoPlayer.__init__ (<i>self</i>, <a href="phonon.html#Category-enum">Category</a>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new <a href="phonon-videoplayer.html">VideoPlayer</a> instance with the
32
specified <i>parent</i>.</p>
33
<p><i>category</i> is the category used for the audio output
37
<h3 class="fn"><a name="VideoPlayer-2" />VideoPlayer.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new video widget with a <i>parent</i> using
38
<a href="phonon.html#Category-enum">Phonon.VideoCategory</a> as
23
40
<p><i>parent</i> The <a href="qobject.html">QObject</a> parent.</p>
24
<a name="//apple_ref/cpp/instm/Phonon::VideoPlayer/~VideoPlayer" />
25
<h3 class="fn"><a name="audioOutput" /><a href="phonon-audiooutput.html">AudioOutput</a> VideoPlayer.audioOutput (<i>self</i>)</h3><p>Returns the audio output object being used by the player.</p>
26
<a name="//apple_ref/cpp/instm/Phonon::VideoPlayer/currentTime" />
27
<h3 class="fn"><a name="currentTime" />int VideoPlayer.currentTime (<i>self</i>)</h3><p>Get the current time (in milliseconds) of the file currently being played.</p>
28
<a name="//apple_ref/cpp/instm/Phonon::VideoPlayer/finished" />
29
<h3 class="fn"><a name="isPaused" />bool VideoPlayer.isPaused (<i>self</i>)</h3><p>Returns true if it is currently paused; otherwise returns false if it is currently playing or stopped.</p>
30
<a name="//apple_ref/cpp/instm/Phonon::VideoPlayer/isPlaying" />
31
<h3 class="fn"><a name="isPlaying" />bool VideoPlayer.isPlaying (<i>self</i>)</h3><p>Returns true if it is currently playing; otherwise returns false if it is currently stopped or paused</p>
32
<a name="//apple_ref/cpp/instm/Phonon::VideoPlayer/load" />
33
<h3 class="fn"><a name="load" />VideoPlayer.load (<i>self</i>, <a href="phonon-mediasource.html">MediaSource</a>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void load(const Phonon::MediaSource&)</tt>.</p><p>Starts pre-loading the media data from the specified <i>source</i> and filling audio buffers in the backend.</p>
34
<p>When there's already a media playing (or paused) it will be stopped (the finished signal will not be emitted).</p>
43
<h3 class="fn"><a name="audioOutput" /><a href="phonon-audiooutput.html">AudioOutput</a> VideoPlayer.audioOutput (<i>self</i>)</h3><h3 class="fn"><a name="currentTime" />int VideoPlayer.currentTime (<i>self</i>)</h3><p>Get the current time (in milliseconds) of the file currently
47
<h3 class="fn"><a name="isPaused" />bool VideoPlayer.isPaused (<i>self</i>)</h3><p>Returns true if it is currently paused; otherwise returns false
48
if it is currently playing or stopped.</p>
51
<h3 class="fn"><a name="isPlaying" />bool VideoPlayer.isPlaying (<i>self</i>)</h3><p>Returns true if it is currently playing; otherwise returns false
52
if it is currently stopped or paused</p>
55
<h3 class="fn"><a name="load" />VideoPlayer.load (<i>self</i>, <a href="phonon-mediasource.html">MediaSource</a>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void load(const Phonon::MediaSource&)</tt>.</p><p>Starts pre-loading the media data from the specified
56
<i>source</i> and filling audio buffers in the backend.</p>
57
<p>When there's already a media playing (or paused) it will be
58
stopped (the finished signal will not be emitted).</p>
35
59
<p>See also <a href="phonon-mediaobject.html#setCurrentSource">MediaObject.setCurrentSource</a>().</p>
36
<a name="//apple_ref/cpp/instm/Phonon::VideoPlayer/mediaObject" />
37
62
<h3 class="fn"><a name="mediaObject" /><a href="phonon-mediaobject.html">MediaObject</a> VideoPlayer.mediaObject (<i>self</i>)</h3><p>Returns the media object being used by the player.</p>
38
<p>The media object can be accessed directly instead of using the <a href="phonon-videoplayer.html">VideoPlayer</a>s convenience functions, e.g., <a href="phonon-videoplayer.html#play">play</a>() and <a href="phonon-videoplayer.html#stop">stop</a>(). It is also possible to give the object to other Phonon widgets, e.g., a <a href="phonon-seekslider.html">SeekSlider</a> or a <a href="phonon-volumeslider.html">VolumeSlider</a>.</p>
39
<p>See also <a href="phonon-seekslider.html">Phonon.SeekSlider</a> and <a href="phonon-mediaobject.html">Phonon.MediaObject</a>.</p>
40
<a name="//apple_ref/cpp/instm/Phonon::VideoPlayer/pause" />
63
<p>The media object can be accessed directly instead of using the
64
<a href="phonon-videoplayer.html">VideoPlayer</a>s convenience
65
functions, e.g., <a href="phonon-videoplayer.html#play">play</a>()
66
and <a href="phonon-videoplayer.html#stop">stop</a>(). It is also
67
possible to give the object to other Phonon widgets, e.g., a
68
<a href="phonon-seekslider.html">SeekSlider</a> or a <a href="phonon-volumeslider.html">VolumeSlider</a>.</p>
69
<p>See also <a href="phonon-seekslider.html">Phonon.SeekSlider</a>
70
and <a href="phonon-mediaobject.html">Phonon.MediaObject</a>.</p>
41
73
<h3 class="fn"><a name="pause" />VideoPlayer.pause (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void pause()</tt>.</p><p>Pauses the playback.</p>
42
74
<p>See also <a href="phonon-mediaobject.html#pause">MediaObject.pause</a>().</p>
43
<a name="//apple_ref/cpp/instm/Phonon::VideoPlayer/play" />
44
<h3 class="fn"><a name="play" />VideoPlayer.play (<i>self</i>, <a href="phonon-mediasource.html">MediaSource</a>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void play(const Phonon::MediaSource&)</tt>.</p><p>Plays the media from the given <i>source</i>. Starts playback as fast as possible. This can take a considerable time depending on the URL and the backend.</p>
45
<p>If you need low latency between calling play() and the sound actually starting to play on your output device you need to use <a href="phonon-mediaobject.html">MediaObject</a> and be able to set the URL before calling play(). Note that</p>
46
<pre> audioPlayer->load(url);
47
audioPlayer->play();</pre>
48
<p>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.</p>
49
<h3 class="fn"><a name="play-2" />VideoPlayer.play (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void play()</tt>.</p><p>Continues playback of paused media. Restarts playback of a stopped (or newly loaded) media.</p>
77
<h3 class="fn"><a name="play" />VideoPlayer.play (<i>self</i>, <a href="phonon-mediasource.html">MediaSource</a>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void play(const Phonon::MediaSource&)</tt>.</p><p>Plays the media from the given <i>source</i>. Starts playback as
78
fast as possible. This can take a considerable time depending on
79
the URL and the backend.</p>
80
<p>If you need low latency between calling play() and the sound
81
actually starting to play on your output device you need to use
82
<a href="phonon-mediaobject.html">MediaObject</a> and be able to
83
set the URL before calling play(). Note that</p>
84
<pre class="highlightedCode brush: cpp">
85
audioPlayer->load(url);
86
audioPlayer->play();
88
<p>doesn't make a difference: the application should be idle
89
between the load and play calls so that the backend can start
90
preloading the media and fill audio buffers.</p>
93
<h3 class="fn"><a name="play-2" />VideoPlayer.play (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void play()</tt>.</p><p>Continues playback of paused media. Restarts playback of a
94
stopped (or newly loaded) media.</p>
50
95
<p>See also <a href="phonon-mediaobject.html#play">MediaObject.play</a>() and <a href="phonon-videoplayer.html#play">play</a>().</p>
51
<a name="//apple_ref/cpp/instm/Phonon::VideoPlayer/seek" />
52
<h3 class="fn"><a name="seek" />VideoPlayer.seek (<i>self</i>, int)</h3><p>This method is also a Qt slot with the C++ signature <tt>void seek(qint64)</tt>.</p><p>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 the <a href="phonon-videoplayer.html">VideoPlayer</a>.</p>
53
<pre> player->mediaObject()->isSeekable();</pre>
54
<p>The <i>ms</i> parameter is the time in milliseconds from the start of the media.</p>
55
<p>The call is asynchronous, so <a href="phonon-videoplayer.html#currentTime">currentTime</a>() 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 class <a href="phonon-seekslider.html">SeekSlider</a>.</p>
56
<p>See also <a href="phonon-mediaobject.html#seek">MediaObject.seek</a>(), <a href="phonon-mediaobject.html#isSeekable">MediaObject.isSeekable</a>(), and <a href="phonon-videoplayer.html#mediaObject">mediaObject</a>().</p>
57
<a name="//apple_ref/cpp/instm/Phonon::VideoPlayer/setVolume" />
98
<h3 class="fn"><a name="seek" />VideoPlayer.seek (<i>self</i>, int)</h3><p>This method is also a Qt slot with the C++ signature <tt>void seek(qint64)</tt>.</p><p>Seeks to the requested time. Note that the backend is free to
99
ignore the seek request if the media source isn't seekable; you can
100
check this by asking the media object of the <a href="phonon-videoplayer.html">VideoPlayer</a>.</p>
101
<pre class="highlightedCode brush: cpp">
102
player->mediaObject()->isSeekable();
104
<p>The <i>ms</i> parameter is the time in milliseconds from the
105
start of the media.</p>
106
<p>The call is asynchronous, so <a href="phonon-videoplayer.html#currentTime">currentTime</a>() can still
107
be the old value right after this method was called. If all you
108
need is a slider that shows the current position and allows the
109
user to seek, use the class <a href="phonon-seekslider.html">SeekSlider</a>.</p>
110
<p>See also <a href="phonon-mediaobject.html#seek">MediaObject.seek</a>(), <a href="phonon-mediaobject.html#isSeekable">MediaObject.isSeekable</a>(),
111
and <a href="phonon-videoplayer.html#mediaObject">mediaObject</a>().</p>
58
114
<h3 class="fn"><a name="setVolume" />VideoPlayer.setVolume (<i>self</i>, float)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setVolume(float)</tt>.</p><p>Sets the <i>volume</i> of the output as voltage factor.</p>
59
<p>1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means 0%</p>
115
<p>1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means
60
117
<p>See also <a href="phonon-videoplayer.html#volume">volume</a>().</p>
61
<a name="//apple_ref/cpp/instm/Phonon::VideoPlayer/stop" />
62
120
<h3 class="fn"><a name="stop" />VideoPlayer.stop (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void stop()</tt>.</p><p>Stops the playback.</p>
63
121
<p>See also <a href="phonon-mediaobject.html#stop">MediaObject.stop</a>().</p>
64
<a name="//apple_ref/cpp/instm/Phonon::VideoPlayer/totalTime" />
65
<h3 class="fn"><a name="totalTime" />int VideoPlayer.totalTime (<i>self</i>)</h3><p>Get the total time (in milliseconds) of the file currently being played.</p>
66
<a name="//apple_ref/cpp/instm/Phonon::VideoPlayer/videoWidget" />
124
<h3 class="fn"><a name="totalTime" />int VideoPlayer.totalTime (<i>self</i>)</h3><p>Get the total time (in milliseconds) of the file currently being
67
128
<h3 class="fn"><a name="videoWidget" /><a href="phonon-videowidget.html">VideoWidget</a> VideoPlayer.videoWidget (<i>self</i>)</h3><h3 class="fn"><a name="volume" />float VideoPlayer.volume (<i>self</i>)</h3><p>This is the current volume of the output as voltage factor.</p>
68
<p>1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means 0%</p>
129
<p>1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means
69
131
<p>See also <a href="phonon-videoplayer.html#setVolume">setVolume</a>().</p>
70
<p /><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="finished" />void finished ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the playback finished.</p>
71
<a name="//apple_ref/cpp/instm/Phonon::VideoPlayer/isPaused" />
72
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.7.7 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.6.3</td></tr></table></div></address></body></html>
b'\\ No newline at end of file'
132
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="finished" />void finished ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the playback finished.</p>
135
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.8.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.7.0</td></tr></table></div></address></body></html>
b'\\ No newline at end of file'