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"E:\Rsync\public\art\video\bad-apple.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"E:\Rsync\public\art\video\bad-apple.mp4"
win.set_video_and_subtitle(video_path)

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

win.seek(10.0) # seek to 10s

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 timmer callback

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

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

video_path = r"E:\Rsync\public\art\video\bad-apple.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.1.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.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_qt_video_player-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 3480c6bd04dff204e87f43dd77e13dd5658a91f4d29fdaf7495553b9928a83e0
MD5 514c1c70e13b8a14c3a2cf78cdb91ce4
BLAKE2b-256 131dfd8d03ee392f4ca826400b8893ddece435d6131d2c8b184a982d103d841c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_qt_video_player-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9b09b3912a068d61a3d50c6532d7930e715c7111542866bada5b0ab544b7d74d
MD5 0a7efacd7065a4c1e45db75d71a99aa8
BLAKE2b-256 d23e0a94207df83723eb6d384eb91badc1836f451808576c596951f9a0f258aa

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