simplified external audio loading
This commit is contained in:
parent
63555dde87
commit
f446733bb2
2 changed files with 5 additions and 4 deletions
|
@ -91,10 +91,10 @@ class Player:
|
|||
|
||||
loop = asyncio.get_running_loop()
|
||||
self.mpv.pause = True
|
||||
self.mpv.play(video)
|
||||
await loop.run_in_executor(None, self.mpv.wait_for_event, "file-loaded")
|
||||
if audio:
|
||||
self.mpv.audio_add(audio)
|
||||
self.mpv.loadfile(video, audio_file=audio)
|
||||
else:
|
||||
self.mpv.loadfile(video)
|
||||
self.mpv.pause = False
|
||||
await loop.run_in_executor(None, self.mpv.wait_for_property, "eof-reached")
|
||||
self.mpv.play(f"{__dirname__}/static/background.png")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from typing import Any, Callable, Iterable, Protocol
|
||||
from typing import Any, Callable, Iterable, Optional, Protocol
|
||||
|
||||
from PIL.Image import Image
|
||||
|
||||
|
@ -34,5 +34,6 @@ class MPV:
|
|||
def create_image_overlay(self, image: Image, pos: tuple[int, int]) -> ImageOverlay: ...
|
||||
def remove_overlay(self, overlay_id: int) -> None: ...
|
||||
def observe_property(self, property: str, callback: Callable[[str, Any], None]) -> None: ...
|
||||
def loadfile(self, file: str, audio_file: Optional[str] = None) -> None: ...
|
||||
def __setitem__(self, key: str, value: str) -> None: ...
|
||||
def __getitem__(self, key: str) -> str: ...
|
||||
|
|
Loading…
Add table
Reference in a new issue