Skip to main content

A simple video player based on PyQt6.

Project description

py_qt_video_player

A simple video player based on PyQt6.

Installation

pip install py_qt_video_player

Usage

[!TIP] You can press the Spacebar to toggle video play and pause, and use the bracket keys to adjust the playback speed.

You can use the arrow keys on your keyboard to control video progress and volume.

Normal Usage

import sys
from PyQt6.QtWidgets import QApplication
from py_qt_video_player import QtVideoPlayer

app = QApplication(sys.argv)
win = QtVideoPlayer()

video_path = r"test.mp4"
srt_path = None # Optional srt filepath
win.set_video_and_subtitle(video_path, srt_path)

win.show()
sys.exit(app.exec())

Ban/Allow user operation

import sys
from PyQt6.QtWidgets import QApplication
from py_qt_video_player import QtVideoPlayer

app = QApplication(sys.argv)
win = QtVideoPlayer()

video_path = r"test.mp4"
win.set_video_and_subtitle(video_path)

win.play()
# win.pause() # Pause video by program

win.seek(3.0) # seek to 3s

win.ban_operation() # use can not operate panel after ban_operation (except for volume)

# you can allow user operation after `ban_operation`
# win.allow_operation() 

win.show()
sys.exit(app.exec())

Set timer callback

import sys
from PyQt6.QtWidgets import QApplication
from py_qt_video_player import QtVideoPlayer

app = QApplication(sys.argv)
win = QtVideoPlayer()

video_path = r"test.mp4"
win.set_video_and_subtitle(video_path)

def callback():
    import time
    win.toggle_play_pause() # pause every 1.0s

# callback function will be called in main thread in about every 1.0s
win.set_timer_callback(callback, 1.0)

# Use this command after `win.set_timer_callback` to ban timer callback
# win.set_timer_callback(None)

win.show()
sys.exit(app.exec())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_qt_video_player-0.1.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_qt_video_player-0.1.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file py_qt_video_player-0.1.2.tar.gz.

File metadata

  • Download URL: py_qt_video_player-0.1.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.4 CPython/3.13.12 Windows/11

File hashes

Hashes for py_qt_video_player-0.1.2.tar.gz
Algorithm Hash digest
SHA256 59e4d5a7a0b37f07fa16634abaf0028e7406a1441d8173a12737bed0f3da9be8
MD5 338ef3b41de7ca8c6dde33d706b94e91
BLAKE2b-256 fcc1b4b0b4e2e7563461b05c05a285b55199384c15740f369c91880f0e89e9cf

See more details on using hashes here.

File details

Details for the file py_qt_video_player-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for py_qt_video_player-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cfb85c6258c1eab18e9a30e2b69fc0cfe74e1f3b9f7f6832d2b5aa85b7aab001
MD5 c1c1e2a7f5c2358c95f1e6544ecd934c
BLAKE2b-256 64adfc6ac60e68edfeb30fe7877aba2c1f512b887793f904209dc802921f8a81

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page