NarraLeaf

Video

This page is under construction.

Beta feature, subject to change.

Video is an element that allows you to play a video.

The video is full-size of the player.

const video = new Video({
    src: "https://example.com/video.mp4",
    muted: true,
});

scene.action([
    video
        .show()
        .play()
        .hide(),
]);

Public Methods

constructor

Chainable Methods

preload

Available since 0.33.0.

Put the video element on the stage without showing it, so it starts buffering. The action resolves immediately, and does nothing to a video already on the stage.

Use it a few lines before the video is shown or played, so the first frame is ready when it is.

video.preload();

show

Show the video.

video.show();

hide

Hide the video.

play

Play the video and wait for it to finish.

video.play();

pause

Pause the video, keeping its current position.

video.pause();

resume

Resume playback from the current position. Unlike play, this does not wait for the video to finish.

video.resume();

stop

Stop the video: pause it and end any pending play() so the story continues.

video.stop();

seek

  • time: number - The time, in seconds, to seek to.

Seek to a specific time.

video.seek(3);

On this page