File: phonon-videoplayer.html

package info (click to toggle)
python-qt4 4.11.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 40,148 kB
  • ctags: 6,150
  • sloc: python: 125,936; cpp: 12,628; xml: 292; makefile: 259; php: 27; sh: 2
file content (134 lines) | stat: -rw-r--r-- 13,198 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>Phonon.VideoPlayer Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</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">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <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>

<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&#160;<i>category</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="phonon-videoplayer.html#VideoPlayer-2">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;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&#160;<i>source</i>)</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&#160;<i>source</i>)</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&#160;<i>ms</i>)</li><li><div class="fn" /><b><a href="phonon-videoplayer.html#setVolume">setVolume</a></b> (<i>self</i>, float&#160;<i>volume</i>)</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>
<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>
<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>
<p>Keep in mind that when the VideoPlayer instance is deleted the
playback will stop.</p>
<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>
<p>A play and forget code example:</p>
<pre class="cpp">
 VideoPlayer <span class="operator">*</span>player <span class="operator">=</span> <span class="keyword">new</span> <a href="phonon-videoplayer.html#VideoPlayer">VideoPlayer</a>(Phonon<span class="operator">.</span>VideoCategory<span class="operator">,</span> parentWidget);
 <a href="qobject.html#connect">connect</a>(player<span class="operator">,</span> SIGNAL(finished())<span class="operator">,</span> player<span class="operator">,</span> SLOT(deleteLater()));
 player<span class="operator">-</span><span class="operator">&gt;</span><a href="phonon-videoplayer.html#play">play</a>(url);
</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>&#160;<i>category</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;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>
<p><i>category</i> is the category used for the audio output
device.</p>


<h3 class="fn"><a name="VideoPlayer-2" />VideoPlayer.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;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>
<p><i>parent</i> The <a href="qobject.html">QObject</a> parent.</p>


<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
being played.</p>


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


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


<h3 class="fn"><a name="load" />VideoPlayer.load (<i>self</i>, <a href="phonon-mediasource.html">MediaSource</a>&#160;<i>source</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void load(const Phonon::MediaSource&amp;)</tt>.</p><p>Starts pre-loading the media data from the specified
<i>source</i> and filling audio buffers in the backend.</p>
<p>When there's already a media playing (or paused) it will be
stopped (the finished signal will not be emitted).</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#setCurrentSource">MediaObject.setCurrentSource</a>().</p>


<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>
<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>
<p><b>See also</b> <a href="phonon-seekslider.html">Phonon.SeekSlider</a> and <a href="phonon-mediaobject.html">Phonon.MediaObject</a>.</p>


<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>
<p><b>See also</b> <a href="phonon-mediaobject.html#pause">MediaObject.pause</a>().</p>


<h3 class="fn"><a name="play" />VideoPlayer.play (<i>self</i>, <a href="phonon-mediasource.html">MediaSource</a>&#160;<i>source</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void play(const Phonon::MediaSource&amp;)</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>
<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>
<pre class="cpp">
 audioPlayer<span class="operator">-</span><span class="operator">&gt;</span><a href="phonon-videoplayer.html#load">load</a>(url);
 audioPlayer<span class="operator">-</span><span class="operator">&gt;</span>play();
</pre>
<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>


<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>
<p><b>See also</b> <a href="phonon-mediaobject.html#play">MediaObject.play</a>() and <a href="phonon-videoplayer.html#play">play</a>().</p>


<h3 class="fn"><a name="seek" />VideoPlayer.seek (<i>self</i>, int&#160;<i>ms</i>)</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>
<pre class="cpp">
     player<span class="operator">-</span><span class="operator">&gt;</span>mediaObject()<span class="operator">-</span><span class="operator">&gt;</span>isSeekable();
</pre>
<p>The <i>ms</i> parameter is the time in milliseconds from the
start of the media.</p>
<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>
<p><b>See also</b> <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>


<h3 class="fn"><a name="setVolume" />VideoPlayer.setVolume (<i>self</i>, float&#160;<i>volume</i>)</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>
<p>1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means
0%</p>
<p><b>See also</b> <a href="phonon-videoplayer.html#volume">volume</a>().</p>


<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>
<p><b>See also</b> <a href="phonon-mediaobject.html#stop">MediaObject.stop</a>().</p>


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


<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>
<p>1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means
0%</p>
<p><b>See also</b> <a href="phonon-videoplayer.html#setVolume">setVolume</a>().</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>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.11.4 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt&#160;4.8.7</td></tr></table></div></address></body></html>