Skip to content

Video(mp4 file only) player using QGraphicsVideoItem. Control widget at the bottom is shown/hidden followed by cursor's movement.

License

Notifications You must be signed in to change notification settings

yjg30737/pyqt-graphics-video-item-video-player

Repository files navigation

pyqt-graphics-video-item-video-player

Video(mp4 file only) player using QGraphicsVideoItem. Control widget at the bottom is shown/hidden followed by cursor's movement.

Note: You need K-Lite Codec to play the video with this.

Requirements

PyQt5 >= 5.8

Setup

python -m pip install git+https://github.com/yjg30737/pyqt-graphics-video-item-video-player --upgrade

Included Packages

Usage

This video player is mp4 only.

You can set the video file by dropping it to the window. That is the only way.

Example

Code Sample

from PyQt5.QtWidgets import QApplication
from pyqt_graphics_video_item_video_player.videoPlayer import VideoPlayer

if __name__ == "__main__":
    import sys

    app = QApplication(sys.argv)
    videoPlayer = VideoPlayer()
    videoPlayer.show()
    app.exec_()

Result

1. Preview of interaction between cursor movement and control widget visibility

example.mp4

Control widget is going to show when

  • The cursor enters into the window
  • The cursor stays on the control widget
  • The cursor moves again

Control widget is going to hide when

  • The cursor leaves from the window
  • The cursor stays outside of the control widget

2. Preview of watching video with the pyqt-graphics-video-item-video-player and using control widget to navigate the video (Example video is result video of pyqt-find-replace-text-widget.) (Note: Style of slider and buttons are set to old version in the example.)

example.mp4

Note

QGraphicsVideoItem's video quality is worse than QVideoWidgets.

You maybe wonder why did i make this in the first place.

Because for some reasons, I can't show the control widget (which has transparent background) over the QVideoWidget.

I'm still trying to figure out the way to solve this problem.

One more thing, There are some flaws in timer feature and button toggling. I will fix it.