161 lines
4.9 KiB
Markdown
161 lines
4.9 KiB
Markdown
# 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.sh` script to hide panels, icons, and screen savers
|
|
- Added systemd service to automatically hide UI on boot
|
|
- Configured autostart entries for desktop environment
|
|
- **Result**: Clean video-only display with hidden desktop elements
|
|
|
|
## Files Modified/Created
|
|
|
|
### Modified Files:
|
|
- `video_player.py` - Fixed GPIO access, added always-on-top functionality
|
|
- `video-player.service` - Updated to run as pi user instead of root
|
|
- `video-player-random.service` - Updated to run as pi user instead of root
|
|
|
|
### New Files:
|
|
- `hide_desktop_ui.sh` - Script to hide desktop UI elements
|
|
- `hide-desktop-ui.service` - Systemd service for hiding desktop UI
|
|
- `setup_video_player.sh` - Complete setup script
|
|
- `VIDEO_PLAYER_SETUP.md` - This documentation
|
|
|
|
## Installation Instructions
|
|
|
|
1. **Run the setup script**:
|
|
```bash
|
|
./setup_video_player.sh
|
|
```
|
|
|
|
2. **Log out and log back in** (required for GPIO group changes)
|
|
|
|
3. **Place video files** in `/home/pi/Videos/` directory
|
|
|
|
4. **Reboot the system** to start all services
|
|
|
|
## Manual Commands
|
|
|
|
### Start Video Player
|
|
```bash
|
|
# Start with default channel
|
|
sudo systemctl start video-player.service
|
|
|
|
# Start with random video
|
|
sudo systemctl start video-player-random.service
|
|
```
|
|
|
|
### Hide Desktop UI
|
|
```bash
|
|
# 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
|
|
```bash
|
|
# 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 `gpio` group (handled by setup script)
|
|
|
|
## Troubleshooting
|
|
|
|
### Video Not Starting
|
|
1. Check if video files exist in `/home/pi/Videos/`
|
|
2. Check service status: `sudo systemctl status video-player.service`
|
|
3. Check logs: `sudo journalctl -u video-player.service -f`
|
|
|
|
### GPIO Access Issues
|
|
1. Ensure user is in gpio group: `groups $USER`
|
|
2. If not, run: `sudo usermod -a -G gpio $USER` and log out/in
|
|
|
|
### Desktop UI Still Visible
|
|
1. Check if hide-desktop-ui service is running: `sudo systemctl status hide-desktop-ui.service`
|
|
2. Manually hide UI: `./hide_desktop_ui.sh hide`
|
|
3. Install wmctrl if missing: `sudo apt install wmctrl`
|
|
|
|
### VLC Not Staying On Top
|
|
1. Install wmctrl: `sudo apt install wmctrl`
|
|
2. Check if VLC is running: `pgrep vlc`
|
|
3. Manually keep on top: `./hide_desktop_ui.sh keep-top`
|
|
|
|
## Service Management
|
|
|
|
### Enable Services (start on boot)
|
|
```bash
|
|
sudo systemctl enable video-player.service
|
|
sudo systemctl enable hide-desktop-ui.service
|
|
```
|
|
|
|
### Disable Services
|
|
```bash
|
|
sudo systemctl disable video-player.service
|
|
sudo systemctl disable hide-desktop-ui.service
|
|
```
|
|
|
|
### Stop Services
|
|
```bash
|
|
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
|