Search code examples
javascriptvlc

Start network stream to local VLC Media Player software with Javascript


is there a method to start (thanks to a javascript script) the VLC media player software locally by automatically opening the network stream

function, or is it necessary to use a web solution?


Solution

  • I solved with this code:

    var cp = require('child_process');
    var vlcCommand = require('vlc-command');
    vlcCommand(function(err, cmd) {
        if (err)
            return console.error('Comando VLC non trovato ' + err);
        cp.execFile(cmd, ['https://server19.streamingaw.online/DDL/ANIME/KanojoMoKanojo/KanojoMoKanojo_Ep_01_SUB_ITA.mp4'], function(err, stdout) {
            if (err)
                return console.error(err);
            console.log(stdout);
        });
    });
    

    I used two libraries(child_process and vlc-command) that communicate with the installation of VLC.

    cp.execFile
    

    Starts a network session in VLC.