Video Player using PyQT QDialogs (Python)

2.2k Views Asked by At

I am looking for help into how I can get a video player working in PyQT4 using Dialogs (or any way preferable). At the moment, I have a GUI which already uses a mainWindow and I can navigate to the video player (full code supplied with Link here.) I have imported the video player that does work from another code, which is shown here:

import sys
import os
import F1_Sim_Base_v1_30_newvid
from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon

class videoPlayer(QtGui.QMainWindow):
   def __init__(self):
        QtGui.QMainWindow.__init__(self)
        widget = QtGui.QWidget()
        layout = QtGui.QVBoxLayout()
        widget.setLayout(layout)
        self.setCentralWidget(widget)


        self.player = Phonon.VideoPlayer(widget)
        layout.addWidget(self.player)

        #vpWidget = Phonon.VideoWidget()
        mediaObject = Phonon.MediaObject()
        filePath = os.path.join(os.path.dirname(__file__), 'RB9_1.avi')

        self.mediaSrc = Phonon.MediaSource(filePath)
        self.player.play(self.mediaSrc)



if __name__ == '__main__':
     app = QtGui.QApplication([])
     tester = videoPlayer()
     tester.show()
     app.exec_()

In this code, it works on its own. However, when imported, only the sound plays and there is no window displayed. Any help on how to fix this will be greatly appreciated. If any part isn't clear, please tell me so I can try my best to make it clear for you.

1

There are 1 best solutions below

0
SHENOISZ On
sudo apt-get update
sudo apt-get install python3-pyqt4.phonon-dbg

sudo apt-get update
sudo apt-get install python-qt4-phonon-dbg

utils

https://packages.debian.org/wheezy/python-qt4-phonon