import * as grpc from "@grpc/grpc-js"; import { CmafAudioMessage, CmafMultiVariantMessage, CmafVideoMessage, CmafWebVttMessage, HlsOutputEvent, HlsTsAudioMessage, HlsTsCombinedPushMessage, HlsTsVideoMessage, Subscription, HlsTsMultiVariantMessage } from "@norskvideo/norsk-api/lib/media_pb"; import { AwsCredentials, EncryptionSettings, IceServerSettings, SrtMode, StreamMetadata, Scte35SpliceInfoSection, AudioSegmentationStrategy, VideoSegmentationStrategy, Resolution } from "./types"; import { AutoProcessorMediaNode, ProcessorNodeSettings } from "./processor"; import { AutoSinkMediaNode, MediaClient, MediaNodeState, MediaNodeStateEvents, SinkNodeSettings, StreamStatisticsMixin } from "./common"; /** * @public * Settings for a CMAF Audio and Video Outputs * see {@link NorskOutput.cmafAudio}, {@link NorskOutput.cmafVideo} */ export interface CmafOutputSettings extends SinkNodeSettings { /** * The target segment duration in seconds. Norsk will make the largest segments it can * without going over this target */ segmentDurationSeconds: number; /** * The target part duration in seconds. Norsk will make the largest parts it can * without going over this target */ partDurationSeconds: number; /** * Settings for encrypting the content. */ encryption?: EncryptionSettings; /** * A list of destinations {@link CmafDestinationSettings} for this stream to be published to */ destinations: CmafDestinationSettings[]; /** * Directives to add to the m3u media playlist */ m3uAdditions?: string; /** * XML fragment to add to the mpd Representation element */ mpdAdditions?: string; /** * Optional bitrate for the {@link NorskOutput.cmafMultiVariant} playlist. This field * is only used if the stream bitrate is unknown, which is typically only the case * in a passthrough scenario. The bitrate can be set through an explicit encode, * or set or overriden with a streamKeyOverride node */ bitrate?: number; /** * The name to use for the playlist in a multivariant playlist */ name?: string; /** * Whether to insert a program date-time directive on every segment. Not required to produce spec-compliant playlists, * but may be useful for inspection or playlist manipulation */ pdtEverySegment?: boolean; } /** * @public * Settings for a HLS TS Video Output * see {@link NorskOutput.hlsTsVideo} */ export interface HlsTsVideoOutputSettings extends SinkNodeSettings { /** * The target segment duration in seconds. Norsk will use the framerate of the stream in order * to produce compliant segments that are less than or equal to this in duration */ segmentDurationSeconds: number; /** * Optional stategy to be used in creating segments of the correct length * care should be taken to not supply values that result in segments of an invalid length */ segmentationStrategy?: VideoSegmentationStrategy; /** * A list of destinations {@link CmafDestinationSettings} for this stream to be published to */ destinations: CmafDestinationSettings[]; /** * Directives to add to the m3u media playlist */ m3uAdditions?: string; /** * XML fragment to add to the mpd Representation element */ mpdAdditions?: string; /** * Video bitrate for the {@link NorskOutput.hlsTsMultiVariant} playlist */ bitrate?: number; /** * The name to use for the playlist in a multivariant playlist */ name?: string; /** * Whether to insert a program date-time directive on every segment. Not required to produce spec-compliant playlists, * but may be useful for inspection or playlist manipulation */ pdtEverySegment?: boolean; metrics?: "enabled" | "minimal" | "none"; } /** * @public * Settings for a HLS TS Audio Output * see {@link NorskOutput.hlsTsAudio} */ export interface HlsTsAudioOutputSettings extends SinkNodeSettings { /** * The target segment duration in seconds. Norsk will make the largest segments it can * without going over this target using the durations of the individual audio frames */ segmentDurationSeconds: number; /** * Optional stategy to be used in creating segments of the correct length * care should be taken to not supply values that result in segments of an invalid length */ segmentationStrategy?: AudioSegmentationStrategy; /** * A list of destinations {@link CmafDestinationSettings} for this stream to be published to */ destinations: CmafDestinationSettings[]; /** * Directives to add to the m3u media playlist */ m3uAdditions?: string; /** * XML fragment to add to the mpd Representation element */ mpdAdditions?: string; /** * Audio bitrate for the {@link NorskOutput.hlsTsMultiVariant} playlist */ bitrate?: number; /** * The name to use for the playlist in a multivariant playlist */ name?: string; /** * Whether to insert a program date-time directive on every segment. Not required to produce spec-compliant playlists, * but may be useful for inspection or playlist manipulation */ pdtEverySegment?: boolean; metrics?: "enabled" | "minimal" | "none"; } /** * @public * Settings for a CMAF WebVTT Output * see {@link NorskOutput.cmafWebVtt} */ export interface CmafWebVttOutputSettings extends SinkNodeSettings { /** * The target segment duration in seconds, Norsk will split subtitles over multiple segments * in a compliant manner if necessary */ segmentDurationSeconds: number; /** * A list of destinations {@link CmafDestinationSettings} for this stream to be published to */ destinations: CmafDestinationSettings[]; /** * The name to use for the playlist in a multivariant playlist */ name?: string; /** * Whether to insert a program date-time directive on every segment. Not required to produce spec-compliant playlists, * but may be useful for inspection or playlist manipulation */ pdtEverySegment?: boolean; /** * Maximum elapsed duration since last playlist push before initiating a new playlist push with the existing playlist data. * This can be used to ensure a remote system views the playlist as "alive" though no data may be flowing due to intermittent media. * The actual gap may be longer if a segment push occurs when a playlist would be pushed. * Default: No playlists re-pushed ever. */ maximumPlaylistPushIntervalMs?: number; } /** * @public * An update request for credentials on a CMAF output */ export interface UpdateCredentials { /** * The id of the destination that is to be updated (see {@link HlsPushDestinationSettings.id}) */ destinationId: string; /** * the new credentials to be used by the destination */ awsCredentials: AwsCredentials; } /** * @public * Settings for a HLS Transport Stream Combined Push Output * see {@link NorskOutput.hlsTsCombinedPush} */ export interface HlsTsCombinedPushOutputSettings extends SinkNodeSettings { /** * The target segment duration in seconds. By default, Norsk will use the framerate of the video stream in order * to produce compliant segments that are less than or equal to this in duration, with audio packaged alongside * using timestamps to line them up */ segmentDurationSeconds: number; /** * Optional stategy to be used instead of the default in creating segments of the correct length * care should be taken to not supply values that result in segments of an invalid length */ segmentationStrategy?: VideoSegmentationStrategy; /** * The destination {@link CmafDestinationSettings} for this stream to be published to */ destination: CmafDestinationSettings; /** * The name of this media playlist (.m3u8 will be added onto this field to generate a filename) */ playlistName: string; /** * Directives to add to the m3u media playlists */ m3uAdditions?: string; /** * The name to use for the playlist in a multivariant playlist */ name?: string; /** * Whether to insert a program date-time directive on every segment. Not required to produce spec-compliant playlists, * but may be useful for inspection or playlist manipulation */ pdtEverySegment?: boolean; } /** * @public * Settings for a CMAF Multi Variant Playlist * see {@link NorskOutput.cmafMultiVariant} */ export interface CmafMultiVariantOutputSettings extends SinkNodeSettings { /** * The name of this multi variant playlist (.m3u8 will be added onto this field to generate a filename) */ playlistName: string; /** * A list of destinations {@link CmafDestinationSettings} for this stream to be published to */ destinations: CmafDestinationSettings[]; /** * Directives to add to the m3u multi variant playlist */ m3uAdditions?: string; /** * XML fragment to add to the (top-level) MPD element */ mpdAdditions?: string; /** * A callback invoked every time a CMAF multi variant playlist is changed */ onPlaylistChange?: (destinationId: DestinationId, playlist: CmafMultiVariantPlaylistData) => CmafMultiVariantPlaylistData; } /** * @public * Settings for a Hls Ts Multivariant Playlist * see {@link NorskOutput.hlsTsMultiVariant} */ export interface HlsTsMultiVariantOutputSettings extends SinkNodeSettings { /** * The name of this multi variant playlist (.m3u8 will be added onto this field to generate a filename) */ playlistName: string; /** * A list of destinations {@link CmafDestinationSettings} for this stream to be published to */ destinations: CmafDestinationSettings[]; /** * Directives to add to the m3u multi variant playlist */ m3uAdditions?: string; /** * A callback invoked every time a TS multi variant playlist is changed */ onPlaylistChange?: (destinationId: DestinationId, playlist: string) => string; } /** * @public * Configuration for pushing a segmented media stream directly to a generic http server * */ export interface HlsPushDestinationSettings { type: "generic"; /** The hostname of the web server being pushed to. * This will be used to re-resolve the IP address on failures * */ host: string; /** the port of the web server being pushed to. */ port: number; /** the path under which segments and playlists will be pushed to */ pathPrefix: string; /** * Optionally supply a string that will be inserted into the path structure for segments published in this stream * * This is useful for stream restarts or republishing when duplicate segment IDs would be generated causing problems with * cacheing directives */ sessionId?: string; /** * A unique identifier for this destination * * This can be used for supplying updates to configuration to this destination specifically * see: {@link UpdateCredentials} */ id: DestinationId; /** * Informs the playlist generation how long segments will be retained for on the remote server * in order to generate an accurate playlist */ retentionPeriodSeconds: number; /** * In the absence of a HLS_SKIP query parameter, how many segments should be served in a playlist * this effectively controls how far back in time a player can seek from first load (as long as the data exists) */ defaultSegmentCount?: number; /** Server control directive, informs the client how far back in the stream (in seconds) it should attempt to play this should take into account the end to end latency from source capture, to the segment and playlist being published */ holdBackSeconds?: number; /** Server control directive, informs the client how far back in the stream (in seconds) it should attempt to play when using the lower latency parts this should take into account the end to end latency from source capture, to the part and playlist being published */ partHoldBackSeconds?: number; /** Whether the server supports gzip *request* compression for PUT/POST requests */ supportsGzip?: boolean; /** Whether to use TLS or plain TCP transport, by default TLS used if port is 443 */ tlsTransport?: boolean; } /** * @public * Configuration for pushing a segmented media stream directly to AWS S3 * */ export interface AwsS3PushDestinationSettings { type: "s3"; /** The hostname of the s3 server being pushed to. */ host: string; /** the port of the s3 server being pushed to. */ port: number; /** the path under which segments and playlists will be pushed to */ pathPrefix: string; /** * Optionally supply a string that will be inserted into the path structure for segments published in this stream * * This is useful for stream restarts or republishing when duplicate segment IDs would be generated causing problems with * cacheing directives */ sessionId?: string; /** * A unique identifier for this destination * * This can be used for supplying updates to configuration to this destination specifically * see: {@link UpdateCredentials} */ id: DestinationId; /** * The AWS region being pushed to */ awsRegion: string; /** * AWS credentials to be used for connecting to S3 * Standard environment variables will be read if these are not provided */ awsCredentials?: AwsCredentials; /** * Informs the playlist generation how long segments will be retained for on the remote server * in order to generate an accurate playlist */ retentionPeriodSeconds: number; /** * In the absence of a HLS_SKIP query parameter, how many segments should be served in a playlist * this effectively controls how far back in time a player can seek from first load (as long as the data exists) */ defaultSegmentCount?: number; /** Server control directive, informs the client how far back in the stream (in seconds) it should attempt to play this should take into account the end to end latency from source capture, to the segment and playlist being published */ holdBackSeconds?: number; /** Server control directive, informs the client how far back in the stream (in seconds) it should attempt to play when using the lower latency parts this should take into account the end to end latency from source capture, to the part and playlist being published */ partHoldBackSeconds?: number; } /** * @public * Configuration for the serving of segments and playlists directly from the Norsk Web Server * Note: While this is both useful for local testing and for sitting behind a reverse caching proxy / CDN * it is not expected that Norsk serve as the edge server in most scenarios * */ export interface LocalPullDestinationSettings { type: "local"; /** * A unique identifier for this destination */ id: DestinationId; /** * Optionally supply a string that will be inserted into the path structure for segments published in this stream * * This is useful for stream restarts or republishing when duplicate segment IDs would be generated causing problems with * cacheing directives */ sessionId?: string; /** * Informs the playlist generation how long segments will be retained for * and informs the local web server how long to retain those segments */ retentionPeriodSeconds: number; /** * In the absence of a HLS_SKIP query parameter, how many segments should be served in a playlist * this effectively controls how far back in time a player can seek from first load (as long as the data exists) */ defaultSegmentCount?: number; /** Server control directive, informs the client how far back in the stream (in seconds) it should attempt to play this should take into account the end to end latency from source capture, to the segment and playlist being published */ holdBackSeconds?: number; /** Server control directive, informs the client how far back in the stream (in seconds) it should attempt to play when using the lower latency parts this should take into account the end to end latency from source capture, to the part and playlist being published */ partHoldBackSeconds?: number; } /** @public */ export type MediaPlaylistPart = MediaSegment | AdMarker | HlsTag | ProgramDateTime | ScheduledTag; /** @public */ export type HlsPlaylist = { hlsFilePartPlaylist: MediaPlaylistPart[]; hlsByteRangePlaylist: MediaPlaylistPart[]; hlsStandardPlaylist: MediaPlaylistPart[]; programDateTime?: Date; }; /** @public */ export type HlsPlaylistAdditions = HlsPlaylist; /** @public */ export type TsPlaylist = MediaPlaylistPart[]; /** @public */ export type TsPlaylistAdditions = [MediaPlaylistPart[], Date]; /** @public */ export interface CmafMultiVariantPlaylistData { hls: string; dash: string; } /** @public */ export interface MediaSegment { uri: string; duration: number; title: string; number?: number; } /** @public */ export interface AdMarker { id: string; startDate: Date; durationSeconds: number; scte35: Scte35SpliceInfoSection; } /** @public */ export interface HlsTag { tag: string; } /** @public */ export interface ProgramDateTime { programDateTime: Date; } /** @public */ export declare function isMediaSegment(seg: MediaPlaylistPart): seg is MediaSegment; /** @public */ export declare function isAdMarker(seg: MediaPlaylistPart): seg is AdMarker; /** @public */ export declare function isHlsTag(seg: MediaPlaylistPart): seg is HlsTag; /** @public */ export declare function isProgramDateTime(seg: MediaPlaylistPart): seg is ProgramDateTime; /** @public */ export declare function isScheduledTag(seg: MediaPlaylistPart): seg is ScheduledTag; /** @public */ export type PlaylistOnChangeFn = { cmafMediaPlaylist?: (grpcStream: grpc.ClientDuplexStream, destinationId: DestinationId, additions: HlsPlaylistAdditions, playlistWithAdditions: HlsPlaylist) => void; tsMediaPlaylist?: (grpcStream: grpc.ClientDuplexStream, destinationId: DestinationId, additions: TsPlaylistAdditions, playlistWithAdditions: MediaPlaylistPart[]) => void; cmafMultiVariantPlaylist?: (grpcStream: grpc.ClientDuplexStream, destinationId: DestinationId, playlist: CmafMultiVariantPlaylistData) => void; hlsTsMultiVariantPlaylist?: (grpcStream: grpc.ClientDuplexStream, destinationId: DestinationId, playlist: string) => void; }; /** * @public * Possible destinations for a segmented media stream * - {@link HlsPushDestinationSettings}: Push to a generic HTTP server * - {@link AwsS3PushDestinationSettings}: Push to Amazon S3 * - {@link LocalPullDestinationSettings}: Serve directly from the Norsk Web Server * */ export type CmafDestinationSettings = HlsPushDestinationSettings | AwsS3PushDestinationSettings | LocalPullDestinationSettings; type HlsPlaylistDestination = { [destination: DestinationId]: HlsPlaylist; }; type HlsTsPlaylistDestination = { [destination: DestinationId]: MediaPlaylistPart[]; }; declare class CmafNodeBase extends AutoProcessorMediaNode { playlists: HlsPlaylistDestination; destinations: DestinationId[]; scheduledTags: ScheduledTag[]; constructor(client: MediaClient, unregisterNode: (node: MediaNodeState) => void, settings: ProcessorNodeSettings & StreamStatisticsMixin, grpcInit: () => grpc.ClientDuplexStream, subscribeFn: (subscription: Subscription) => Promise, onPlaylistAddition: PlaylistOnChangeFn, destinations: DestinationId[], subscribedStreamsChangedFn?: (streams: StreamMetadata[]) => void); scheduleTag(tag: MediaPlaylistPart, scheduleAt: Date, destinationId?: DestinationId): ScheduledTag; removeScheduledTag(tagId: number): void; } /** @public */ export type ScheduledTag = [number, MediaPlaylistPart, Date, DestinationId?]; /** @public */ export type DestinationId = string; declare class CmafNodeWithPlaylist extends CmafNodeBase { /** * @public * Returns the URL to the HLS playlist entry. Note this can only be evaluated once the stream is active as it * varies with the stream subscribed to. Useful during development, but you probably want to * use {@link NorskOutput.cmafMultiVariant} for production. */ url(): Promise; } /** * @public * see: {@link NorskOutput.cmafVideo} */ export declare class CmafVideoOutputNode extends CmafNodeWithPlaylist { /** @public*/ get onPlaylistAddition(): ((destinationId: DestinationId, pl: HlsPlaylistAdditions) => HlsPlaylist) | undefined; set onPlaylistAddition(c: ((destinationId: DestinationId, pl: HlsPlaylistAdditions) => HlsPlaylist) | undefined); /** * @public * Updates the credentials for a specific destination within this output by id * see: {@link UpdateCredentials} * see: {@link CmafDestinationSettings} */ updateCredentials(settings: UpdateCredentials): void; } /** * @public * see: {@link NorskOutput.cmafAudio} */ export declare class CmafAudioOutputNode extends CmafNodeWithPlaylist { /** @public*/ get onPlaylistAddition(): ((destinationId: DestinationId, pl: HlsPlaylistAdditions) => HlsPlaylist) | undefined; set onPlaylistAddition(c: ((destinationId: DestinationId, pl: HlsPlaylistAdditions) => HlsPlaylist) | undefined); /** * @public * Updates the credentials for a specific destination within this output by id * see: {@link UpdateCredentials} * see: {@link CmafDestinationSettings} */ updateCredentials(settings: UpdateCredentials): void; } /** * @public * see: {@link NorskOutput.hlsTsVideo} */ export declare class HlsTsVideoOutputNode extends CmafNodeWithPlaylist { /** @public */ onPlaylistAddition?: (destinationId: DestinationId, pl: TsPlaylistAdditions) => TsPlaylist; get playlist(): HlsTsPlaylistDestination; /** * @public * Updates the credentials for a specific destination within this output by id * see: {@link UpdateCredentials} * see: {@link CmafDestinationSettings} */ updateCredentials(settings: UpdateCredentials): void; } /** * @public * see: {@link NorskOutput.hlsTsAudio} */ export declare class HlsTsAudioOutputNode extends CmafNodeWithPlaylist { /** @public */ onPlaylistAddition?: (destinationId: DestinationId, pl: TsPlaylistAdditions) => TsPlaylist; get playlist(): HlsTsPlaylistDestination; /** * @public * Updates the credentials for a specific destination within this output by id * see: {@link UpdateCredentials} * see: {@link CmafDestinationSettings} */ updateCredentials(settings: UpdateCredentials): void; } /** * @public * see: {@link NorskOutput.hlsTsCombinedPush} */ export declare class HlsTsCombinedPushOutputNode extends CmafNodeWithPlaylist { } /** * @public * see: {@link NorskOutput.cmafWebVtt} */ export declare class CmafWebVttOutputNode extends CmafNodeWithPlaylist { /** @public */ onPlaylistAddition?: (destinationId: DestinationId, pl: HlsPlaylistAdditions) => HlsPlaylist; /** * @public * Updates the credentials for a specific destination within this output by id * see: {@link UpdateCredentials} * see: {@link CmafDestinationSettings} */ updateCredentials(settings: UpdateCredentials): void; } /** * @public * see: {@link NorskOutput.cmafMultiVariant} */ export declare class CmafMultiVariantOutputNode extends CmafNodeBase { /** @public The URL of the file based multi variant playlist */ url: string; /** @public The URL of the file based DASH manifest */ dashUrl: string; /** * @public * Updates the credentials for a specific destination within this output by id * see: {@link UpdateCredentials} * see: {@link CmafDestinationSettings} */ updateCredentials(settings: UpdateCredentials): void; } /** * @public * see: {@link NorskOutput.hlsTsMultiVariant} */ export declare class HlsTsMultiVariantOutputNode extends CmafNodeBase { /** @public The URL of the file based multi variant playlist */ url: string; /** * @public * Updates the credentials for a specific destination within this output by id * see: {@link UpdateCredentials} * see: {@link CmafDestinationSettings} */ updateCredentials(settings: UpdateCredentials): void; } /** * @public * The settings for an output Transport Stream over UDP * see: {@link NorskOutput.udpTs} */ export interface UdpTsOutputSettings extends SinkNodeSettings, StreamStatisticsMixin { /** * The IP address or hostname to publish to * The Ip address can be multicast, unicast or broadcast */ destinationHost: string; /** * The interface to bind to for publishing * This can be 'any', 'loopback' or any named interface on the machine * Note: If running inside docker this may be different to expected */ interface: string; /** The port to send to */ port: number; /** Jitter buffer delay in milliseconds */ bufferDelayMs?: number; /** A/V delay in milliseconds - to allow inclusion of subtitles, metadata and other ancillary data. May be set to 0 if these are not present to reduce latency */ avDelayMs?: number; /** Whether to encapsulate in RTP via RFC 2250 (default: false) */ rtpEncapsulate?: boolean; } /** * @public * see: {@link NorskOutput.udpTs} */ export declare class UdpTsOutputNode extends AutoSinkMediaNode<"audio" | "video"> { } /** * @public * The settings for an SRT output * see: {@link NorskOutput.srt} * */ export interface SrtOutputSettings extends SinkNodeSettings, StreamStatisticsMixin { /** * Passphrase for encryption */ passphrase?: string; /** * Stream ID to set on the socket when acting in caller mode */ streamId?: string; /** * The latency value in the receiving direction of the socket (SRTO_RCVLATENCY) */ receiveLatency?: number; /** * The latency value provided by the sender side as a minimum value for the receiver (SRTO_PEERLATENCY) */ peerLatency?: number; /** * Input bandwidth (SRTO_INPUTBW) */ inputBandwidth?: number; /** * Overhead bandwidth (SRTO_OHEADBW) */ overheadBandwidth?: number; /** * Max bandwidth (SRTO_MAXBW) */ maxBandwidth?: number; /** * The mode to act in (see {@link SrtMode}) */ mode: SrtMode; /** * The IP address or hostname to listen on in listener mode, or to connect to in caller mode */ host: string; /** * The port to listen on in listener mode, or to connect to in caller mode * * In listener mode the port may be given as 0 to bind to an automatically assigned port, which can be retrieved in `onBind`. */ port: number; /** Jitter buffer delay in milliseconds */ bufferDelayMs?: number; /** A/V delay in milliseconds - to allow inclusion of subtitles, metadata and other ancillary data. May be set to 0 if these are not present to reduce latency */ avDelayMs?: number; /** * Called when a listener-mode SRT output binds to the interface */ onBind?: (info: { port: number; }) => void; /** * On connect callback, notifying that a new caller has connected (in listener mode) and providing the stream_id that was set on the socket * @eventProperty */ onConnection?: ( /** The stream_id sent on the SRT socket (or empty if none was set) */ streamId: string, /** The stream index (count of connections that have been made) */ streamIndex: number, /** The remote host address */ remoteHost: string) => void; } /** * @public * see: {@link NorskOutput.srt} */ export declare class SrtOutputNode extends AutoSinkMediaNode<"audio" | "video"> { } /** * @public * The settings for a WebRTC Whip Output * see {@link NorskOutput.whip} */ export interface WhipOutputSettings extends SinkNodeSettings, StreamStatisticsMixin { /** * The URI to make the initial publish request to (as per the WHIP protocol) */ uri: string; /** The auth header to supply (for example: 'Bearer: mybearertoken') */ authHeader: string; /** Jitter buffer delay in milliseconds */ bufferDelayMs?: number; } /** * @public * see: {@link NorskOutput.whip} */ export declare class WhipOutputNode extends AutoSinkMediaNode<"audio" | "video"> { } /** * @public * The settings for a WebRTC WHEP Output * see {@link NorskOutput.whep} */ export interface WhepOutputSettings extends SinkNodeSettings, StreamStatisticsMixin { /** List of ice servers to use as part of session negotiation */ iceServers?: IceServerSettings[]; /** Internal addresses for the ice servers (defaults to iceServers) */ reportedIceServers?: IceServerSettings[]; name: string; /** * List of IPs to advertise as your host address - useful e.g. when on a cloud server * so that the public rather than private IP is used. */ hostIps?: string[]; /** * Similar to hostIps, but a list of server reflexive candidates so that ICE negotiations can be * sped up */ serverReflexiveIps?: string[]; /** Jitter buffer delay in milliseconds */ bufferDelayMs?: number; /** Callback to signify the WHEP output is publishing media and ready for client connection */ onPublishStart?: () => void; } /** * @public * see: {@link NorskOutput.whep} */ export declare class WhepOutputNode extends AutoSinkMediaNode<"audio" | "video"> { /** @public The URL of the local player */ playerUrl: string; /** @public The URL of the WHEP endpoint */ endpointUrl: string; } /** * @public * The settings for a Image Preview Output * see {@link NorskOutput.imagePreview} */ export interface ImagePreviewOutputSettings extends SinkNodeSettings, StreamStatisticsMixin { frequency: number; keep: number; quality: number; resolution: Resolution; /** Invoked when a new image is created on the server this filename can be appended to baseUrl to get the full location */ onImagePublished?: (file: string) => void; } /** * @public * see: {@link NorskOutput.whep} */ export declare class ImagePreviewOutputNode extends AutoSinkMediaNode<"video", { "image-published": (file: string) => void; } & MediaNodeStateEvents> { /** @public The URL where published files can be found */ baseUrl: string; } /** @public */ export declare enum RtmpConnectionFailureReason { RtmpConnectionFailedRetry = "RtmpConnectionFailedRetry" } /** * @public * The settings for an RTMP output * see: {@link NorskOutput.rtmp} * */ export interface RtmpOutputSettings extends SinkNodeSettings, StreamStatisticsMixin { /** * The URL of the remote RTMP server to connect to, including the full stream path and credentials */ url: string; /** Jitter buffer delay in milliseconds */ bufferDelayMs?: number; /** A/V delay in milliseconds (to allow embedded captions to be added) */ avDelayMs?: number; /** RTMP Chunksize in bytes */ chunkSize?: number; /** Called when the RTMP output succesfully connects to a server and starts publishing data */ onPublishStart?: () => void; /** Called when the connection to the RTMP server fails */ onConnectionFailure?: (failureReason: RtmpConnectionFailureReason) => void; /** * Number of seconds to wait until a retry is attempted to the RTMP server. * Defaults to five seconds */ retryConnectionTimeout?: number; sslOptions?: { verifyPeerCert?: boolean; }; } /** * @public * see: {@link NorskOutput.rtmp} */ export declare class RtmpOutputNode extends AutoSinkMediaNode<"audio" | "video"> { } /** * @public * The settings for an output Transport Stream written to file * see: {@link NorskOutput.fileTs} */ export interface FileTsOutputSettings extends SinkNodeSettings, StreamStatisticsMixin { /** The file to write - this will be truncated if it already exist */ fileName: string; /** A/V delay in milliseconds - to allow inclusion of subtitles, metadata and other ancillary data. May be set to 0 if these are not present to reduce latency */ avDelayMs?: number; } /** * @public * see: {@link NorskOutput.fileTs} */ export declare class FileTsOutputNode extends AutoSinkMediaNode<"audio" | "video"> { } /** * @public * Settings to control MP4 file output * see {@link NorskOutput.fileMp4} */ export interface FileMp4OutputSettings extends SinkNodeSettings, StreamStatisticsMixin { /** * Required: stream fragmented MP4 to this file. */ fragmentedFileName: string; /** * Write non-fragmented MP4 to this file on close, creates a `.tmp` file to * store the frame data. */ nonfragmentedFileName?: string; /** * Settings for encrypting the audio track. */ audioEncryption?: EncryptionSettings; /** * Settings for encrypting the video track. */ videoEncryption?: EncryptionSettings; /** * Callback that will be invoked once data stops being received by the node (determined by an empty context) * at which point it will automatically shut down */ onStreamEof?: () => void; } /** * @public * see: {@link NorskOutput.fileMp4} */ export declare class FileMp4OutputNode extends AutoSinkMediaNode<"audio" | "video"> { /** * @public * Writes a non-fragmented MP4 file containing the data received so far to the * supplied filename */ writeFile(nonfragmentedFileName: string): void; } /** * @public * Settings to control WAV file output * see {@link NorskOutput.fileWav} */ export interface FileWavOutputSettings extends SinkNodeSettings { /** * Required: stream audio to this file. */ fileName: string; } /** * @public * see: {@link NorskOutput.fileWav} */ export declare class FileWavOutputNode extends AutoSinkMediaNode<"audio"> { } /** * @public * Settings to control MP4 file output * see {@link NorskOutput.fileMp4} */ export interface FileWebVttOutputSettings extends SinkNodeSettings { /** * Stream WebVTT cues to this file */ fileName: string; /** * Whether to output cues corresponding to partial rather than complete transcription utterances. Default: false (complete), * irrelevant for non-transcription sources. Partial transcriptions may be used for monitoring live output rather than post-event summary. */ partial?: boolean; } /** * @public * see: {@link NorskOutput.fileWebVtt} */ export declare class FileWebVttOutputNode extends AutoSinkMediaNode<"subtitle"> { } /** * @public * Settings to configure a Moq Egest * see {@link NorskOutput.moq} */ export interface MoqOutputSettings extends SinkNodeSettings, StreamStatisticsMixin { /** * The namespace to publish tracks within (for example: 'bbb') * */ namespace: string; /** * The URL of a remote MoQT server subscriber to connect to and publish tracks for * */ url: string; /** * Disable verification of remote server's TLS certificate * (for development use ONLY, not for production) * */ disableTlsVerify: boolean; } /** * @public * see: {@link NorskOutput.moq} */ export declare class MoqOutputNode extends AutoSinkMediaNode<"audio" | "video"> { } /** * @public * Settings to configure a Ndi Egest * see {@link NorskOutput.ndi} */ export interface NdiOutputSettings extends SinkNodeSettings, StreamStatisticsMixin { /** * The NDI name to announce * */ name: string; /** * The NDI groups to announce to * */ groups?: string; /** Jitter buffer delay in milliseconds */ bufferDelayMs?: number; } /** * @public * see: {@link NorskOutput.ndi} */ export declare class NdiOutputNode extends AutoSinkMediaNode<"audio" | "video"> { } /** * @public * Methods that allow you to egest media from your application */ export interface NorskOutput { /** * Produces video segments with the supplied settings for use in * HLS or DASH manifests. * * These can optionally be served the Norsk web server or be pushed * to other locations - see {@link CmafDestinationSettings} * * @param settings - Configuration for the CMAF Video Stream */ cmafVideo(settings: CmafOutputSettings): Promise; /** * Produces audio segments with the supplied settings for use in * HLS or DASH manifests. * * These can optionally be served via the Norsk web server or be pushed * to other locations - see {@link CmafDestinationSettings} * * @param settings - Configuration for the CMAF Audio Stream */ cmafAudio(settings: CmafOutputSettings): Promise; /** * Produces WebVTT segments with the supplied settings for use in * HLS or DASH manifests. These are served via the Norsk web server * * @param settings - Configuration for the CMAF WebVTT Stream */ cmafWebVtt(settings: CmafWebVttOutputSettings): Promise; /** * Produces a multi variant (used to be known as master) hls and/or dash manifest for a collection of media streams * * This can optionally be served via the Norsk web server or be pushed * to other locations - see {@link CmafDestinationSettings} * * @param settings - Configuration for the CMAF Multi Variant Manifest */ cmafMultiVariant(settings: CmafMultiVariantOutputSettings): Promise; /** * Produces Transport Stream video segments with the supplied settings for use in * HLS manifests and builds a playlist served locally from the Norsk Web Server * or from other locations - see {@link CmafDestinationSettings} * * @param settings - Configuration for the HLS TS Stream */ hlsTsVideo(settings: HlsTsVideoOutputSettings): Promise; /** * Produces Transport Stream audio segments with the supplied settings for use in * HLS manifests and builds a playlist served locally from the Norsk Web Server * or from other locations - see {@link CmafDestinationSettings} * * @param settings - Configuration for the HLS TS Stream */ hlsTsAudio(settings: HlsTsAudioOutputSettings): Promise; /** * Produces Transport Stream segments containing both video and audio with the supplied settings for use in * HLS manifests and pushes them to the configured location (see {@link CmafDestinationSettings}) * * @param settings - Configuration for the HLS TS Stream */ hlsTsCombinedPush(settings: HlsTsCombinedPushOutputSettings): Promise; /** * Produces a multi variant HLS TS manifest for a collection of media streams * * This can optionally be served via the Norsk web server or be pushed * to other locations - see {@link CmafDestinationSettings} * * @param settings - Configuration for the Hls Ts Multivariant Playlist */ hlsTsMultiVariant(settings: HlsTsMultiVariantOutputSettings): Promise; /** * Produces a Transport Stream optionally containing both video and audio * and sends it out over UDP * * @param settings - Configuration for the TS Stream */ udpTs(settings: UdpTsOutputSettings): Promise; /** * Produces a Transport Stream, and allows Norsk to either connect to an existing * SRT server or act as an SRT server itself * * @param settings - Configuration for the SRT Stream */ srt(settings: SrtOutputSettings): Promise; /** * Connects and sends media to a remote server via WebRTC using the WHIP standard. * * Here Norsk acts as the WHIP client sending to a remote Media Server; to * have Norsk act as the Media Server ingesting from some other WHIP client, see * {@link NorskInput.whip} * * @param settings - Configuration for the WebRTC Stream */ whip(settings: WhipOutputSettings): Promise; /** * Hosts media for clients connecting via WebRTC using the WHEP standard. * * To send media to a remote Media Server via WebRTC see {@link NorskOutput.whip}. * See also {@link NorskInput.whip}, {@link NorskDuplex.webRtcBrowser}. * * @param settings - Configuration for the WebRTC Stream */ whep(settings: WhepOutputSettings): Promise; /** * Outputs snapshots as images from a video stream to disk, and provides an endpoint for retrieving them * @param settings - Configuration for the Preview Stream */ imagePreview(settings: ImagePreviewOutputSettings): Promise; /** * Connects and sends media to a remote RTMP server * * @param settings - Configuration for the WebRTC Stream */ rtmp(settings: RtmpOutputSettings): Promise; /** * Stream to a Transport Stream file. * * @param settings - Configuration for the Transport Stream output */ fileTs(settings: FileTsOutputSettings): Promise; /** * Output MP4 files to disk, both fragmented and non-fragmented. * * The fragmented output is required. * * The optional non-fragmented filename will be written when calling * close and will be fully written by the time * {@link NodeSettings.onClose} is called. This sets up a temp file to * store the frame data by appending the extension `.tmp`. * * A non-fragmented MP4 file can be written on request with * {@link FileMp4OutputNode.writeFile}, which uses the frame data store if * {@link FileMp4OutputSettings.nonfragmentedFileName} was given or reads * back the fragmented mp4 if there is no non-fragmented file. * * @param settings - Configuration for the MP4 output. */ fileMp4(settings: FileMp4OutputSettings): Promise; /** * Output WAV files to disk. A WAV output cannot handle * context changes (for example, a change of sample rate), * so it is important that the upstream data is normalised. * The file being written to is finalised and closed when * the inbound context becomes empty. */ fileWav(settings: FileWavOutputSettings): Promise; /** * Output a WebVTT subtitle file to disk * @param settings - Configuration for the WebVTT output. */ fileWebVtt(settings: FileWebVttOutputSettings): Promise; /** * EXPERIMENTAL Connects and sends output to a remote Media over QUIC endpoint * * Here Norsk acts as a Media over QUIC Transport (MoQT) client publisher * and connects to a MoQT server subscriber (e.g. a relay) and publishes a * catalog and a video track into the configured namespace. * * Warning: experimental! Expect bugs and missing features. * * The MoQT specification is still a work in progress and this exeperimental * implementation serves to inform further specification changes * * Current target specification: \ * * The catalog track is named '.catalog' and describes the available * video track(s) within the namespace * * Video is currently configured to publish as fragmented MP4 (fMP4) * * @param settings - Configuration for the MoQ Output */ moq(settings: MoqOutputSettings): Promise; /** * Output to an NDI stream * @param settings - Configuration for the NDI output. */ ndi(settings: NdiOutputSettings): Promise; } export {}; //# sourceMappingURL=output.d.ts.map