Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [0.2.1] (2026-03-10)

### Added

- RTStream `generateStream(start, end, playerConfig?)` now supports `playerConfig.title`, `playerConfig.description`, and `playerConfig.slug` for player share metadata.

## [0.2.0] (2026-02-02)

### ⚠️ Breaking Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "videodb",
"version": "0.2.0",
"version": "0.2.1",
"description": "A NodeJS wrapper for VideoDB's API written in TypeScript",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
31 changes: 28 additions & 3 deletions src/core/rtstream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ export interface RTStreamExportResult {
duration?: number;
}

export interface RTStreamPlayerConfig {
/** Optional title shown in the player share page */
title?: string;
/** Optional description shown in the player share page */
description?: string;
/** Optional slug prefix for the generated player share URL */
slug?: string;
}

/**
* RTStreamShot class for rtstream search results
*/
Expand Down Expand Up @@ -340,6 +349,7 @@ export class RTStream {
public createdAt?: string;
public sampleRate?: number;
public status?: string;
public playerUrl?: string;
/** Channel ID this rtstream is associated with */
public channelId?: string;
/** Media types this rtstream handles */
Expand Down Expand Up @@ -415,16 +425,31 @@ export class RTStream {
* Generate a stream from the rtstream
* @param start - Start time of the stream in Unix timestamp format
* @param end - End time of the stream in Unix timestamp format
* @param playerConfig - Optional player share page metadata
* @returns Stream URL
*/
public generateStream = async (
start: number,
end: number
end: number,
playerConfig?: RTStreamPlayerConfig
): Promise<string | null> => {
const res = await this.#vhttp.get<{ streamUrl: string }>(
const params: Record<string, unknown> = { start, end };

if (playerConfig?.title !== undefined) {
params.player_title = playerConfig.title;
}
if (playerConfig?.description !== undefined) {
params.player_description = playerConfig.description;
}
if (playerConfig?.slug !== undefined) {
params.player_slug_prefix = playerConfig.slug;
}

const res = await this.#vhttp.get<{ streamUrl: string; playerUrl?: string }>(
[ApiPath.rtstream, this.id, ApiPath.stream],
{ params: { start, end } }
{ params }
);
this.playerUrl = res.data?.playerUrl;
return res.data?.streamUrl || null;
};

Expand Down