import { AutoSinkMediaNode, SinkNodeSettings, SourceMediaNode, StreamStatisticsMixin } from "./common"; import { InputSettings } from "./input"; import { MediaStoreStreamSelection, StreamKey, StreamMetadata, X264Codec, X265Codec } from "./types"; /** @public */ export type MediaStoreExpireByTime = { expire: "byTime"; durationS: number; }; /** @public */ export type MediaStoreExpireBySize = { expire: "bySize"; size: bigint; }; /** @public */ export type MediaStoreExpiry = MediaStoreExpireBySize | MediaStoreExpireByTime; /** * @public * An HTTP object store that replicated segment objects are PUT to. Each segment * (fragment) of a completed media-store file is uploaded as its own object * under `/...`, and the resulting URL is added to the TAMS get_urls. */ export type MediaStoreHttpRemoteStore = { type: "http"; baseUrl: string; headers?: { name: string; value: string; }[]; }; /** * @public * An S3 (or S3-compatible) bucket that replicated segment objects are uploaded * to via the AWS SDK. Credentials are optional — when omitted the SDK's default * provider chain (env / instance role) is used; supply them (and an `endpoint` * with `forcePathStyle`) for S3-compatible stores such as OCI Object Storage. */ export type MediaStoreS3RemoteStore = { type: "s3"; bucket: string; region: string; keyPrefix?: string; endpoint?: string; forcePathStyle?: boolean; accessKeyId?: string; secretAccessKey?: string; sessionToken?: string; presign?: boolean; presignExpirySeconds?: number; }; /** @public */ export type MediaStoreRemoteStore = MediaStoreHttpRemoteStore | MediaStoreS3RemoteStore; /** * @public * What happens to local files once replicated. `keepLocal` (default) is * additive: local files live out their normal expiry and the remote copy is an * extra durable copy + get_url. `expireWhenReplicated` lets local files be * removed once confirmed on the remote store. */ export type MediaStoreLocalRetention = "keepLocal" | "expireWhenReplicated"; /** * @public * Background replication of recorded segments to a remote object store. */ export type MediaStoreRemoteReplication = { /** The remote object store to replicate segments to. */ store: MediaStoreRemoteStore; expiry?: MediaStoreExpiry; localRetention?: MediaStoreLocalRetention; }; /** @public */ export type MediaStoreCutRequest = { fileFormat: "mp4"; id: string; cuts: MediaStoreCut[]; fileName: string; languageMapping?: Map; sequenceHeaderHandling?: "oneHeader" | "multipleHeaders"; partialEncodeSettings?: X264Codec | X265Codec; fastStart?: boolean; progressCb?: (progress: number) => void; }; /** @public */ export type MediaStoreStreamVersion = { versionNum: number; metadata: StreamMetadata; startDateTime: Date; durationMs: number; active: boolean; }; /** @public */ export type MediaStoreStream = { streamKey: StreamKey; versions: MediaStoreStreamVersion[]; streamNum: number; }; /** @public */ export type MediaStoreSession = { sessionNum: number; streams: MediaStoreStream[]; }; /** @public */ export declare class MediaStoreAssetCut { /** * Required: The streams you want to select from the asset */ streamSelection: MediaStoreStreamSelection[]; /** * Optional: The start point for the cut in milliseconds - defaults to zero */ startTimeMs?: number; /** * Optional: The duration of the cut in milliseconds - defaults to the entire asset */ durationMs?: number | "all"; /** * Optional: How many times to repeat the cut - defaults to 1 */ repeatCount?: number | "infinity"; /** * Required: In a video stream, if a start time or end time falls mid-gop, should the gop be trimmed to be frame accurate? */ trimPartialGops: boolean; } /** @public */ export declare class MediaStoreRecorderCut { /** * Required: The streams you want to select from the asset */ streamSelection: MediaStoreStreamSelection[]; /** * Required: The start point for the cut in UTC */ startDateTime: Date; /** * Required: The duration of the cut in milliseconds */ durationMs: number; /** * Required: In a video stream, if a start time or end time falls mid-gop, should the gop be trimmed to be frame accurate? */ trimPartialGops: boolean; /** * Optional: If it's ambiguous which session contains the start time (for example, due to a system clock change), then * specify the correct session */ sessionNum?: number; } type MediaStoreCut = { mediaStoreName: string; cut: { type: "asset"; cut: MediaStoreAssetCut; } | { type: "recorder"; cut: MediaStoreRecorderCut; }; }; /** * @public * Settings to configure a media store recorder * see {@link NorskMediaStore.recorder} */ export interface MediaStoreRecorderSettings extends SinkNodeSettings, StreamStatisticsMixin { /** * Required: Name of this media store instance. */ name: string; /** * Required: Path for the media store database. */ path: string; /** * Required: Duration of the media store chunk files */ chunkFileDurationSeconds: number; /** * Optional: Expiry settings - if not supplied, then data will *not* get expired so on long-running events you may exhaust available disk space */ expiry?: MediaStoreExpiry; /** * Optional: Replicate recorded segments to a remote object store as an * asynchronous background process. When set, each replicated segment's remote * URL is added to the TAMS get_urls. Does not block recording. */ remoteReplication?: MediaStoreRemoteReplication; /** * Optional: Called when the media store is fully initialised. Note that subscriptions * can take place when the onCreate event is fired, just like all other nodes */ onInitialised?: () => void; } /** * @public * see: {@link NorskMediaStore.recorder} */ export declare class MediaStoreRecorderNode extends AutoSinkMediaNode<"audio" | "video"> { metadata(): Promise; cutListEntry(settings: MediaStoreRecorderCut): MediaStoreCut; } /** * @public * Settings for Media Store playback * see: {@link NorskMediaStore.player} */ export interface MediaStorePlayerSettings extends InputSettings, StreamStatisticsMixin { /** * Required: The start times and durations of the playback */ cuts: MediaStoreCut[]; /** Callback to be notified when playback ends */ onEof?: () => void; } /** * @public * see: {@link NorskMediaStore.player} */ export declare class MediaStorePlayerNode extends SourceMediaNode { /** Pause playback. Frames already in flight may still be emitted */ pause(): void; /** Resume playback */ play(): void; } /** * @public * see: {@link NorskMediaStore.makeCut} */ export declare class MediaStoreActiveCut { /** * @public * Promise that resolves when the cut is complete */ complete(): Promise; cancel(): void; } /** @public */ export type MediaStoreAssetFileWithHash = { file: string; hash: string; importIfNeeded?: boolean; }; /** @public */ export type MediaStoreAssetFile = { file: string; importIfNeeded?: boolean; }; /** @public */ export type MediaStoreAssetSource = MediaStoreAssetFileWithHash | MediaStoreAssetFile; /** @public */ export type MediaStoreAssetSettings = { name: string; source?: MediaStoreAssetSource; path: string; progressCb?: (progress: number) => void; }; /** * @public * see: {@link NorskMediaStore.asyncLoadAsset} */ export declare class MediaStoreAsset { /** @public */ durationMs?: bigint; /** @public */ size?: bigint; /** @public */ metadata?: MediaStoreSession[]; cutListEntry(settings: MediaStoreAssetCut): MediaStoreCut; close(): void; } /** * @public * Settings to configure a media store snapshot * see {@link NorskMediaStore.snapshot} */ export interface MediaStoreSnapshotSettings { /** * Required: Name of this media store instance. */ name: string; /** * Required: Path for the media store database. */ path: string; } /** * @public * see: {@link NorskMediaStore.snapshot} */ export declare class MediaStoreSnapshot { update(): Promise; metadata(): Promise; cutListEntry(settings: MediaStoreRecorderCut): MediaStoreCut; close(): void; } /** * @public * Methods to interact with the Media Store live-to-vod recording engine */ export interface NorskMediaStore { /** * Playback from an existing Media Store recording */ player(settings: MediaStorePlayerSettings): Promise; /** * Create a media store recording * * @param settings - Configuration for the media store recorder */ recorder(settings: MediaStoreRecorderSettings): Promise; /** * Create a media store cut * * @param request - Configuration for the cut */ makeCut(request: MediaStoreCutRequest): MediaStoreActiveCut; /** * Create a Media Store for an on-disk MP4 asset */ asyncLoadAsset(settings: MediaStoreAssetSettings): Promise; /** * Create a Media Store snapshot on an exist store */ snapshot(settings: MediaStoreSnapshotSettings): Promise; } export {}; //# sourceMappingURL=mediaStore.d.ts.map