Skip to content

Post new selection

Rafostar edited this page Apr 2, 2020 · 2 revisions

It is possible to use HTTP post request to send new file selection to the built-in API server.

The data should be send to http://ip:port/api/playback-data and have JSON format as shown in example below. Remember that when selecting new file, its filepath must also be included in playlist (does not have to be in first position through):

const http = require('http');

const postData = {
  selection: {
    streamType: 'VIDEO',
    transcodeAudio: false,
    subsPath: "",
    filePath: "/path/to/first_video.mp4"
  },
  playlist: [
    "/path/to/first_video.mp4",
    "/path/to/second_video.mp4"
  ]
};

const options = {
  host: '127.0.0.1',
  port: 4000,
  path: '/api/playback-data',
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  }
};

var req = http.request(options);
req.write(JSON.stringify(postData));
req.end();
Clone this wiki locally