@norskvideo/norsk-sdk 0.0.328 → 0.0.330

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,12 @@
1
1
  import { AudioCodec } from '@norskvideo/norsk-api/lib/media_pb';
2
+ import { CmafAudioMessage } from '@norskvideo/norsk-api/lib/media_pb';
3
+ import { CmafMasterMessage } from '@norskvideo/norsk-api/lib/media_pb';
4
+ import { CmafVideoMessage } from '@norskvideo/norsk-api/lib/media_pb';
5
+ import { CmafWebVttMessage } from '@norskvideo/norsk-api/lib/media_pb';
2
6
  import { Context } from '@norskvideo/norsk-api/lib/media_pb';
3
7
  import { CurrentLoad } from '@norskvideo/norsk-api/lib/shared/common_pb';
4
8
  import { ExplicitChannel } from '@norskvideo/norsk-api/lib/media_pb';
5
9
  import * as grpc from '@grpc/grpc-js';
6
- import { HlsAudioMessage } from '@norskvideo/norsk-api/lib/media_pb';
7
- import { HlsMasterMessage } from '@norskvideo/norsk-api/lib/media_pb';
8
10
  import { HlsMasterPushMessage } from '@norskvideo/norsk-api/lib/media_pb';
9
11
  import { HlsOutputEvent } from '@norskvideo/norsk-api/lib/media_pb';
10
12
  import { HlsTsAudioMessage } from '@norskvideo/norsk-api/lib/media_pb';
@@ -12,8 +14,6 @@ import { HlsTsAudioPushMessage } from '@norskvideo/norsk-api/lib/media_pb';
12
14
  import { HlsTsCombinedPushMessage } from '@norskvideo/norsk-api/lib/media_pb';
13
15
  import { HlsTsVideoMessage } from '@norskvideo/norsk-api/lib/media_pb';
14
16
  import { HlsTsVideoPushMessage } from '@norskvideo/norsk-api/lib/media_pb';
15
- import { HlsVideoMessage } from '@norskvideo/norsk-api/lib/media_pb';
16
- import { HlsWebVttMessage } from '@norskvideo/norsk-api/lib/media_pb';
17
17
  import { HlsWebVttPushMessage } from '@norskvideo/norsk-api/lib/media_pb';
18
18
  import { MediaClient } from '@norskvideo/norsk-api/lib/media_grpc_pb';
19
19
  import { Nullable } from 'typescript-nullable';
@@ -49,6 +49,11 @@ export declare class AudioBuildMultichannelNode extends AutoProcessorMediaNode<"
49
49
  /** @public */
50
50
  export declare interface AudioBuildMultichannelSettings extends ProcessorNodeSettings<AudioBuildMultichannelNode> {
51
51
  channelLayout: ChannelLayout;
52
+ /**
53
+ * Stream keys specifying the source for each channel, where the order is
54
+ * significant. The streams must all have the same sample format and sample
55
+ * rate.
56
+ */
52
57
  channelList: readonly StreamKey[];
53
58
  outputStreamKey: StreamKey;
54
59
  }
@@ -158,11 +163,11 @@ export declare class AudioMixerNode<Pins extends string> extends ProcessorMediaN
158
163
 
159
164
  /** @public */
160
165
  export declare interface AudioMixerSettings<Pins extends string> extends ProcessorNodeSettings<AudioMixerNode<Pins>> {
161
- /** The sources to mix */
166
+ /** The audio sources to mix */
162
167
  sources: readonly AudioMixerSource<Pins>[];
163
- /** The name of the output source */
168
+ /** The source name to use for the output stream */
164
169
  outputSource: string;
165
- /** The sample rate of the output */
170
+ /** The sample rate that the mixer runs at */
166
171
  sampleRate?: SampleRate;
167
172
  }
168
173
 
