UNPKG

casparcg-state

Version:

Node.js Javascript/Typescript library for keeping and resolving a given state of CasparCG into commands for casparcg-connection.

91 lines 3.17 kB
import { AMCPCommand, Command, Commands } from 'casparcg-connection'; import { StateObjectStorage, InternalLayer, InternalState } from './stateObjectStorage'; import { ChannelInfo, State } from './api'; export interface OptionsInterface { channel: number; layer: number; transition?: any; transitionDuration?: any; transitionEasing?: any; } export interface AMCPCommandWithContext extends Command<Commands, unknown> { context: { context: string; /** The id of the layer the command originates from */ layerId: string; }; } export interface DiffCommands { cmds: Array<AMCPCommandWithContext>; additionalLayerState?: InternalLayer; } export type DiffCommandGroups = Array<DiffCommands>; /** */ export declare class CasparCGState0 { bufferedCommands: Array<{ cmd: AMCPCommand; additionalLayerState?: InternalLayer; }>; minTimeSincePlay: number; protected _currentStateStorage: StateObjectStorage; private _isInitialised; /** */ constructor(config?: { getMediaDurationCallback?: (clip: string, callback: (duration: number) => void) => void; externalStorage?: (action: string, data?: Record<string, any> | null) => InternalState; }); get version(): string; /** * Initializes the state by using channel info * @param {any} channels [description] */ initStateFromChannelInfo(channels: Array<ChannelInfo>, currentTime: number): void; /** * Set the current statue to a provided state * @param {State} state The new state */ setState(state: InternalState): void; /** * Get the gurrent state * @param {true}} options [description] * @return {InternalState} The current state */ getState(): InternalState; /** * Resets / clears the current state */ clearState(): void; /** * A soft clear, ie clears any content, but keeps channel settings */ softClearState(): void; getDiff(newState: State, currentTime: number): DiffCommandGroups; /** * Temporary, intermediate function, to deal with ordering of commands. (This might be replaced with something more permanent later) * @param oldState * @param newState */ static diffStatesOrderedCommands(oldState: InternalState, newState: State, currentTime: number, minTimeSincePlay?: number): Array<AMCPCommandWithContext>; /** */ static diffStates(oldState: InternalState, newState: State, currentTime: number, minTimeSincePlay?: number): DiffCommandGroups; valueOf(): InternalState; toString(): string; /** */ get isInitialised(): boolean; /** */ setIsInitialised(initialised: boolean, _currentTime: number): void; } export declare class CasparCGState extends CasparCGState0 { /** * Set the current state to provided state * @param state The new state */ setState(state: InternalState): void; /** * Get the gurrent state * @param {true}} options [description] * @return {InternalState} The current state */ getState(): InternalState; } //# sourceMappingURL=casparCGState.d.ts.map