Get started
Embedded Studio

Export a video

Export a video

VideoExportWizard turns an itinerary into a video flythrough: pick a format and a camera, add the elevation overlay, then record. It runs in the browser and loads a second map, so load it only when a member opens it.

Mount the wizard

Export as video in an itinerary's menu dispatches studio.video.open. Mount the wizard through MountayaStudio's modals, and it appears whenever an export is open.

import { MountayaStudio } from "@mountaya/studio-react";
import { useUiStore } from "@mountaya/studio-react/headless";
import { lazy, Suspense } from "react";

const VideoExportWizard = lazy(() =>
  import("@mountaya/studio-react/video").then((module) => ({
    default: module.VideoExportWizard,
  })),
);

const VideoExport = () => {
  const exporting = useUiStore((state) => state.videoExport?.itineraryId ?? null);
  if (exporting === null) {
    return null;
  }

  return (
    <Suspense fallback={null}>
      <VideoExportWizard itineraryId={exporting} key={exporting} mapClient={mountaya} />
    </Suspense>
  );
};

export const StudioWithVideo = () => <MountayaStudio modals={<VideoExport />} />;

The preview map draws through mapClient, the same client the studio runs on.

What the wizard walks through

  1. Format: aspect ratio, resolution and length.
  2. Camera: a camera style and its shots, or a conversation with the AI Director.
  3. Overlay: whether to draw the elevation profile, in which design, units and language.
  4. Review: a summary, then Record, with live progress.

The preview flies the exact plan the recorder will encode, so every change shows before you record.

Record without the wizard

@mountaya/elements/video is the recorder underneath. Give an editor map a video factory, and it records on demand.

import { EditorMapView } from "@mountaya/elements-react/editor";
import { VideoRunEngine } from "@mountaya/elements/video";

<EditorMapView
  client={client}
  onClientReady={holdMapClient}
  video={(map) => new VideoRunEngine(map.raw, map.events)}
/>;

Draw the elevation overlay

The overlay has three designs, graph, minimal and strip, in one registry the recorder draws from.

import { profileOverlayDesigns } from "@mountaya/elements/video";

const renderer = profileOverlayDesigns.graph;

The three designs above draw through that registry, and nothing is recorded.

Next steps

Last updated