As an example, we'll switch the original videos for two star-wars style lofi streams:

Start by noting the part of the URL that gives the video's ID. You can find this by doing a right-click and choosing "copy video URL". Paste it into any text editor to see the URL. This will get you a URL like https://youtu.be/oNfKzRP8-Q0 -- the video's ID is the part after youtu.be/, so the IDs of our two videos are:

  • oNfKzRP8-Q0
  • iBUkwL9PJ9o

On a host computer, use ssh to connect to the Raspberry Pi, use raspi-config to disable overlay mode and restart, and use ssh to connect a second time.

Make a backup of the file we're going to edit: cp kioskvideo.html original-kioskvideo.html

Next, start the nano editor on the file kioskvideo.html in the home directory: nano kioskvideo.html

Press the secret key combination Shift+Alt+4 to soft-wrap long lines and then scroll down until you find the <iframe> tag. Replace the ID of the video to embed (5qap5aO4i9A) with the video you want to play first (oNfKzRP8-Q0).

Scroll down a bit further to modify the playlist and the "pan" values, putting both video IDs in the playlist, and then making sure there are the same number of values in the "pan" var as the "playlist" var. Write out the file by pressing Ctrl+O and confirming the name.

You can change the pan values in the range from 0 to -374.  A value of 0 will show the left of the video, a value of -187 will show the center, and a value of -374 will show the right.

On the BrainCraft HAT, press in on the joystick to reload the HTML page. If you did everything right, star wars ~ lofi beats to relax/study to will start playing. If not, carefully review the edits you made and correct them.  Each time, press Ctrl+O to save the file and then press in on the joystick to reload in the browser.

(My 3D printed model of Baby Yoda was by Alsamen, but has been removed from Thingiverse.  There are other 3D printable Baby Yoda models out there though)

If you need to start over, you can return to the terminal and use cp to replace the edited file with the backup: cp original-kioskvideo.html kioskvideo.html

You can also re-run the original installation script if that doesn't clear things up: bash Downloads/kiosk-mode.sh

Once you're satisfied with your modification, repeat the raspi-config steps to put the Pi in overlay mode once again and enjoy your customized lofi playlist!

This guide was first published on Dec 16, 2020. It was last updated on Mar 08, 2024.

This page (Choosing your own videos) was last updated on Mar 08, 2024.

Text editor powered by tinymce.