[PyQt] Newbie question: Quicktime

Hugo Léveillé hugol at fastmail.net
Wed Jul 7 02:27:49 BST 2010


Thanks for your help

I tried to insert your code in mine and Im having some problem. 

1) The movie never start
2 The signal above always return False so I assume am not starting it
correctly

Heres the code I am trying
-------


from PyQt4 import QtCore, QtGui
from PyQt4 import phonon

from Ui_MainWindow import Ui_MainWindow

class MainWindow(QtGui.QMainWindow,Ui_MainWindow):
    def __init__(self,parent = None):
        super(MainWindow,self).__init__(parent)

        
        self.setupUi(self)


    def on_pushButton_pressed(self):
        
        url = QtCore.QUrl('c:/myVideo.mov')
        self.videoPlayer.play(phonon.Phonon.MediaSource(url))
        print self.videoPlayer.isPlaying() #This always return False...
----------------

And here is the relevant part of the UI module

-------------
self.videoPlayer = phonon.Phonon.VideoPlayer(self.centralwidget)
self.videoPlayer.setGeometry(QtCore.QRect(250, 90, 300, 200))
self.videoPlayer.setObjectName("videoPlayer")

-------------

Thanks for any other help you can provide




On Wed, 07 Jul 2010 01:38 +0200, "David Boddie" <david at boddie.org.uk>
wrote:
> On Wed Jul 7 00:13:43 BST 2010, Hugo Léveillé wrote:
> 
> > Id like to have some pointer on how, if possible, to add a quicktime
> > movie in pyqt.
> >
> > I guess I have to add it to a label ?
> > How to you add it ( QtGui.QMovie ? )
> 
> QMovie is an ancient class that basically plays animated GIF files and
> some MNG files. To play video streams and files, you need to look at the
> classes in the Phonon module.
> 
> PyQt doesn't appear to have any Phonon examples written in Python and,
> from
> memory, I think the only one supplied with Qt is actually a demo.
> 
> This code came from an example I wrote for PyCon Italia last year:
> 
> class Player(QWidget):
> 
>     def __init__(self, parent = None):
>     
>         QWidget.__init__(self, parent)
>         
>         self.player = Phonon.VideoPlayer(Phonon.VideoCategory)
>         urlLabel = QLabel(self.tr("&Location:"))
>         self.urlEdit = QLineEdit()
>         urlLabel.setBuddy(self.urlEdit)
>         self.playButton = QPushButton(self.tr("&Play/Stop"))
>         
>         self.connect(self.urlEdit, SIGNAL("returnPressed()"),
>                      self.playButton, SLOT("animateClick()"))
>         self.connect(self.playButton, SIGNAL("clicked()"),
>                      self.play)
>         
>         layout = QGridLayout(self)
>         layout.addWidget(self.player, 0, 0, 2, 3)
>         layout.addWidget(urlLabel, 2, 0)
>         layout.addWidget(self.urlEdit, 2, 1)
>         layout.addWidget(self.playButton, 2, 2)
>     
>     def play(self):
>     
>         if self.player.isPlaying():
>             self.player.stop()
>         else:
>             url = QUrl(self.urlEdit.text())
>             self.player.play(Phonon.MediaSource(url))
> 
> 
> I hope you find it useful.
> 
> David
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 


-- 
  Hugo Léveillé
  hugol at fastmail.net


-- 
  Hugo Léveillé
  hugol at fastmail.net



More information about the PyQt mailing list