Skip to content

Commit 0d06d1e

Browse files
committed
Fix video player skips to endwhen no audio
Increase version
1 parent c2d880a commit 0d06d1e

File tree

6 files changed

+70
-68
lines changed

6 files changed

+70
-68
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,9 @@ Endcord does work with free-threaded python, and it significantly improves media
481481
But currently building does not work in this mode, nuitka [doesn't support free-threaded mode](<https://github.com/Nuitka/Nuitka/issues/3062>) yet.
482482
Anyway, to run it from source:
483483
First install python with uv: `uv python install 3.14t`, it must be >= 3.14t (because some libraries dont have free-threaded support for < 3.14).
484-
Install dependencies: `uv sync --python 3.14t --group media`
485-
Run main.py: `uv run --python 3.14t main.py`
484+
Install dependencies: `uv sync --python 3.14t --group media`.
485+
Remove orjson (doesn't support freethreaded python): `uv remove orjson`. (ujson also doesn't support freethreaded).
486+
Run main.py: `uv run --python 3.14t main.py`.
486487

487488

488489
## FAQ

endcord/media.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ def __init__(self, config, keybindings, ui=True, external=False):
199199
def sigint_handler(self, _signum, _frame):
200200
"""Handling Ctrl-C event"""
201201
self.stop_playback()
202+
time.sleep(1)
203+
sys.exit() # failsafe
202204

203205

204206
def pil_img_to_term(self, img, remove_alpha=True):
@@ -436,17 +438,17 @@ def audio_player(self, audio_queue, samplerate, channels, audio_ready):
436438
time.sleep(0.1)
437439

438440

439-
def video_player(self, video_queue, audio_queue, frame_duration):
441+
def video_player(self, video_queue, audio_queue, frame_duration, no_audio=False):
440442
"""Play video frames from the queue"""
441443
while True:
442444
frame = video_queue.get()
443445
if frame is None:
444446
break
445-
if audio_queue.qsize() >= 1:
447+
if audio_queue.qsize() >= 1 or no_audio:
446448
start_time = time.time()
447449
img = frame.to_image()
448450
self.pil_img_to_term(img, remove_alpha=False)
449-
if audio_queue.qsize() >= 3:
451+
if audio_queue.qsize() >= 3 or no_audio:
450452
time.sleep(max(frame_duration - (time.time() - start_time), 0))
451453
while self.pause:
452454
time.sleep(0.1)
@@ -489,7 +491,7 @@ def play_video(self, path):
489491

490492
# prepare video
491493
video_queue = Queue(maxsize=10)
492-
video_thread = threading.Thread(target=self.video_player, args=(video_queue, audio_queue, frame_duration), daemon=True)
494+
video_thread = threading.Thread(target=self.video_player, args=(video_queue, audio_queue, frame_duration, not(have_audio)), daemon=True)
493495
video_thread.start()
494496

495497
num = 0

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from endcord import arg, defaults, peripherals
1313

1414
APP_NAME = "endcord"
15-
VERSION = "1.1.8"
15+
VERSION = "1.2.0"
1616
default_config_path = peripherals.config_path
1717
log_path = peripherals.log_path
1818
uses_pgcurses = hasattr(curses, "PGCURSES")

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "endcord"
3-
version = "1.1.8"
3+
version = "1.2.0"
44
description = "Feature rich Discord TUI client."
55
readme = "README.md"
66
requires-python = ">=3.12"
@@ -28,11 +28,11 @@ dependencies = [
2828
build = [
2929
"cython>=3.2.4",
3030
"nuitka>=2.8.9",
31-
"pyinstaller>=6.17.0",
31+
"pyinstaller>=6.18.0",
3232
"setuptools>=80.9.0",
3333
]
3434
media = [
35-
"av>=16.0.1",
35+
"av>=16.1.0",
3636
"pillow>=12.1.0",
3737
"pynacl>=1.6.2",
3838
]

todo.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
Fix video player skips to end
21
Add option to login with email ?
32
Add option to login with QR code ?
4-
Show inline media in chat
53

64
Vim-like bindings
75
have input mode that types in input line
@@ -22,6 +20,7 @@ Voice calls
2220
send and receive RTCP?
2321
send speaking event?
2422

23+
Show inline media in chat - after fixing https://github.com/python/cpython/issues/119138
2524
Fix per-channel member list
2625
Video calls
2726
Localization

0 commit comments

Comments
 (0)