Autolaunch Fullscreen VLC Player in OSX

Screen Shot 2016-02-18 at 2.30.46 PM

I had a need to set up a computer (running OSX 10.8.3 Mountain Lion) as an automated fullscreen video player for an art exhibition. I made a simple AppleScript application to automatically launch VLC fullscreen and run a looping video. Here’s the code:

Open a new doc in AppleScript Editor, and paste in the code above. Note:

  • your copy of the VLC app may be in a place other than /Applications/VLC.app/Contents/MacOS/VLC
  • change /path/to/your/video-file.mov to the actual file path of the video you’d like to autolaunch.

To export as an application, choose File->Export and set the File Format to Application. Save to wherever you like. To autolaunch on startup, go to System Preferences -> Users & Groups -> Login Items and add your app.

BONUS You may also want to have the machine automatically shut down (at night for instance), then reboot in the morning.  You can usually set this up by using a simple cron command that will shut down the machine at a given time, and/or OSX’s built-in Energy Saver Schedule (under System Prefs -> Energy Saver -> Schedule… ).

Trouble is, VLC seems to override the automatic shutdown methods, so  in order to shut down properly, we need to tell VLC to stop playing and quit before shutting down/rebooting. Here’s how to do that:

Save out as an Applescript, and you’re good. In my setup I used the system’s cron schedule to run the above VLC shutoff script, then one minute later shutdown the machine. To do this, in Terminal issue the command:

Then set the timing of your script & shutoff command like so:

UPDATE I noticed that sometimes VLC, when running fullscreen video, would show a ghosted outline of the OSX menu bar and its icons over the video, which looked terrible. I found that updating to the latest VLC fixed this problem. Also, since I was running without a keyboard & mouse, I shut off the annoying OSX Bluetooth auto-search on boot in System Preferences -> Bluetooth -> Advanced -> Open Bluetooth Setup Assistant… [disable this]

by 4 years ago

COMMENTS

  1. Mathis Oesterlen

    Hi Chris,
    thanks a lot for this great tutorial. In fact, I used this exact method for quite a while in installations, and it worked pretty well.
    But now I encountered two issues that drive me crazy:

    1. when the computers (not accessible) start in the morning with connected beamers (HDMI) being on standby, the auto-fullscreen does not work. Even worse, the video is played somewhere in the background, not visible at all. This used to be different, but I have the impression that you cannot rely completely on what VLC does when no display is attached. If I restart with projector on, everything is fine, but this is no option. Sometimes it works, sometimes not, I think. Any ideas?

    2. I used to have the mouse cursor problem, and now I am having it again in the described setting: in those cases in which the autostart works, the mouse cursor does not hide. Again, only with disconnected projector on startup. If everything is turned on and I do a restart,, the mouse hides. I could get rid of the mouse with some apple script moving it to the bottom with key strokes since it is out of the projection wall, but this is not very smart. Do you have any solution on this?

    Sorry to bother you with these questions, but maybe you have encountered similar problems and know a quick fix.
    Thanks!

  2. Chris Post author

    Hi Mathis, I don’t think I’ve encountered these specific problems but here are some ideas.

    1. You might be able to run a Detect Displays before deciding whether to launch VLC fullscreen. This is going down a path of making a more bloated program, which you seem to want to avoid. As I’ve gotten more into doing custom video installations, I’ve looked at other options like playing off a Raspberry Pi, which works pretty well as long as you don’t need it to loop absolutely seamlessly or have remote access. Lately I’ve been making video player apps in OpenFrameworks that autolaunch and do screen detection. This ends up being much simpler than the solution in the post above. If you are stuck using Mac’s for whatever reason, you can also install a remote manager like Teamviewer and do whatever reset/screen adjustment manually from any other internet-connected machine.

    2. I would also try your solution of moving the mouse via script, but again this goes down the path of unnecessary bloat. Another advantage of using the Pi is that you can run it ‘headless,’ that is without the GUI.

    At some point when I’ve got more free time I’ll write up a post about using the Pi as a video player. Until then good luck!

  3. Peter

    Hey Chris,
    this helped me out a lot. Thank you for your work!

RESPOND

Your email address will not be published. Required fields are marked *