Search code examples
javascriptlive-streaming

Using Javascript to read Livestreamer data


There is a command line tool called Livestreamer that can pipe livestream data from a given url. Then it opens VLC and the actual stream is shown through VLC, I wanted to make my own app with Electron, and I was curious how I could take the data livestreamer gets, and play it on an HTML5 video player or some other kind of player. I was also curious how VLC receives the data.

Thank you


Solution

  • I'm sure, that Livestreamer just passing rtmp link to VLC. RTMP is a special protocol for real time video. And you have a two ways for showing video in your app:

    • Live streamer has -o option, like: livestreamer someStreamUrl -o stream.mp4 - http://livestreamer.tanuki.se/cli.html#cmdoption-o, you can store stream in a file and read it by your app. Or for the same you can use option --rtmpdump FILENAME but you'll need RTMPDump installed on your device.
    • --player-external-http option - http://livestreamer.tanuki.se/cli.html#cmdoption--player-external-http, as i can see can create little http server and give you special url, which you can use to hadle and play in any player which you want (in your App too). Also --player-external-http-port SOMEPORT to configure port and --player-passthrough SOMEPROTOCOL to configure protocol will be userfull.