Add Windows Player support and related files

- New windows/ directory with build scripts, specs, and configuration
- Windows-specific requirements (requirements_win.txt)
- Launch and runtime scripts for Windows (run_win.py, launch_player.bat)
- PyInstaller build configuration (build.spec)
- Updated .gitignore to exclude windows/venv312/
- Updated config and source files for Windows compatibility
- Moved working_files to proper directory
This commit is contained in:
ske087
2026-07-24 08:34:00 +03:00
parent f7b889be11
commit 3845830a86
16 changed files with 1379 additions and 22 deletions
+19 -15
View File
@@ -14,21 +14,21 @@ import asyncio
from concurrent.futures import ThreadPoolExecutor
# Set environment variables for better video performance
os.environ['KIVY_VIDEO'] = 'ffpyplayer' # Use ffpyplayer as video provider
os.environ['FFPYPLAYER_CODECS'] = 'h264,h265,vp9,vp8' # Support common codecs
os.environ['SDL_VIDEO_ALLOW_SCREENSAVER'] = '0' # Prevent screen saver
os.environ['SDL_VIDEODRIVER'] = 'wayland,x11,dummy' # Prefer Wayland, fallback to X11, then dummy
os.environ['SDL_AUDIODRIVER'] = 'alsa,pulse,dummy' # Prefer ALSA, fallback to pulse, then dummy
# Use setdefault() so that a wrapper script (e.g. run_win.py) can pre-set
# Windows-compatible values before this module is imported.
os.environ.setdefault('KIVY_VIDEO', 'ffpyplayer')
os.environ.setdefault('FFPYPLAYER_CODECS', 'h264,h265,vp9,vp8')
os.environ.setdefault('SDL_VIDEO_ALLOW_SCREENSAVER', '0')
os.environ.setdefault('SDL_VIDEODRIVER', 'wayland,x11,dummy')
os.environ.setdefault('SDL_AUDIODRIVER', 'alsa,pulse,dummy')
# Video playback optimizations
# Note: pygame backend requires X11/Wayland context; let Kivy auto-detect for better compatibility
# os.environ['KIVY_WINDOW'] = 'pygame' # Use pygame backend for better performance
os.environ['KIVY_AUDIO'] = 'ffpyplayer' # Use ffpyplayer for audio
os.environ['KIVY_GL_BACKEND'] = 'gl' # Use OpenGL backend
os.environ['KIVY_INPUTPROVIDERS'] = 'wayland,x11' # Only use Wayland and X11 input providers, skip problematic ones
os.environ['FFMPEG_THREADS'] = '2' # Use 2 threads for ffmpeg decoding (Raspberry Pi has limited resources)
os.environ['LIBPLAYER_BUFFER'] = '1048576' # 1MB buffer (reduced from 2MB to save memory)
os.environ['SDL_AUDIODRIVER'] = 'alsa' # Use ALSA for better audio on Pi
os.environ.setdefault('KIVY_AUDIO', 'ffpyplayer')
os.environ.setdefault('KIVY_GL_BACKEND', 'gl')
os.environ.setdefault('KIVY_INPUTPROVIDERS', 'wayland,x11')
os.environ.setdefault('FFMPEG_THREADS', '2')
os.environ.setdefault('LIBPLAYER_BUFFER', '1048576')
os.environ.setdefault('SDL_AUDIODRIVER', 'alsa')
# Configure Kivy BEFORE importing any Kivy modules
from kivy.config import Config
@@ -86,8 +86,12 @@ from kivy.graphics import Color, Line, Ellipse
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.slider import Slider
# Load the KV file
Builder.load_file('signage_player.kv')
# Load the KV file - resolve relative to this file's directory
_kv_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'signage_player.kv')
if not os.path.exists(_kv_path):
# Fallback: relative to cwd (for PyInstaller bundled runs)
_kv_path = 'signage_player.kv'
Builder.load_file(_kv_path)
class CardReader: