Saturday, April 27, 2013

Add VLC player to run at start up

Add VLC player to run at start up

sudo nano /etc/init.d/vlc

Copy and paste the following code in the editor

# vlc autostart created by Nanda
export USER='pi'

eval cd ~$USER

# Check the state of the command - this'll either be start or stop 
case "$1" in
start)
# if it's start, then start vlc using the details below
su $USER -c '/usr/bin/vlc --extraintf http
echo "Starting vlc for $USER "
;;
stop)
# if it's stop, then just kill the process
pkill Xvlc
echo "vlc stopped"
;;
*)
echo "Usage: /etc/init.d/vlc{start|stop}"
exit 1
;;
esac
exit 0
Set file properties
Once that's done make sure the file has the right propertied by typing the following:
sudo chmod 755 /etc/init.d/vlc
NOTE: Important to do this step every time you modify this file. I redid these steps to create the tutorial, skipped this step and couldn't VLC in on the reboot!

Add File to startup sequence
And now just add your file to the list of startup actions by typing the following:
sudo update-rc.d vlc defaults
And that should be it! Just restart, and you should be able to VLC straight in!

No comments:

Post a Comment