Search code examples
javamultimedia

How to discover the type of media inserted in a DVD/CD drive? (java)


When I insert a DVD or CD, I want to programmatically know what type of media(DVD or CD) is it.


Solution

  • IMHO impossible to get this solved with pure Java. The only thing you can do is via the FileSystemView and detect whether a certain file is a cd/dvd drive but not if it contains a CD or DVD as media. Although a one can perform an educated guess by getting the total used space.

    For a working solution you'll need at least JNI code for the three "big" OS. I'm not aware of any project that has done this. There are only platform specific libraries / utilities for Linux that use the usual cdrw/dvdrw tools in the background.