Skip to content

CinematicPlayer beta ​

Class of @v12-engine/client

ts
export declare class CinematicPlayer

The director (client.cinematics): see the top of this file

Members ​

constructor ​

ts
constructor(host: CinematicHost);

Constructs a new instance of the CinematicPlayer class

cue ​

ts
cue(name: string, params?: Record<string, unknown>): boolean;

Cues the cinematic playing (see Cut.cue): the rules' cues (cueCinematic) come here. Whether one was playing to hear it

current ​

ts
current: Playing | null;

The one playing now

frame ​

ts
frame(dt: number): void;

Moves the cinematic playing on by a frame of the screen, unless something holds it (the pause menu)

fromRules ​

ts
fromRules(cue: RulesCinematic): Playing;

Plays a cinematic the rules played (the engine's cinematic event), and tells the rules how it ended once it has: the cinematic command, sent as the player (stage.send), which the rules hear as cinematicEnded. The client calls it for the event; the editor's preview and a test may too

onChange ​

ts
onChange(listener: (playing: Playing | null) => void): () => void;

Hears when a cinematic starts or ends, is paused, resumed, seeked or slowed: for a transport on the HUD

play ​

ts
play(what: Cinematic | CinematicDef | string, options?: PlayOptions): Playing;

Plays a cinematic: one of the view's by id (with how the view says it is played, and options over that), a def, or a script. One playing makes way for it (replaced). Gives what to pause, seek and stop it by, and when it ended: for one the view has not, one already over (stopped), and the log says so

preload ​

ts
preload(what: string | CinematicDef): Promise<void>;

Loads ahead what a cinematic of the view's, or a def, will need, so it plays without a wait

queue ​

ts
queue(what: Cinematic | CinematicDef | string, options?: PlayOptions & {
        interrupt?: Interrupt;
    }): Promise<Playing>;

Plays a cinematic as play does, or, while another plays, does with it what interrupt says: takes the other's place (replace, as play does), waits for it and those already waiting (queue), or is not played (ignore: over at once, ignored). Settles with the playing once it starts

queued ​

ts
get queued(): readonly (string | undefined)[];

What waits its turn: the ids of those that have one

stopAll ​

ts
stopAll(): void;

Stops the one playing and empties the queue: the game is over, or the scene is left