I'm tying to open vlc with node child_process. I want to be able to play an audio file after it's link is fetched from itunes search api. The problem is that I always get this error
node:events:353
throw er; // Unhandled 'error' event
^
Error: spawn vlc ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:276:19)
at onErrorNT (node:internal/child_process:476:16)
at processTicksAndRejections (node:internal/process/task_queues:80:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:12)
at onErrorNT (node:internal/child_process:476:16)
at processTicksAndRejections (node:internal/process/task_queues:80:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn vlc',
path: 'vlc',
spawnargs: []
}
This is the code I'm using to spawn the process.
const child = require('child_process').spawn;
const vlc = child('vlc', ['https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview71/v4/66/7e/ac/667eac33-7fee-b1e6-6417-66a25eb52e1c/mzaf_4444158028715537974.plus.aac.p.m4a']);
What's the best way to open vlc and play the provided link?I'm not sure if use spawn or exec. How I can correctly open vlc and pass the track link to play to it?