From 1d89212ab86bf9dd88602ffafdb7753394efd6d2 Mon Sep 17 00:00:00 2001 From: Abhishek Yadav Date: Mon, 13 Mar 2023 14:29:11 +0530 Subject: [PATCH] Fixes types: Adds `generated_subtitles` to the interface `CreateLiveStreamParams`. --- src/video/domain.ts | 1 + .../unit/video/resources/liveStreams.spec.cjs | 37 +++++++++++++------ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/video/domain.ts b/src/video/domain.ts index 3c9c616a..9550ab20 100644 --- a/src/video/domain.ts +++ b/src/video/domain.ts @@ -307,6 +307,7 @@ export interface CreateLiveStreamParams { audio_only?: boolean; max_continuous_duration?: number; embedded_subtitles?: Array; + generated_subtitles?: Array; use_slate_for_standard_latency?: boolean; reconnect_slate_url?: string; } diff --git a/test/unit/video/resources/liveStreams.spec.cjs b/test/unit/video/resources/liveStreams.spec.cjs index 219ad0bf..23125944 100644 --- a/test/unit/video/resources/liveStreams.spec.cjs +++ b/test/unit/video/resources/liveStreams.spec.cjs @@ -47,17 +47,32 @@ describe('Unit::LiveStreams', () => { expect(() => new LiveStreams(testApiKey, testSecret)).to.not.throw(); expect(TestLiveStreams.tokenId).to.equal(testApiKey); expect(TestLiveStreams.tokenSecret).to.equal(testSecret); - expect(() => new LiveStreams(testApiKey, testSecret).create({ - "playback_policy": [ - "public" - ], - "new_asset_settings": { - "playback_policy": [ - "public" - ] - }, - "reconnect_slate_url": "https://image.mux.com/01PZNlAJ72GcEBkoBj3PZ9kvKrFre00B8lzfyrm3302o004/thumbnail.png", - })).to.not.throw(); + expect(() => + new LiveStreams(testApiKey, testSecret).create({ + playback_policy: ['public'], + new_asset_settings: { + playback_policy: ['public'], + }, + reconnect_slate_url: + 'https://image.mux.com/01PZNlAJ72GcEBkoBj3PZ9kvKrFre00B8lzfyrm3302o004/thumbnail.png', + }) + ).to.not.throw(); + }); + + it('creates a new Livestream instance with generated_subtitles', () => { + expect(() => + new LiveStreams(testApiKey, testSecret).create({ + playback_policy: ['public'], + new_asset_settings: { + playback_policy: ['public'], + }, + generated_subtitles: [ + { + name: 'sub-en-001', + }, + ], + }) + ).to.not.throw(); }); });