4.9 KiB
4.9 KiB
Video Player Setup - Always On Top with Hidden Desktop UI
This setup ensures your video player always starts with a video on boot, stays on top, and hides the desktop UI.
What Was Fixed
1. GPIO Access Error
- Problem: Script required root privileges for GPIO access
- Solution: Modified script to check for GPIO group membership instead of root privileges
- Result: Script now runs as regular user with proper GPIO permissions
2. Always Start with Video
- Problem: Video player might not always start with a video
- Solution: Added
ensure_video_playing()method that automatically starts a video if none is playing - Result: Video player will always have a video playing, restarting automatically if needed
3. Keep Video On Top
- Problem: Video might get hidden behind other windows
- Solution:
- Added VLC options for always-on-top behavior
- Created
keep_vlc_on_top()method using wmctrl - Added continuous monitoring to ensure VLC stays on top
- Result: Video player window always stays on top of other applications
4. Hide Desktop UI
- Problem: Desktop UI elements visible behind video
- Solution:
- Created
hide_desktop_ui.shscript to hide panels, icons, and screen savers - Added systemd service to automatically hide UI on boot
- Configured autostart entries for desktop environment
- Created
- Result: Clean video-only display with hidden desktop elements
Files Modified/Created
Modified Files:
video_player.py- Fixed GPIO access, added always-on-top functionalityvideo-player.service- Updated to run as pi user instead of rootvideo-player-random.service- Updated to run as pi user instead of root
New Files:
hide_desktop_ui.sh- Script to hide desktop UI elementshide-desktop-ui.service- Systemd service for hiding desktop UIsetup_video_player.sh- Complete setup scriptVIDEO_PLAYER_SETUP.md- This documentation
Installation Instructions
-
Run the setup script:
./setup_video_player.sh -
Log out and log back in (required for GPIO group changes)
-
Place video files in
/home/pi/Videos/directory -
Reboot the system to start all services
Manual Commands
Start Video Player
# Start with default channel
sudo systemctl start video-player.service
# Start with random video
sudo systemctl start video-player-random.service
Hide Desktop UI
# Hide desktop UI elements
./hide_desktop_ui.sh hide
# Keep VLC on top (runs continuously)
./hide_desktop_ui.sh keep-top
# Do everything (hide UI, start service, keep on top)
./hide_desktop_ui.sh all
Check Service Status
# Check video player service
sudo systemctl status video-player.service
# Check desktop UI hiding service
sudo systemctl status hide-desktop-ui.service
# View logs
sudo journalctl -u video-player.service -f
Configuration
Video Directory
- Default:
/home/pi/Videos/ - Supported formats:
.mp4,.avi,.mkv,.mov,.wmv,.flv,.webm,.m4v
VLC Options
The video player now uses these VLC options for optimal display:
--fullscreen- Full screen mode--always-on-top- Keep window on top--video-on-top- Video always on top--no-video-title-show- Hide video title--no-audio-display- Hide audio display- Various
--no-qt-*options to hide VLC interface elements
GPIO Configuration
- IR pin: GPIO 18 (configurable in config.json)
- User must be in
gpiogroup (handled by setup script)
Troubleshooting
Video Not Starting
- Check if video files exist in
/home/pi/Videos/ - Check service status:
sudo systemctl status video-player.service - Check logs:
sudo journalctl -u video-player.service -f
GPIO Access Issues
- Ensure user is in gpio group:
groups $USER - If not, run:
sudo usermod -a -G gpio $USERand log out/in
Desktop UI Still Visible
- Check if hide-desktop-ui service is running:
sudo systemctl status hide-desktop-ui.service - Manually hide UI:
./hide_desktop_ui.sh hide - Install wmctrl if missing:
sudo apt install wmctrl
VLC Not Staying On Top
- Install wmctrl:
sudo apt install wmctrl - Check if VLC is running:
pgrep vlc - Manually keep on top:
./hide_desktop_ui.sh keep-top
Service Management
Enable Services (start on boot)
sudo systemctl enable video-player.service
sudo systemctl enable hide-desktop-ui.service
Disable Services
sudo systemctl disable video-player.service
sudo systemctl disable hide-desktop-ui.service
Stop Services
sudo systemctl stop video-player.service
sudo systemctl stop hide-desktop-ui.service
Notes
- The video player will automatically restart if it crashes
- Videos will loop automatically when they end
- The system will always ensure a video is playing
- Desktop UI elements are hidden but can be restored by stopping the hide-desktop-ui service
- IR remote control functionality is preserved and enhanced