-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvideo_minimal.py
40 lines (26 loc) · 1.01 KB
/
video_minimal.py
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
# Docs: https://doc.qt.io/qtforpython-6/PySide6/QtMultimediaWidgets/QVideoWidget.html
from PySide6.QtCore import (Qt, QEvent, QObject, QUrl)
from PySide6.QtMultimedia import QMediaPlayer
from PySide6.QtWidgets import (
QApplication, QLabel, QMainWindow, QPushButton, QVBoxLayout, QWidget)
from PySide6.QtMultimediaWidgets import QVideoWidget
import sys
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
widget = QWidget()
self.setCentralWidget(widget)
layout = QVBoxLayout(widget)
player = QMediaPlayer()
player.setSource(QUrl("http://192.168.1.18:81/stream"))
videoWidget = QVideoWidget()
player.setVideoOutput(videoWidget)
videoWidget.show()
player.play()
self.text = QLabel("The answer is 42.")
layout.addWidget(self.text, alignment=Qt.AlignmentFlag.AlignCenter)
if __name__ == "__main__":
app = QApplication(sys.argv)
main_window = MainWindow()
main_window.show()
app.exec()