This commit is contained in:
jr-k 2024-07-18 20:17:04 +02:00
parent eb56953815
commit 7e9235503f
5 changed files with 87 additions and 68 deletions

View File

@ -2,7 +2,7 @@
> #### 👈 [back to readme](/README.md)
#### 🔵 You just want a slideshow manager and you'll deal with screen and browser yourself ? You're in the right place.
#### 🔵 You just want a slideshow manager, and you'll deal with screen and browser yourself ? You're in the right place.
---
@ -42,7 +42,7 @@ curl https://raw.githubusercontent.com/jr-k/obscreen/master/docker-compose.headl
docker compose up --detach --pull=always
```
---
### or system wide
### or system-wide
#### Install
```bash
# Install system dependencies
@ -97,41 +97,16 @@ sudo journalctl -u obscreen-studio -f
---
## 📺 Run the player instance
### Autorun for a RaspberryPi
- Install player autorun by executing following script (will install chromium, x11 and obscreen-player systemd service)
### Autorun for a linux based system
#### How to install
- Install player autorun by executing following script (will install chromium, x11, pulseaudio and obscreen-player systemd service)
```bash
curl -fsSL https://raw.githubusercontent.com/jr-k/obscreen/master/system/install-autorun-rpi.sh | sudo bash -s -- $USER $HOME
mkdir -p ~/obscreen/var/run
nano ~/obscreen/var/run/play
sudo reboot
```
- Copy following script in `~/obscreen/var/run/play` file to enable chromium autorun (replace `http://localhost:5000` by your own `obscreen-studio` instance url)
```
#!/bin/bash
# Disable screensaver and DPMS
xset s off
xset -dpms
xset s noblank
# Start unclutter to hide the mouse cursor
unclutter -display :0 -noevents -grab &
# Modify Chromium preferences to avoid restore messages
mkdir -p $HOME/.config/chromium/Default 2>/dev/null
touch $HOME/.config/chromium/Default/Preferences
sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' $HOME/.config/chromium/Default/Preferences
RESOLUTION=$(DISPLAY=:0 xrandr | grep '*' | awk '{print $1}')
WIDTH=$(echo $RESOLUTION | cut -d 'x' -f 1)
HEIGHT=$(echo $RESOLUTION | cut -d 'x' -f 2)
# Start Chromium in kiosk mode
chromium-browser --disable-features=Translate --ignore-certificate-errors --disable-web-security --disable-restore-session-state --autoplay-policy=no-user-gesture-required --start-maximized --allow-running-insecure-content --remember-cert-error-decisions --noerrdialogs --kiosk --incognito --window-position=0,0 --window-size=${WIDTH},${HEIGHT} --display=:0 http://localhost:5000
```
- Restart
```bash
sudo systemctl restart obscreen-player.service
```
#### How to restart
1. Just use systemctl `sudo systemctl restart obscreen-player.service`
### Manually on any device capable of running chromium
When you run the browser yourself, don't forget to use these flags for chromium browser:
@ -150,7 +125,7 @@ chromium --disable-features=Translate --ignore-certificate-errors --disable-web-
- Just add `--pull=always` to your `docker run ...` command, you'll get latest version automatically.
>#### or with docker compose
- Just add `--pull=always` to your `docker compose up ...` command, , you'll get latest version automatically.
>#### or system wide
>#### or system-wide
- Execute following script
```bash
cd ~/obscreen

View File

@ -55,7 +55,7 @@ curl https://raw.githubusercontent.com/jr-k/obscreen/master/docker-compose.yml >
docker compose up --detach --pull=always
```
---
### or system wide
### or system-wide
#### Install
```bash
# Install system dependencies
@ -110,40 +110,18 @@ sudo journalctl -u obscreen-studio -f
## 📺 Run the player instance
### Autorun for a RaspberryPi
- Install player autorun by executing following script (will install chromium, x11 and obscreen-player systemd service)
#### How to install
- Install player autorun by executing following script (will install chromium, x11, pulseaudio and obscreen-player systemd service)
```bash
curl -fsSL https://raw.githubusercontent.com/jr-k/obscreen/master/system/install-autorun-rpi.sh | sudo bash -s -- $USER $HOME
mkdir -p ~/obscreen/var/run
nano ~/obscreen/var/run/play
```
- Copy following script in `~/obscreen/var/run/play` file to enable chromium autorun (replace `http://localhost:5000` by your own `obscreen-studio` instance url)
```
#!/bin/bash
# Disable screensaver and DPMS
xset s off
xset -dpms
xset s noblank
#### How to restart
1. Just use systemctl `sudo systemctl restart obscreen-player.service`
# Start unclutter to hide the mouse cursor
unclutter -display :0 -noevents -grab &
# Modify Chromium preferences to avoid restore messages
mkdir -p /home/pi/.config/chromium/Default 2>/dev/null
touch /home/pi/.config/chromium/Default/Preferences
sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' /home/pi/.config/chromium/Default/Preferences
RESOLUTION=$(DISPLAY=:0 xrandr | grep '*' | awk '{print $1}')
WIDTH=$(echo $RESOLUTION | cut -d 'x' -f 1)
HEIGHT=$(echo $RESOLUTION | cut -d 'x' -f 2)
# Start Chromium in kiosk mode
chromium-browser --disable-features=Translate --ignore-certificate-errors --disable-web-security --disable-restore-session-state --autoplay-policy=no-user-gesture-required --start-maximized --allow-running-insecure-content --remember-cert-error-decisions --noerrdialogs --kiosk --incognito --window-position=0,0 --window-size=${WIDTH},${HEIGHT} --display=:0 http://localhost:5000
```
- Restart
```bash
sudo systemctl restart obscreen-player.service
```
#### How to enable sound
1. First you have to reboot your device with `sudo reboot`
2. You have to set audio channel to HDMI `sudo raspi-config nonint do_audio 1` (0 is for jack 3.5 output)
### Manually on any device capable of running chromium
When you run the browser yourself, don't forget to use these flags for chromium browser:
@ -176,7 +154,7 @@ However, I used this one: `(2,82) = 1920x1080 60Hz 1080p`
- Just add `--pull=always` to your `docker run ...` command, you'll get latest version automatically.
>#### or with docker compose
- Just add `--pull=always` to your `docker compose up ...` command, , you'll get latest version automatically.
>#### or system wide
>#### or system-wide
- Execute following script
```bash
cd ~/obscreen

View File

@ -1,5 +1,5 @@
{
"plugin_title": "Git Updater Button",
"plugin_description": "Adds an update button (only for system wide installations)",
"plugin_description": "Adds an update button (only for system-wide installations)",
"button_update": "Update"
}

View File

@ -0,0 +1,19 @@
# Disable screensaver and DPMS
xset s off
xset -dpms
xset s noblank
# Start unclutter to hide the mouse cursor
unclutter -display :0 -noevents -grab &
# Modify Chromium preferences to avoid restore messages
mkdir -p /home/pi/.config/chromium/Default 2>/dev/null
touch /home/pi/.config/chromium/Default/Preferences
sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' /home/pi/.config/chromium/Default/Preferences
RESOLUTION=$(DISPLAY=:0 xrandr | grep '*' | awk '{print $1}')
WIDTH=$(echo $RESOLUTION | cut -d 'x' -f 1)
HEIGHT=$(echo $RESOLUTION | cut -d 'x' -f 2)
# Start Chromium in kiosk mode
chromium-browser --disable-features=Translate --ignore-certificate-errors --disable-web-security --disable-restore-session-state --autoplay-policy=no-user-gesture-required --start-maximized --allow-running-insecure-content --remember-cert-error-decisions --noerrdialogs --kiosk --incognito --window-position=0,0 --window-size=${WIDTH},${HEIGHT} --display=:0 http://localhost:5000

View File

@ -8,9 +8,44 @@ echo "# Using user: $OWNER"
echo "# Working Directory: $WORKING_DIR"
echo "# ------------------------------ #"
# ============================================================
# User Interaction
# ============================================================
default_studio_url="http://localhost:5000"
obscreen_studio_url=$default_studio_url
disable_interaction=false
for arg in "$@"
do
if [ "$arg" == "--disable-interaction" ]; then
disable_interaction=true
break
fi
done
if [ "$disable_interaction" = false ]; then
read -p "Enter Obscreen studio instance URL [${default_studio_url}]: " user_url
obscreen_studio_url=${user_url:-$default_studio_url}
read -p "Do you confirm ${obscreen_studio_url} is a valid Obscreen studio instance? [Y/n]: " confirm
if [[ $confirm == "Y" || $confirm == "y" || $confirm == "" ]]; then
echo "Using Obscreen studio instance URL: $obscreen_studio_url"
else
echo "Confirmation not received. Please run the script again and enter a valid URL."
exit 1
fi
else
# If --disable-interaction is passed, use the default URL without prompting
echo "Using Obscreen studio instance URL: $default_studio_url"
fi
# ============================================================
# Installation
# ============================================================
# Update and install necessary packages
apt update
apt install -y xinit xserver-xorg chromium-browser unclutter
apt install -y xinit xserver-xorg chromium-browser unclutter pulseaudio
# Add user to tty and video groups
usermod -aG tty $OWNER
@ -28,5 +63,17 @@ curl https://raw.githubusercontent.com/jr-k/obscreen/master/system/obscreen-play
systemctl daemon-reload
systemctl enable obscreen-player.service
systemctl set-default graphical.target
systemctl start obscreen-player.service
# ============================================================
# Autorun script
# ============================================================
mkdir -p $HOME/obscreen/var/run
curl https://raw.githubusercontent.com/jr-k/obscreen/master/system/autostart-browser-x11.sh | sed "s#/home/pi#$WORKING_DIR#g" | sed "s#=pi#=$OWNER#g" | sed "s#=http://localhost:5000#=$obscreen_studio_url#g" | tee $HOME/obscreen/var/run/play
# ============================================================
# Start
# ============================================================
# Finally, start player service
systemctl start obscreen-player.service