Setting everything up
The below solution will work with both Adobe Flash 10.2 and older Adobe Flash!
1. Create a file in /usr/local/bin, let's call that file "yt":
sudo gedit /usr/local/bin/yt
2. In the file created at step 1, paste this:
#!/bin/bash
FLASH_TMP=`ls /tmp | grep Flash*`
if [[ $FLASH_TMP ]]; then
vlc /tmp/Flash*
else
if [[ `ps x | awk '/libgcflashplayer.so\ /{print $1}'` ]]; then
flashvids() { lsof -p `ps x | awk '/libgcflashplayer.so\ /{print $1}'` -n 2>/dev/null | perl -lne '@F = split(/ +/, $_, 9); print "/proc/$F[1]/fd/${\($F[3] =~ /(^\d+)/)[0]}" if $F[4] eq "REG" && $F[8] =~ /\(deleted\)$/'; }
else
flashvids() { lsof -p `ps x | awk '/libflashplayer.so\ /{print $1}'` -n 2>/dev/null | perl -lne '@F = split(/ +/, $_, 9); print "/proc/$F[1]/fd/${\($F[3] =~ /(^\d+)/)[0]}" if $F[4] eq "REG" && $F[8] =~ /\(deleted\)$/'; }
fi
vlc $(flashvids)
fi
If you want to use Mplayer instead of VLC, replace "vlc" on line 6 and 14 in the code above, with "mplayer". The above code is not the same as in the video I've posted above because I've added support for the old Adobe Flash Player (older then 10.2) too so the script should now work with any Flash version.
Then save the file.
3. Make the file executable:
sudo chmod +x /usr/local/bin/yt
4. Now let's create a launcher for it: right click a Gnome panel, select "Add to panel", add a custom launcher and under "Command", enter this:
/usr/local/bin/yt
That's it! Now when you open a youtube video page in your browser, click pause (don't close the video page!), then click the newly created launcher to play it in VLC or Mplayer.
If you're using Adobe Flash older then 10.2, see the initial post: 2 Ways Of Playing YouTube Videos Without Flash With Just One Click