This allows you to watch youtube videos in hi res in full screen , using chromium or any other browser.
It works as follows, you open chromium (or any browser) and browse to youtube, you copy the link of the video you wish to watch (i.e. right click mouse and copy), then you move the mouse to the top Pixel menu bar and click on the new youtube icon, this will launch omxplayer and play you video full screen. Plus you can edit the script and select which default youtube resolution you want your vids to play at. In operation it works well.
sudo apt-get update
sudo apt-get install youtube-dl
sudo apt-get install xsel
sudo apt-get install xdotool
xsel allows scripts to reference the clipboard, youtube-dl get the address of youtube videos and xdotool allows scripts to send key presses, in this case it minimizes chromium
in a terminal now type
sudo nano /home/pi/youtube.sh
xdotool key ctrl+alt+d
omxplayer -o local "$(youtube-dl -g -f 22 `xsel`)"
then save the new file using ctrl o
the -f 22 is the youtube resolution 720p, you can change this to -f 18 for 360p if needed
now in a terminal type code below, this will make the script executable
sudo chmod +x /home/pi/youtube.sh
you can now test using sh youtube.sh (note you must have a youtube video link copied in the clipboard for it to work)
if the script is working, now you need to create a new icon at the top of the screen to easily launch you new script
now type in a terminal
sudo nano /usr/share/applications/youtube.desktop
Comment=GUI for omxplayer
and save using ctrl o
(i dont know if the icon will only work with pixel, so feel free to try another icon if not using pixel )
sudo chmod +777 /usr/share/applications/youtube.desktop
under the rasberry menu logo under sound and video you should now see a youtube logo and test to make sure it works.
Now if you right click on the top pixel menu and select "Application launch bar setting" you should now be able to add the new youtube icon to the top menu bar, just after the Wolfram icon.
So now if you just copy a youtube video link and click on the new icon at the top of the screen , the video should play full screen.
The keyboard controls for omxplayer are p for pause, q for quit , space unpause, just do a search for omxplayer controls
Last edited by lumsdot
on Sat Oct 15, 2016 4:20 pm, edited 1 time in total.