Constructor
new QueuePool(options)
- Description:
Creates a new Queue Pool
Example
import { Context } from '@osaas/client-core';
import { QueuePool } from '@osaas/client-transcode';
const ctx = new Context();
// Create a new pool with 2 queues
const pool = new QueuePool({ context: ctx, size: 2 });
await pool.init();
Parameters:
Name | Type | Description |
---|---|---|
options |
QueuePoolOptions | Queue Pool options |
Methods
(async) destroy()
- Description:
Destroys the pool by removing the queues
Example
await pool.destroy();
(async) init()
- Description:
Initializes the pool by creating the queues
Example
await pool.init();
(async) transcode(source, destination, options)
- Description:
Transcodes a media file into an ABR bundle that is transferred to a destination
Example
const source = new URL('https://example.com/video.mp4');
const destination = new URL('s3://mybucket/video/');
// Transcode the first 10 seconds of the video
await pool.transcode(source, destination, { duration: 10 });
// Transcode the entire video and create a streaming package
await pool.transcode(source, destination, { packageDestination: new URL('s3://mybucket/streaming/') });
Parameters:
Name | Type | Description |
---|---|---|
source |
URL | Source URL of the media file (supported protocols: http, https) |
destination |
URL | Destination URL of the transcoded media files (supported protocols: s3) |
options |
PoolTranscodeOptions | Transcode options |