restreamer icon indicating copy to clipboard operation
restreamer copied to clipboard

I want to get iframe code or player URL.

Open fatherslab-taylor opened this issue 3 years ago • 2 comments

A restreamer is an excellent solution for me, who needs to show RTSP on a website. However, I have an unresolved error and I am asking for advice.

I am trying to display an rtsp file on a website using the API.

test rtsp url: rtsp://rtsp.stream/pattern

  1. Get accessToken via /api/login
  2. I created a process using /api/v3/process
{
    type: "ffmpeg",
    id: `restreamer-ui:ingest:${randomId}`,
    reference: `${randomId}`,
    input: [{
        id: "input_0",
        address: "rtsp://rtsp.stream/pattern",
        options: ["-fflags", "+genpts", "-thread_queue_size", "512", "-stimeout", "5000000", "-rtsp_transport", "tcp"]
    }],
    output: [{
        id: "output_0",
        address: `{memfs}/${randomId}.m3u8`,
        options: ["-dn", "-sn", "-map", "0:0", "-codec:v", "copy", "-vsync", "0", "-copyts", "-start_at_zero", "-map", "0:1", "-codec:a", "copy", "-metadata", `title=http://49.172.228.210:5001/${randomId}/oembed.json`, "-metadata", "service_provider=datarhei-Restreamer", "-f", "hls", "-start_number", "0", "-hls_time", "2", "-hls_list_size", "6", "-hls_flags", "append_list+delete_segments", "-hls_segment_filename", `{memfs}/${randomId}_%04d.ts`, "-y", "-method", "PUT"],
        cleanup: [{
            pattern: `memfs:/${randomId}_*.ts`,
            max_files: 8,
            max_file_age_seconds: 0,
            purge_on_delete: true
        }, {
            pattern: `memfs:/${randomId}.m3u8`,
            max_file_age_seconds: 0,
            purge_on_delete: true
        }]
    }],
    options: ["-err_detect", "ignore_err"],
    autostart: true,
    reconnect: true,
    reconnect_delay_seconds: 15,
    stale_timeout_seconds: 30
}
  1. I want to get the iframe code or player URL of the created process.

I searched /api/v3/process to solve problem #3, but I can't figure out where the iframe code or player URL is recorded.

Please advise on what to do.

fatherslab-taylor avatar Jun 20 '22 11:06 fatherslab-taylor

The iframe and player URL are created by the UI. If you want that your own process also shows up in the UI then you have to use a UUIDv4 for your ${randomId}. This is the format the UI uses and expects.

Alternatively, you might use any other player for HLS streams and use the .m3u8 as source. Also the ID of the process can be any value if you don't need to rely on the UI.

ioppermann avatar Jun 20 '22 15:06 ioppermann

Can I get what I want in the following way?

  1. Create a process using /api/v3/process.
  2. Check the .m3u8 address using /api/v3/process/{id}
  3. Expose on the website using HLS player.

Am I thinking in the right direction? Are there any HLS players provided by restreamer?

fatherslab-taylor avatar Jun 21 '22 02:06 fatherslab-taylor