-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (30 loc) · 921 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
var os = require('os')
var path = require('path')
var platform = os.platform()
//patch for compatibilit with electron-builder, for smart built process.
if(platform == "darwin"){
platform = "mac";
}else if(platform == "win32"){
platform = "win";
// no win support for now
console.error('Unsupported platform.', platform);
process.exit(1)
}
//adding browser, for use case when module is bundled using browserify. and added to html using src.
if (platform !== 'linux' && platform !== 'mac' && platform !== 'win' && platform !=="browser") {
console.error('Unsupported platform.', platform);
process.exit(1)
}
var arch = os.arch()
if (platform === 'mac' && (arch !== 'x64' && arch !== 'arm64' )) {
console.error('Unsupported architecture.')
process.exit(1)
}
var ffmpegPath = path.join(
__dirname,
'bin',
platform,
arch,
platform === 'win' ? 'ffmpeg.exe' : 'ffmpeg'
)
exports.path = ffmpegPath;