[PyQt] QGraphicsScene and Phonon

Tim and Alison Bentley Home at TRARBentley.net
Mon May 3 20:37:31 BST 2010


I am trying to to write a program to display a video using phonon within a
qgraphicsscene.
The attached code will play the audio but not the video part.
This is confusing me as all examples I have seen ( and there are not may)
show this as the way to do it.

def main(args):
    app=QtGui.QApplication(args)
    app.setApplicationName(u'd1')
    app.setQuitOnLastWindowClosed(True)

    scene = QtGui.QGraphicsScene()
    view = QtGui.QGraphicsView(scene)
    view.setViewport(QtOpenGL.QGLWidget())
    view.resize(400, 300)
    view.show()
    mediaObject = Phonon.MediaObject()
    videoWidget = Phonon.VideoWidget()
    audioOutput = Phonon.AudioOutput(Phonon.VideoCategory)
    Phonon.createPath(mediaObject, videoWidget)
    Phonon.createPath(mediaObject, audioOutput)
    audioOutput.setMuted(True)
    scene.addWidget(videoWidget)
    mediaObject.setCurrentSource(Phonon.MediaSource('<filegoeshere>'))
    #yaProxy.resize(videoWidget.size())
    mediaObject.play()
    scene.addLine(50, 50, 700, 700, QtGui.QPen())

    return app.exec_()

if __name__=="__main__":
    main(sys.argv)

-- 
Tim and Alison Bentley
Home at TRARBentley.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100503/e9b28cc9/attachment.html>


More information about the PyQt mailing list