Moh3eN
Moh3eN

Reputation: 189

How to detect DVD drive name with nodejs?

i create an cross platform electron application for playing video from dvd (in offline mode). when user inserted DVD in the driver , the xml file (list of videos url and details) should load from DVD.

so for video url i need access to dvd driver name.

<video src="file:/video/video.mp4">

*file:/ should be dvd drive name.

there was a npm package but not working https://www.npmjs.com/package/drivelist

Upvotes: 3

Views: 614

Answers (1)

Moh3eN
Moh3eN

Reputation: 189

there was another package return system volume as dvd-rom. https://www.npmjs.com/package/diskinfo

this code return the dvd drive name, but i'm not sure its good idea or not.

var d = require('diskinfo');
var cddisk;
d.getDrives(function (err, aDrives) {
  for (var i = 0; i < aDrives.length; i++) {
    if (aDrives[i].available == 0) {
      cddisk = aDrives[i].mounted;
      console.log(cddisk);
    }
  }

});

also this package not supported in mac.

Upvotes: 3

Related Questions