Metadata-Version: 2.4
Name: py-qt-video-player
Version: 0.1.1
Summary: A simple video player based on PyQt6.
License-Expression: MIT
License-File: LICENSE
Author: GGN_2015
Author-email: neko@jlulug.org
Requires-Python: >=3.10
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: pyqt-subtitles
Requires-Dist: pyqt6
Description-Content-Type: text/markdown

# py_qt_video_player
A simple video player based on PyQt6.

## Installation

```bash
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

```python
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

```python
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

```python
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())

```

