Developer Guide: Stream videos - EyevinnOSC/community GitHub Wiki

Stream Videos

Upload and play back your video files in your application using open web services in five minutes or less.

In this guide

  1. Get an API Access Token and setup project.
  2. Setup a video processing pipeline for streaming.
  3. Upload and process video

Prerequisites

Get an API Access Token and setup project

Navigate to Settings / API in the Eyevinn Open Source Cloud web console.

Skärmavbild 2025-01-30 kl  22 54 07

Copy this token and store in your shell's environment in the environment variable OSC_ACCESS_TOKEN.

% export OSC_ACCESS_TOKEN=<access-token-copied-above>

Setup a NodeJS project.

% mkdir vod
% cd vod
% npm init

Install the Javascript client SDK.

% npm install --save @osaas/client-core @osaas/client-transcode

Create a file called vod.js and open it in your favorite editor.

Setup video processing pipeline

Add the following code to your file to setup the video processing pipeline.

const { Context } = require('@osaas/client-core');
const { createVodPipeline, createVod } = require('@osaas/client-transcode');

async function setup(context) {
  const pipeline = await createVodPipeline('devguide', context);
  return pipeline;
}

async function main() {
  const ctx = new Context();
  const pipeline = await setup(ctx);
}

main();

Run the script.

% node vod.js

After a few minutes it will have created a video processing pipeline.

Upload and process video

Now we can use the pipeline we created to upload and process a video. Here is a demo video you can use:

We will add the following to the main function.

  const vod = await createVod(pipeline,
    'https://testcontent.eyevinn.technology/mp4/VINN.mp4',
    ctx
  );
  console.log(vod);

Now when we run the script it will return the following.

% node vod.js
{
  id: '52e124b8-ebe8-4dfe-9b59-8d33abb359ca',
  vodUrl: 'https://eyevinnlab-devguide.minio-minio.auto.prod.osaas.io/devguide/VINN/52e124b8-ebe8-4dfe-9b59-8d33abb359ca/index.m3u8'
}

When the video processing has completed we can now paste the vodURL in a video player.

Skärmavbild 2025-01-31 kl  00 21 56