Industry guru Dave Taylor offers free tech support on a wide variety of technical and business topics, including HTML, Apple iPhone, online advertising, Cascading Style Sheets, Web design, management, Unix, Linux, search engine optimization, online dating, Mac OS X, shell script programming and Microsoft Windows.

How can I have VLC play my DVDs automatically?

Given the choice, I'd much rather watch DVDs on my Mac with the great free app VLC rather than the lame "DVD Player" that is included with Mac OS X. How the heck do I do that?


Dave's Answer:

First off, credit where it's due: a succinct, albeit somewhat confusing answer to this question is offered up by Michal over at Macosxhints.com (see here). The problem is, most Mac users have no idea how to "create and save" an AppleScript. So let me offer up a more detailed tutorial.

First off, if you just want VLC to start up when you insert a DVD, but you'll have to actually find the DVD then click "play" to get it to start playing the movie, that's easy. Go to Apple Menu --> System Preferences and choose "CDs & DVDs":

Mac System Preferences: Hardware: CDs and DVDs

Click it and you'll see this:

Mac System Preferences: Hardware: CDs and DVDs: Settings

To have VLC start up instead of DVD Player, simply click on the "Open DVD Player" menu, choose Open Other Application, find VLC in your Applications folder, and click "Choose". That's all there is to it. If you don't mind having to munge around in the file system to find the newly inserted DVD and click "Play" each time. :-)

There's a smarter alternative, as Michel shows, but it requires you opening up the AppleScript editor and writing a very short little program...

Start out by launching Applications --> Apple Script --> Script Editor. You'll see this starting window:

Mac OS X: Apple Script: Script Editor

Now, ever so carefully, type in exactly the following:

tell application "VLC"
    OpenURL "dvdnav:///dev/rdisk1"
    play
    next
end tell

It'll look like this with the automatic formatting in the Script Editor:

Mac OS X: Apple Script: Script Editor: Run VLC Applescript

Almost done. Really. You can do it. :-)

Now, just choose File --> Save and save the script in a well-known location. I suggest the same place that you have the VLC app, or a new directory called "Scripts" in your Applications folder. Here's what I did:

Mac OS X: Apple Script: Script Editor: Autostart VLC on insertion of DVD

Last step. Back up in this article to where I show you how to choose VLC instead of DVD Player and instead of choosing VLC in the "CDs & DVDs" system preference, choose "Run Script..." and choose your new script. When I do that, I now see:

Mac OS X: Run VLC, not DVD Player, on seeing new DVD disk

That's all there is to it. Now when you insert a DVD, VLC launches and starts playing the movie!

By the way, I don't think it'll take long for the crack team at Videolan.org to add "autoplay newly inserted DVD" as a preference, and perhaps even to allow you to specify a preferred view too (e.g., normal, half size, full screen, etc). That'd be kewl...



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon    

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments

A couple of changes to your fine script, one to bring vlc to the front and the other to automatically change to full screen mode:

tell application "VLC"
activate
OpenURL "dvdnav:///dev/rdisk1"
play
next
fullscreen
end tell

Posted by: marcosw at May 3, 2008 9:09 AM

One more thing...

If you're using an external DVD connected by firewire, in the 2nd line change "rdisk 1" to "rdisk2".

For example: OpenURL "dvdnav:///dev/rdisk2"

Otherwise you will get an error message as VLC will try reading from your internal DVD drive (rdisk1).

Posted by: Alexander at October 16, 2008 4:16 AM

For some reason, the device designation on the mac mini w/OSX 10.5.7 needs to be "cdda:///dev/rdisk2", or vlc throws a bunch of errors about dvdnav and doesn't auto play a CD.

Posted by: John at May 31, 2009 2:13 PM

Dave, I have a HP Pavilion zx6000. After Best Buy replaced my DVD burner, it would not automaticlly start any dvds or music cds. I have set up the pref.s to play under the DVD-RW (D:) Properties, autoPlay. It still doesn't work. Any suggestions?

Posted by: Dan at December 16, 2009 9:44 AM

I have something to say, now that you mention it, but ...
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you for all your efforts on this Web site by buying you a cup of coffee!

I do have a comment, now that you mention it!











Remember personal info?


Please note that I will never send you any unsolicited email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.








Ask Dave Taylor: The iPhone App: Advertisement



Follow me on Twitter @DaveTaylor

Search
Find just the answers you seek from among our 2300+ free tech support articles by using our Lijit search engine.


Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Book Links
© 2002 - 2010 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.