@@ -246,13 +251,22 @@ declare class AutoProcessorMediaNode<Pins extends string> {
246
251
 
247
252
  /** @public */
248
253
  export declare class AutoSinkMediaNode<Pins extends string> extends SinkMediaNode<Pins | "auto"> {
249
- /** Subscribe to the given sources
254
+ /** Subscribe to the given sources.
255
+ *
250
256
  * This version of subscribe simply requires a list of stream keys to be
251
257
  * returned from each selector, and the server will automatically
252
- * assign each stream to the appropriate pin on the sink node
253
- * This is the appropriate method for most cases
258
+ * assign each stream to the appropriate pin on the sink node.
259
+ * This is the appropriate method for most cases.
260
+ *
261
+ * @param done - will be called with no arguments if the subscription succeeds,
262
+ * or an error if it failed. This error indicates the specific reason it
263
+ * failed, so you can take appropriate actions in response. It will be called
264
+ * before the `subscribedStreamsChangedFn` or `subscribeErrorFn` callbacks
265
+ * provided in the config for the node.
266
+ *
267
+ * Errors are also logged to the debug log.
254
268
  */
255
- subscribe(sources: ReceiveFromAddressAuto[], validation?: (context: Context) => boolean): void;
269
+ subscribe(sources: ReceiveFromAddressAuto[], validation?: (context: Context) => boolean, done?: (error?: SubscriptionError) => void): void;
256
270
  }
257
271
 
258
272
  /** @public */
@@ -289,11 +303,13 @@ export declare class AwsTranscribeNode extends AutoProcessorMediaNode<"audio"> {
289
303
 
290
304
  /** @public */
291
305
  export declare interface AwsTranscribeSettings extends ProcessorNodeSettings<AwsTranscribeNode> {
306
+ /** Region for the transcribe endpoint */
292
307
  awsRegion: string;
293
308
  outputStreamId: number;
294
309
  language: string;
295
310
  sentenceBuildMode: SentenceBuildMode;
296
311
  sentenceStabilizationMode: StabilizationMode;
312
+ awsCredentials?: AwsCredentials;
297
313
  }
298
314
 
299
315
  /**
@@ -487,11 +503,84 @@ export declare interface ChaosMonkeySettings extends ProcessorNodeSettings<Chaos
487
503
  frameDrop?: DropRandom | DropEvery;
488
504
  }
489
505
 
506
+ /**
507
+ * @public
508
+ * {@link NorskOutput.cmafAudio}
509
+ */
510
+ export declare class CmafAudioOutputNode extends HlsNodeWithPlaylist<CmafAudioMessage, "audio", CmafAudioOutputNode> {
511
+ updateCredentials(settings: UpdateCredentials): void;
512
+ }
513
+
514
+ /** @public */
515
+ export declare interface CmafAudioOutputSettings extends SinkNodeSettings<CmafAudioOutputNode> {
516
+ segmentDurationSeconds: number;
517
+ partDurationSeconds: number;
518
+ delayOutputMs?: number;
519
+ encryption?: {
520
+ encryptionKey: string;
521
+ encryptionKeyId: string;
522
+ };
523
+ destinations: CMAFDestinationSettings[];
524
+ }
525
+
490
526
  /** @public */
491
527
  export declare type CMAFDestinationSettings = HlsPushDestinationSettings | AwsS3PushDestinationSettings | LocalPullDestinationSettings;
492
528
 
529
+ /**
530
+ * @public
531
+ * {@link NorskOutput.cmafMaster}
532
+ */
533
+ export declare class CmafMasterOutputNode extends CommonHlsNode<CmafMasterMessage, "video" | "audio" | "subtitle", CmafMasterOutputNode> {
534
+ /** @public The URL of the master playlist */
535
+ playlistUrl: string;
536
+ updateCredentials(settings: UpdateCredentials): void;
537
+ }
538
+
539
+ /** @public */
540
+ export declare interface CmafMasterOutputSettings extends SinkNodeSettings<CmafMasterOutputNode> {
541
+ playlistName: string;
542
+ pathPrefix?: string;
543
+ destinations: CMAFDestinationSettings[];
544
+ }
545
+
546
+ /**
547
+ * @public
548
+ * {@link NorskOutput.cmafVideo}
549
+ */
550
+ export declare class CmafVideoOutputNode extends HlsNodeWithPlaylist<CmafVideoMessage, "video", CmafVideoOutputNode> {
551
+ updateCredentials(settings: UpdateCredentials): void;
552
+ }
553
+
554
+ /** @public */
555
+ export declare interface CmafVideoOutputSettings extends SinkNodeSettings<CmafVideoOutputNode> {
556
+ segmentDurationSeconds: number;
557
+ partDurationSeconds: number;
558
+ delayOutputMs?: number;
559
+ sessionId?: string;
560
+ id: string;
561
+ encryption?: {
562
+ encryptionKey: string;
563
+ encryptionKeyId: string;
564
+ };
565
+ destinations: CMAFDestinationSettings[];
566
+ }
567
+
568
+ /**
569
+ * @public
570
+ * {@link NorskOutput.cmafWebVtt}
571
+ */
572
+ export declare class CmafWebVttOutputNode extends HlsNodeWithPlaylist<CmafWebVttMessage, "subtitle", CmafWebVttOutputNode> {
573
+ }
574
+
575
+ /** @public */
576
+ export declare interface CmafWebVttOutputSettings extends SinkNodeSettings<CmafWebVttOutputNode> {
577
+ segmentDurationSeconds: number;
578
+ sessionId?: string;
579
+ delayOutputMs?: number;
580
+ }
581
+
493
582
  declare class CommonHlsNode<ClientMessage, Pins extends string, T extends MediaNodeState> extends AutoSinkMediaNode<Pins> {
494
- constructor(client: MediaClient, settings: NodeSettings<T> & StreamStatsMixin, grpcInit: () => grpc.ClientDuplexStream<ClientMessage, HlsOutputEvent>, subscribeFn: (subscription: Subscription) => void, subscribedStreamsChangedFn?: (streams: StreamMetadata[]) => void);
583
+ constructor(client: MediaClient, settings: SinkNodeSettings<T> & StreamStatsMixin, grpcInit: () => grpc.ClientDuplexStream<ClientMessage, HlsOutputEvent>, subscribeFn: (subscription: Subscription) => void, subscribedStreamsChangedFn?: (streams: StreamMetadata[]) => void);
495
584
  close(): void;
496
585
  }
497
586
 
@@ -509,13 +598,47 @@ export declare type ComposeMissingStreamBehaviour =
509
598
 
510
599
  /** @public */
511
600
  export declare interface ComposePart<Pins> {
601
+ /** Input pin for this source */
512
602
  pin: Pins;
603
+ /**
604
+ * The area within the source picture to include. This may be the full picture
605
+ * or cropped, and will be rescaled if necessary.
606
+ */
513
607
  sourceRect: OffsetRect;
608
+ /**
609
+ * The area within the destination picture to place this part of the
610
+ * composition.
611
+ */
514
612
  destRect: OffsetRect;
613
+ /**
614
+ * Z-index to determine ordering by which the sources are overlaid
615
+ * (higher layers appear on top)
616
+ */
515
617
  zIndex: number;
618
+ /**
619
+ * Opacity multiplier of this overlay (where 0.0 is fully transparent and 1.0
620
+ * is fully opaque)
621
+ */
516
622
  opacity: number;
623
+ /** Optionally identify the part to enable transitions */
517
624
  id?: string;
625
+ /**
626
+ * Optionally specify a transition for this part. A transition is applied only
627
+ * if the part is specified in both the existing and the current/new
628
+ * configuration, identified by having the same id specified, and a transition
629
+ * is specified for the new configuration.
630
+ */
518
631
  transition?: PartTransition;
632
+ /**
633
+ * Optionally supply a reference resolution. This allows description of the
634
+ * composition in a desired coordinate system, e.g. a resolution of 100x100
635
+ * can be specified to allow the source and destination areas to be described
636
+ * in percentage terms, or a notional resolution can be used that is
637
+ * independant of the source resolutions that may be provided.
638
+ *
639
+ * If unset, this will be overriden by a global reference resolution if present
640
+ *
641
+ */
519
642
  referenceResolution?: Resolution;
520
643
  }
521
644
 
@@ -530,20 +653,64 @@ export declare class ComposeVideoNode<Pins extends string> extends ProcessorMedi
530
653
 
531
654
  /** @public */
532
655
  export declare interface ComposeVideoSettings<Pins extends string> extends ProcessorNodeSettings<ComposeVideoNode<Pins>> {
656
+ /**
657
+ * Required. Stream key of the reference stream. This is the video stream
658
+ * which defines the output frame timing, which will typically be part of the
659
+ * composition, e.g. the main picture in the case of a simple
660
+ * overlay/picture-in-picture, or the top left quadrant of a 4-way split
661
+ * screen.
662
+ */
533
663
  referenceStream: Pins;
664
+ /** The parts (images/overlays) to include in the composition */
534
665
  parts: readonly ComposePart<Pins>[];
666
+ /**
667
+ * Optionally supply a fallback reference resolution. This allows description of the
668
+ * composition in a desired coordinate system, e.g. a resolution of 100x100
669
+ * can be specified to allow the source and destination areas to be described
670
+ * in percentage terms, or a notional resolution can be used that is
671
+ * independant of the source resolutions that may be provided.
672
+ *
673
+ * if set here, this reference resolution will be applied to
674
+ * any parts that do not have their own reference resolution specified
675
+ *
676
+ * If not provided the source and destination rectangles are in terms of the
677
+ * source and output resolutions respectively.
678
+ */
535
679
  referenceResolution?: Resolution;
680
+ /** The resolution of the output video */
536
681
  outputResolution: Resolution;
682
+ /**
683
+ * Output pixel format to use. If not specified, this will be chosen
684
+ * automatically based on the sources present in the initial composition
685
+ */
537
686
  outputPixelFormat?: PixelFormat;
687
+ /**
688
+ * Behaviour in the case of a missing stream used in an active composition
689
+ * part. Note that this does not apply to the reference stream, but to every
690
+ * part which does not use the reference stream, whether at startup or on
691
+ * context change.
692
+ *
693
+ * Missing means not present in the context or never having sent a frame.
694
+ */
538
695
  missingStreamBehaviour?: ComposeMissingStreamBehaviour;
696
+ /**
697
+ * Called when the transitions specified in the last config update have
698
+ * completed (in the case of multiple parts with specified transitions of
699
+ * different duration, this means that the last remaining transitions have
700
+ * completed
701
+ */
539
702
  onTransitionComplete?: () => void;
540
703
  }
541
704
 
542
705
  /** @public */
543
706
  export declare interface ComposeVideoSettingsUpdate<Pins extends string> {
707
+ /** Update the parts (images/overlays) to include in the composition */
544
708
  parts: readonly ComposePart<Pins>[];
545
709
  }
546
710
 
711
+ /** @public */
712
+ export declare type ContextType = "full" | "singleSource" | "singleProgram" | "singleStream" | "singleRendition";
713
+
547
714
  /** @public */
548
715
  export declare interface Core {
549
716
  logicalCpuIds: LogicalCpuId[];
@@ -670,43 +837,6 @@ export declare interface HardwareInfo {
670
837
  deckLinkCards: DeckLinkCard[];
671
838
  }
672
839
 
673
- /**
674
- * @public
675
- * {@link NorskOutput.hlsAudio}
676
- */
677
- export declare class HlsAudioOutputNode extends HlsNodeWithPlaylist<HlsAudioMessage, "audio", HlsAudioOutputNode> {
678
- updateCredentials(settings: UpdateCredentials): void;
679
- }
680
-
681
- /** @public */
682
- export declare interface HlsAudioOutputSettings extends NodeSettings<HlsAudioOutputNode> {
683
- segmentDurationSeconds: number;
684
- partDurationSeconds: number;
685
- delayOutputMs?: number;
686
- encryption?: {
687
- encryptionKey: string;
688
- encryptionKeyId: string;
689
- };
690
- destinations: CMAFDestinationSettings[];
691
- }
692
-
693
- /**
694
- * @public
695
- * {@link NorskOutput.hlsMaster}
696
- */
697
- export declare class HlsMasterOutputNode extends CommonHlsNode<HlsMasterMessage, "video" | "audio" | "subtitle", HlsMasterOutputNode> {
698
- /** @public The URL of the master playlist */
699
- playlistUrl: string;
700
- updateCredentials(settings: UpdateCredentials): void;
701
- }
702
-
703
- /** @public */
704
- export declare interface HlsMasterOutputSettings extends NodeSettings<HlsMasterOutputNode> {
705
- playlistName: string;
706
- pathPrefix?: string;
707
- destinations: CMAFDestinationSettings[];
708
- }
709
-
710
840
  /**
711
841
  * @public
712
842
  * {@link NorskOutput.hlsMasterPush}
@@ -715,17 +845,17 @@ export declare class HlsMasterPushOutputNode extends CommonHlsNode<HlsMasterPush
715
845
  }
716
846
 
717
847
  /** @public */
718
- export declare interface HlsMasterPushOutputSettings extends NodeSettings<HlsMasterPushOutputNode> {
848
+ export declare interface HlsMasterPushOutputSettings extends SinkNodeSettings<HlsMasterPushOutputNode> {
719
849
  playlistName: string;
720
850
  destination: CMAFDestinationSettings;
721
851
  }
722
852
 
723
853
  declare class HlsNodeWithPlaylist<ClientMessage, Pins extends string, T extends MediaNodeState> extends CommonHlsNode<ClientMessage, Pins, T> {
724
- constructor(client: MediaClient, settings: NodeSettings<T> & StreamStatsMixin, grpcInit: () => grpc.ClientDuplexStream<ClientMessage, HlsOutputEvent>, subscribeFn: (subscription: Subscription) => void);
854
+ constructor(client: MediaClient, settings: SinkNodeSettings<T> & StreamStatsMixin, grpcInit: () => grpc.ClientDuplexStream<ClientMessage, HlsOutputEvent>, subscribeFn: (subscription: Subscription) => void);
725
855
  /** @public
726
856
  * Returns the URL to the HLS playlist entry. Note this can only be evaluated once the stream is active as it
727
857
  * varies with the stream subscribed to. Useful during development, but you probably want to
728
- * use {@link NorskOutput.hlsMaster} for production.
858
+ * use {@link NorskOutput.cmafMaster} for production.
729
859
  */
730
860
  url(): Promise<string>;
731
861
  }
@@ -749,7 +879,7 @@ export declare class HlsTsAudioOutputNode extends CommonHlsNode<HlsTsAudioMessag
749
879
  }
750
880
 
751
881
  /** @public */
752
- export declare interface HlsTsAudioOutputSettings extends NodeSettings<HlsTsAudioOutputNode> {
882
+ export declare interface HlsTsAudioOutputSettings extends SinkNodeSettings<HlsTsAudioOutputNode> {
753
883
  segmentDurationSeconds: number;
754
884
  delayOutputMs?: number;
755
885
  }
@@ -762,7 +892,7 @@ export declare class HlsTsAudioPushOutputNode extends CommonHlsNode<HlsTsAudioPu
762
892
  }
763
893
 
764
894
  /** @public */
765
- export declare interface HlsTsAudioPushOutputSettings extends NodeSettings<HlsTsAudioPushOutputNode> {
895
+ export declare interface HlsTsAudioPushOutputSettings extends SinkNodeSettings<HlsTsAudioPushOutputNode> {
766
896
  segmentDurationSeconds: number;
767
897
  delayOutputMs?: number;
768
898
  destination: CMAFDestinationSettings;
@@ -776,7 +906,7 @@ export declare class HlsTsCombinedPushOutputNode extends CommonHlsNode<HlsTsComb
776
906
  }
777
907
 
778
908
  /** @public */
779
- export declare interface HlsTsCombinedPushOutputSettings extends NodeSettings<HlsTsCombinedPushOutputNode> {
909
+ export declare interface HlsTsCombinedPushOutputSettings extends SinkNodeSettings<HlsTsCombinedPushOutputNode> {
780
910
  segmentDurationSeconds: number;
781
911
  delayOutputMs?: number;
782
912
  destination: CMAFDestinationSettings;
@@ -791,7 +921,7 @@ export declare class HlsTsVideoOutputNode extends CommonHlsNode<HlsTsVideoMessag
791
921
  }
792
922
 
793
923
  /** @public */
794
- export declare interface HlsTsVideoOutputSettings extends NodeSettings<HlsTsVideoOutputNode> {
924
+ export declare interface HlsTsVideoOutputSettings extends SinkNodeSettings<HlsTsVideoOutputNode> {
795
925
  segmentDurationSeconds: number;
796
926
  delayOutputMs?: number;
797
927
  }
@@ -804,48 +934,12 @@ export declare class HlsTsVideoPushOutputNode extends CommonHlsNode<HlsTsVideoPu
804
934
  }
805
935
 
806
936
  /** @public */
807
- export declare interface HlsTsVideoPushOutputSettings extends NodeSettings<HlsTsVideoPushOutputNode> {
937
+ export declare interface HlsTsVideoPushOutputSettings extends SinkNodeSettings<HlsTsVideoPushOutputNode> {
808
938
  segmentDurationSeconds: number;
809
939
  delayOutputMs?: number;
810
940
  destination: CMAFDestinationSettings;
811
941
  }
812
942
 
813
- /**
814
- * @public
815
- * {@link NorskOutput.hlsVideo}
816
- */
817
- export declare class HlsVideoOutputNode extends HlsNodeWithPlaylist<HlsVideoMessage, "video", HlsVideoOutputNode> {
818
- updateCredentials(settings: UpdateCredentials): void;
819
- }
820
-
821
- /** @public */
822
- export declare interface HlsVideoOutputSettings extends NodeSettings<HlsVideoOutputNode> {
823
- segmentDurationSeconds: number;
824
- partDurationSeconds: number;
825
- delayOutputMs?: number;
826
- sessionId?: string;
827
- id: string;
828
- encryption?: {
829
- encryptionKey: string;
830
- encryptionKeyId: string;
831
- };
832
- destinations: CMAFDestinationSettings[];
833
- }
834
-
835
- /**
836
- * @public
837
- * {@link NorskOutput.hlsWebVtt}
838
- */
839
- export declare class HlsWebVttOutputNode extends HlsNodeWithPlaylist<HlsWebVttMessage, "subtitle", HlsWebVttOutputNode> {
840
- }
841
-
842
- /** @public */
843
- export declare interface HlsWebVttOutputSettings extends NodeSettings<HlsWebVttOutputNode> {
844
- segmentDurationSeconds: number;
845
- sessionId?: string;
846
- delayOutputMs?: number;
847
- }
848
-
849
943
  /**
850
944
  * @public
851
945
  * {@link NorskOutput.hlsWebVttPush}
@@ -853,7 +947,8 @@ export declare interface HlsWebVttOutputSettings extends NodeSettings<HlsWebVttO
853
947
  export declare class HlsWebVttPushOutputNode extends CommonHlsNode<HlsWebVttPushMessage, "subtitle", HlsWebVttPushOutputNode> {
854
948
  }
855
949
 
856
- export declare interface HlsWebVttPushOutputSettings extends NodeSettings<HlsWebVttPushOutputNode> {
950
+ /** @public */
951
+ export declare interface HlsWebVttPushOutputSettings extends SinkNodeSettings<HlsWebVttPushOutputNode> {
857
952
  segmentDurationSeconds: number;
858
953
  delayOutputMs?: number;
859
954
  destination: CMAFDestinationSettings;
@@ -1024,7 +1119,7 @@ export declare class Mp4FileOutputNode extends AutoSinkMediaNode<"audio" | "vide
1024
1119
  * @public
1025
1120
  * Settings to control MP4 file output
1026
1121
  */
1027
- export declare interface Mp4FileOutputSettings extends NodeSettings<Mp4FileOutputNode>, StreamStatsMixin {
1122
+ export declare interface Mp4FileOutputSettings extends SinkNodeSettings<Mp4FileOutputNode>, StreamStatsMixin {
1028
1123
  /**
1029
1124
  * Required: stream fragmented MP4 to this file.
1030
1125
  */
@@ -1202,6 +1297,8 @@ export declare interface NorskControl {
1202
1297
  * Record statistical information about media streams, including bitrate,
1203
1298
  * frame rate, and number of keyframes, measured over some configurable
1204
1299
  * sampling windows.
1300
+ *
1301
+ * Corresponding settings are found on many input and output nodes.
1205
1302
  * @param settings - Callback and sampling intervals
1206
1303
  */
1207
1304
  streamStats(settings: StreamStatsSettings): Promise<StreamStatsNode>;
@@ -1237,6 +1334,10 @@ export declare interface NorskInput {
1237
1334
  * @param settings - Configuration for the RTMP server
1238
1335
  */
1239
1336
  rtmpServer(settings: RtmpServerInputSettings): Promise<RtmpServerInputNode>;
1337
+ /**
1338
+ * Read from a Transport Stream file with realtime playback.
1339
+ * @param settings - Configuration for the file input
1340
+ */
1240
1341
  localTsFile(settings: LocalFileInputSettings): Promise<TsFileInputNode>;
1241
1342
  /**
1242
1343
  * Stream from a SRT source
@@ -1292,9 +1393,9 @@ export declare interface NorskInput {
1292
1393
  * * Methods that allow you to egest media from your application
1293
1394
  */
1294
1395
  export declare interface NorskOutput {
1295
- hlsVideo(settings: HlsVideoOutputSettings): Promise<HlsVideoOutputNode>;
1296
- hlsAudio(settings: HlsAudioOutputSettings): Promise<HlsAudioOutputNode>;
1297
- hlsWebVtt(settings: HlsWebVttOutputSettings): Promise<HlsWebVttOutputNode>;
1396
+ cmafVideo(settings: CmafVideoOutputSettings): Promise<CmafVideoOutputNode>;
1397
+ cmafAudio(settings: CmafAudioOutputSettings): Promise<CmafAudioOutputNode>;
1398
+ cmafWebVtt(settings: CmafWebVttOutputSettings): Promise<CmafWebVttOutputNode>;
1298
1399
  hlsWebVttPush(settings: HlsWebVttPushOutputSettings): Promise<HlsWebVttPushOutputNode>;
1299
1400
  hlsTsVideo(settings: HlsTsVideoOutputSettings): Promise<HlsTsVideoOutputNode>;
1300
1401
  tsUdp(settings: TsUdpOutputSettings): Promise<TsUdpOutputNode>;
@@ -1303,10 +1404,15 @@ export declare interface NorskOutput {
1303
1404
  hlsTsVideoPush(settings: HlsTsVideoPushOutputSettings): Promise<HlsTsVideoPushOutputNode>;
1304
1405
  hlsTsAudioPush(settings: HlsTsAudioPushOutputSettings): Promise<HlsTsAudioPushOutputNode>;
1305
1406
  hlsTsCombinedPush(settings: HlsTsCombinedPushOutputSettings): Promise<HlsTsCombinedPushOutputNode>;
1306
- hlsMaster(settings: HlsMasterOutputSettings): Promise<HlsMasterOutputNode>;
1407
+ cmafMaster(settings: CmafMasterOutputSettings): Promise<CmafMasterOutputNode>;
1307
1408
  hlsMasterPush(settings: HlsMasterPushOutputSettings): Promise<HlsMasterPushOutputNode>;
1308
1409
  webRTCWhip(settings: WebRTCWhipOutputSettings): Promise<WebRTCWhipOutputNode>;
1309
1410
  rtmp(settings: RtmpOutputSettings): Promise<RtmpOutputNode>;
1411
+ /**
1412
+ * Stream to a Transport Stream file.
1413
+ *
1414
+ * @param settings - Configuration for the Transport Stream output
1415
+ */
1310
1416
  localTsFile(settings: TsFileOutputSettings): Promise<TsFileOutputNode>;
1311
1417
  /**
1312
1418
  * Output MP4 files to disk, both fragmented and non-fragmented.
@@ -1315,13 +1421,15 @@ export declare interface NorskOutput {
1315
1421
  *
1316
1422
  * The optional non-fragmented filename will be written when calling
1317
1423
  * {@link Mp4FileOutputNode.close} and will be fully written by the time
1318
- * {@link NodeSettings.onEnd} is called. This sets up a temp file to
1424
+ * {@link NodeSettings.onClose} is called. This sets up a temp file to
1319
1425
  * store the frame data by appending the extension `.tmp`.
1320
1426
  *
1321
1427
  * A non-fragmented MP4 file can be written on request with
1322
1428
  * {@link Mp4FileOutputNode.writeFile}, which uses the frame data store if
1323
1429
  * {@link Mp4FileOutputSettings.nonfragmentedFileName} was given or reads
1324
1430
  * back the fragmented mp4 if there is no non-fragmented file.
1431
+ *
1432
+ * @param settings - Configuration for the MP4 output.
1325
1433
  */
1326
1434
  localMp4File(settings: Mp4FileOutputSettings): Promise<Mp4FileOutputNode>;
1327
1435
  }
@@ -1398,9 +1506,14 @@ export declare interface NorskTransform {
1398
1506
  chaosMonkey(settings: ChaosMonkeySettings): Promise<ChaosMonkeyNode>;
1399
1507
  /**
1400
1508
  * Compose multiple video streams together into a single output
1401
- * @param settings - Composition setting
1509
+ * @param settings - Composition settings
1402
1510
  */
1403
1511
  composeOverlay<Pins extends string>(settings: ComposeVideoSettings<Pins>): Promise<ComposeVideoNode<Pins>>;
1512
+ /**
1513
+ * Create a Media Node performing transcription into subtitles using the
1514
+ * Amazon Transcribe AWS service.
1515
+ * @param settings - Settings and credentials for AWS transcribe
1516
+ */
1404
1517
  awsTranscribe(settings: AwsTranscribeSettings): Promise<AwsTranscribeNode>;
1405
1518
  /**
1406
1519
  * Mix multiple audio streams together into a single output,
@@ -1418,12 +1531,63 @@ export declare interface NorskTransform {
1418
1531
  * @param settings - Settings for the gain node
1419
1532
  */
1420
1533
  audioGain(settings: AudioGainSettings): Promise<AudioGainNode>;
1534
+ /**
1535
+ * Aggregate many single-channel audio streams into a stream with the
1536
+ * specified channel layout. The streams must all have the same sample format
1537
+ * and sample rate. The order of the streams provided for the channels is
1538
+ * important.
1539
+ * @param settings - Settings for the builder, including the channel layout
1540
+ * and stream keys specifying the sources for each channel.
1541
+ */
1421
1542
  audioBuildMultichannel(settings: AudioBuildMultichannelSettings): Promise<AudioBuildMultichannelNode>;
1543
+ /**
1544
+ * Split a multichannel audio stream into its individual channels. The first
1545
+ * channel receives the specified stream key, and each subsequent channel
1546
+ * increments the stream id on the stream key.
1547
+ * @param settings - Settings for the splitter
1548
+ */
1422
1549
  audioSplitMultichannel(settings: AudioSplitMultichannelSettings): Promise<AudioSplitMultichannelNode>;
1550
+ /**
1551
+ * Encode an audio stream.
1552
+ * @param settings - Settings for the encoder, including channel layout and
1553
+ * bitrate.
1554
+ */
1423
1555
  audioEncoder(settings: AudioEncoderSettings): Promise<AudioEncoderNode>;
1556
+ /**
1557
+ * A node to nudge the timestamps on a stream, which affects how it syncs
1558
+ * with other streams. Useful for correcting for drift between different
1559
+ * sources.
1560
+ *
1561
+ * Subsequent nudges, via the `nudge` method, are applied gradually.
1562
+ *
1563
+ * This functionality is also provided by a `nudge` method on many sources.
1564
+ * @param settings - Initial nudge plus general node settings.
1565
+ */
1424
1566
  timestampNudge(settings: TimestampNudgerSettings): Promise<TimestampNudgerNode>;
1567
+ /**
1568
+ * Provide a new stream key for a single stream. Cannot be subscribed to
1569
+ * multiple streams at once.
1570
+ *
1571
+ * The stream key is used for identifying streams within multiplexed sources
1572
+ * and also is translated into URIs for HLS playlists and other resources.
1573
+ * @param settings - New stream key plus general node settings.
1574
+ */
1425
1575
  streamKeyOverride(settings: StreamKeyOverrideSettings): Promise<StreamKeyOverrideNode>;
1576
+ /**
1577
+ * Override bitrate and language metadata on streams.
1578
+ *
1579
+ * Audio and video bitrate metadata is required for playlists for both
1580
+ * {@link NorskOutput.cmafMaster} and {@link NorskOutput.hlsMasterPush}
1581
+ * nodes. It is automatically configured for some sources (like RTMP) and in
1582
+ * cases where re-encoding is done, but is unset for other sources (like SRT).
1583
+ * @param settings - Bitrate and language metadata plus general node settings.
1584
+ */
1426
1585
  metadataOverride(settings: MetadataOverrideSettings): Promise<MetadataOverrideNode>;
1586
+ /**
1587
+ * Sync multiple streams together by timestamps, queuing frames from streams
1588
+ * that are behind the others. This is already included in most nodes,
1589
+ * especially outputs.
1590
+ */
1427
1591
  sync(settings: SyncSettings): Promise<SyncNode>;
1428
1592
  }
1429
1593
 
@@ -1524,9 +1688,22 @@ export declare interface OpusSettings {
1524
1688
  kind: "opus";
1525
1689
  }
1526
1690
 
1527
- /** @public */
1691
+ /** @public
1692
+ * A transition for a video composition part.
1693
+ *
1694
+ * A transition interpolates the source_rect, dest_rect, and opacity properties
1695
+ * over the specified duration according to the specified easing function.
1696
+ *
1697
+ * As a special case, if a transition is specified and the input pin of the part
1698
+ * changes, an opacity fade from one to the other will occur.
1699
+ */
1528
1700
  export declare interface PartTransition {
1701
+ /** Duration for the transition */
1529
1702
  durationMs: number;
1703
+ /**
1704
+ * Easing function to apply to the transition. If not specified will be
1705
+ * linear.
1706
+ */
1530
1707
  easing?: SimpleEasing;
1531
1708
  }
1532
1709
 
@@ -1588,7 +1765,7 @@ export declare class RtmpOutputNode extends AutoSinkMediaNode<"audio" | "video">
1588
1765
  }
1589
1766
 
1590
1767
  /** @public */
1591
- export declare interface RtmpOutputSettings extends NodeSettings<RtmpOutputNode>, StreamStatsMixin {
1768
+ export declare interface RtmpOutputSettings extends SinkNodeSettings<RtmpOutputNode>, StreamStatsMixin {
1592
1769
  url: string;
1593
1770
  numberOfStreams?: number;
1594
1771
  }
@@ -1608,7 +1785,7 @@ export declare class RtmpServerInputNode extends SourceMediaNode {
1608
1785
  */
1609
1786
  export declare interface RtmpServerInputSettings extends SourceNodeSettings<RtmpServerInputNode>, StreamStatsMixin {
1610
1787
  /** The port the RTMP server should listen on */
1611
- port: number;
1788
+ port?: number;
1612
1789
  /**
1613
1790
  * On connect callback, use to accept/reject connections given app/url in use
1614
1791
  * @eventProperty
@@ -1720,7 +1897,15 @@ export declare interface SampleAspectRatio {
1720
1897
  }
1721
1898
 
1722
1899
  /** @public */
1723
- export declare type SampleFormat = "flt" | "fltp" | "s16" | "s16p";
1900
+ export declare type SampleFormat =
1901
+ /** Signed 16 bits, non-planar */
1902
+ "s16"
1903
+ /** Signed 16 bits, planar */
1904
+ | "s16p"
1905
+ /** 32bit floating point, non-planar */
1906
+ | "flt"
1907
+ /** 32bit floating point, planar */
1908
+ | "fltp";
1724
1909
 
1725
1910
  /** @public Audio sample rate, in Hz */
1726
1911
  export declare type SampleRate = 8000 | 11025 | 12000 | 16000 | 22050 | 24000 | 32000 | 44100 | 48000 | 64000 | 88200 | 96000;
@@ -1762,13 +1947,28 @@ export declare interface SingleStreamStats extends StreamStats {
1762
1947
 
1763
1948
  /** @public */
1764
1949
  export declare class SinkMediaNode<Pins extends string> extends MediaNodeState {
1765
- /** Subscribe to the given sources,
1950
+ /** Subscribe to the given sources.
1951
+ *
1766
1952
  * This version of the function call accepts the target pins of an output
1767
1953
  * and is suitable for advanced use where a node is capable of subscribing to
1768
1954
  * multiple video streams and provides a means of distinguishing them via pins
1769
- * discarding any existing subscriptions */
1770
- subscribeToPins(sources: ReceiveFromAddress<Pins>[], validation?: (context: Context) => boolean): void;
1771
- sourceContextChange(responseCallback: () => void): Promise<void>;
1955
+ * discarding any existing subscriptions.
1956
+ *
1957
+ * @param done - will be called with no arguments if the subscription succeeds,
1958
+ * or an error if it failed. This error indicates the specific reason it
1959
+ * failed, so you can take appropriate actions in response. It will be called
1960
+ * before the `subscribedStreamsChangedFn` or `subscribeErrorFn` callbacks
1961
+ * provided in the config for the node.
1962
+ *
1963
+ * Errors are also logged to the debug log.
1964
+ */
1965
+ subscribeToPins(sources: ReceiveFromAddress<Pins>[], validation?: (context: Context) => boolean, done?: (error?: SubscriptionError) => void): void;
1966
+ sourceContextChange(responseCallback: (error?: SubscriptionError) => void): Promise<void>;
1967
+ }
1968
+
1969
+ /** @public */
1970
+ export declare interface SinkNodeSettings<T extends MediaNodeState> extends NodeSettings<T> {
1971
+ onSubscriptionError?: (error: SubscriptionError) => void;
1772
1972
  }
1773
1973
 
1774
1974
  /**
@@ -1801,6 +2001,44 @@ export declare interface SourceNodeSettings<T extends MediaNodeState> extends No
1801
2001
  onOutboundContextChange?: (streams: StreamMetadata[]) => Promise<void>;
1802
2002
  }
1803
2003
 
2004
+ /**
2005
+ * @public
2006
+ * Errors found while subscribing to a particular source, separated out by reason:
2007
+ *
2008
+ * - `internal`: An opaque internal error
2009
+ *
2010
+ * - `unknownSourceId`: The media node does not exist (maybe it crashed)
2011
+ *
2012
+ * - `unknownSourceStream`: The media node exists, but does not have the stream key
2013
+ *
2014
+ * - `noSubscriberPin`: The media node is not set up to receive data on this pin (which may be auto-detected)
2015
+ *
2016
+ * - `unsupportedConversion`: Norsk does not support conversion from the media types of the source to the media types accepted by the subscriber
2017
+ */
2018
+ export declare type SourceSubscriptionError = {
2019
+ info: string;
2020
+ reason: "internal";
2021
+ } | {
2022
+ mediaNodeId: MediaNodeId;
2023
+ reason: "unknownSourceId";
2024
+ } | {
2025
+ mediaNodeId: MediaNodeId;
2026
+ streamKey: StreamKey;
2027
+ reason: "unknownSourceStream";
2028
+ } | {
2029
+ mediaNodeId: MediaNodeId;
2030
+ streamKey: StreamKey;
2031
+ pin: string;
2032
+ subscriberPins: string[];
2033
+ reason: "noSubscriberPin";
2034
+ } | {
2035
+ mediaNodeId: MediaNodeId;
2036
+ streamKey: StreamKey;
2037
+ sourceTypes: string[];
2038
+ subscriberTypes: string[];
2039
+ reason: "unsupportedConversion";
2040
+ };
2041
+
1804
2042
  /**
1805
2043
  * @public
1806
2044
  */
@@ -1808,6 +2046,7 @@ export declare type SrtConnectionResult =
1808
2046
  /** Accept the stream */
1809
2047
  {
1810
2048
  accept: true;
2049
+ /** The source name to assign to the connection */
1811
2050
  sourceName: string;
1812
2051
  }
1813
2052
  /** Reject the stream */
@@ -1845,9 +2084,12 @@ export declare interface SrtInputSettings extends RemoteInputSettings<SrtInputNo
1845
2084
  onConnection?: (
1846
2085
  /** The stream_id sent on the SRT socket (or empty if none was set) */
1847
2086
  streamId: string,
1848
- /** The connection index */
2087
+ /**
2088
+ * Identifier indicating which connection this message refers to (for a
2089
+ * listener which may have multiple connections)
2090
+ */
1849
2091
  index: number,
1850
- /** Remote host address */
2092
+ /** The address of the remote host */
1851
2093
  remoteHost: string) => SrtConnectionResult;
1852
2094
  /**
1853
2095
  * Called when the connection status has changed (e.g. when the SRT socket is closed)
@@ -1875,7 +2117,7 @@ export declare class SrtOutputNode extends AutoSinkMediaNode<"audio" | "video">
1875
2117
  }
1876
2118
 
1877
2119
  /** @public */
1878
- export declare interface SrtOutputSettings extends NodeSettings<SrtOutputNode>, StreamStatsMixin {
2120
+ export declare interface SrtOutputSettings extends SinkNodeSettings<SrtOutputNode>, StreamStatsMixin {
1879
2121
  /**
1880
2122
  * Passphrase for encryption
1881
2123
  */
@@ -2013,6 +2255,33 @@ export declare interface StreamStatsSettings extends ProcessorNodeSettings<Strea
2013
2255
  statsSampling?: PlainMessage<StreamStatsSampling>;
2014
2256
  }
2015
2257
 
2258
+ /**
2259
+ * @public
2260
+ * Errors found while setting up subscriptions, separated out by reason:
2261
+ *
2262
+ * - `internal`: An opaque internal error
2263
+ *
2264
+ * - `unknownSubscriber`: The media node requesting the subscription does not exist
2265
+ *
2266
+ * - `multipleStreams`: Multiple stream keys found for the context type
2267
+ *
2268
+ * - `sourceSubscriptionError`: Per-source errors
2269
+ */
2270
+ export declare type SubscriptionError = {
2271
+ info: string;
2272
+ reason: "internal";
2273
+ } | {
2274
+ mediaNodeId: MediaNodeId;
2275
+ reason: "unknownSubscriber";
2276
+ } | {
2277
+ contextType: ContextType;
2278
+ streamKeys: StreamKey[];
2279
+ reason: "multipleStreams";
2280
+ } | {
2281
+ sourceErrors: SourceSubscriptionError[];
2282
+ reason: "sourceSubscriptionError";
2283
+ };
2284
+
2016
2285
  /** @public */
2017
2286
  export declare const subtitlesToPin: <Pins extends string>(pin: Pins) => (streams: StreamMetadata[]) => PinToKey<Pins>;
2018
2287
 
@@ -2084,7 +2353,7 @@ export declare class TsFileOutputNode extends AutoSinkMediaNode<"audio" | "video
2084
2353
  }
2085
2354
 
2086
2355
  /** @public */
2087
- export declare interface TsFileOutputSettings extends NodeSettings<TsFileOutputNode>, StreamStatsMixin {
2356
+ export declare interface TsFileOutputSettings extends SinkNodeSettings<TsFileOutputNode>, StreamStatsMixin {
2088
2357
  fileName: string;
2089
2358
  }
2090
2359
 
@@ -2104,7 +2373,7 @@ export declare class TsUdpOutputNode extends AutoSinkMediaNode<"audio" | "video"
2104
2373
  }
2105
2374
 
2106
2375
  /** @public */
2107
- export declare interface TsUdpOutputSettings extends NodeSettings<TsUdpOutputNode>, StreamStatsMixin {
2376
+ export declare interface TsUdpOutputSettings extends SinkNodeSettings<TsUdpOutputNode>, StreamStatsMixin {
2108
2377
  destinationIp: string;
2109
2378
  iface: string;
2110
2379
  port: number;
@@ -2208,7 +2477,7 @@ export declare class WebRTCWhipOutputNode extends AutoSinkMediaNode<"audio" | "v
2208
2477
  /**
2209
2478
  * @public
2210
2479
  */
2211
- export declare interface WebRTCWhipOutputSettings extends NodeSettings<WebRTCWhipOutputNode>, StreamStatsMixin {
2480
+ export declare interface WebRTCWhipOutputSettings extends SinkNodeSettings<WebRTCWhipOutputNode>, StreamStatsMixin {
2212
2481
  uri: string;
2213
2482
  authHeader: string;
2214
2483
  }