Web Viewer - v0.41.0
    Preparing search index...

    Class WebViewer

    Rerun Web Viewer

    const viewer = new WebViewer();
    await viewer.start();

    Data may be provided to the Viewer as:

    • An HTTP file URL, e.g. viewer.start("https://app.rerun.io/version/0.41.0/examples/dna.rrd")
    • A Rerun gRPC URL, e.g. viewer.start("rerun+http://127.0.0.1:9876/proxy")
    • A stream of log messages, via WebViewer.open_channel.

    Callbacks may be attached for various events using WebViewer.on:

    viewer.on("time_update", (time) => console.log(`current time: {time}`));
    

    For the full list of available events, see ViewerEvent.

    Methods that read or drive the Viewer, like WebViewer.get_state and WebViewer.set_time, return promises, because the Viewer handles each request on its next frame. Some requests take even longer, such as a screenshot, or opening a URL, which waits for the data to load. They are all async so that they work the same way.

    Index
    • get canvas(): HTMLCanvasElement | null

      The underlying canvas element.

      Returns HTMLCanvasElement | null

    • get ready(): boolean

      Returns true if the viewer is ready to connect to data sources.

      Returns boolean

    • Close recordings, and return the store ids of the ones that were closed.

      Closing by URL also stops loading from it. This only removes recordings from the viewer: unsaved blueprint edits are lost.

      await viewer.close("https://app.rerun.io/version/0.39.0/examples/dna.rrd");
      await viewer.close("all");

      Rejects with a ViewerControlError with the code NOT_FOUND if a recording is not open, or nothing is loaded from a URL. Then nothing is closed.

      This API is experimental, and may change between releases.

      Parameters

      Returns Promise<StoreId[]>

    • Get the active timeline.

      This always returns null if the recording can't be found.

      Parameters

      • recording_id: string

      Returns string | null

      Use the recording's current_time.timeline from WebViewer.get_state instead.

    • Read a blueprint.

      If target is omitted, reads the blueprint of what is on screen. A recording or table without a blueprint gets a default one.

      This API is experimental, and may change between releases.

      Parameters

      Returns Promise<Blueprint>

    • Get the current time.

      The interpretation of time depends on what kind of timeline it is:

      • For time timelines, this is the time in nanoseconds.
      • For sequence timelines, this is the sequence number.

      This always returns 0 if the recording or timeline can't be found. The time is a whole number.

      Parameters

      • recording_id: string
      • timeline: string

      Returns number

      Use the timeline's current_time from WebViewer.get_state instead.

    • The entities of a dataset's segments on a server, and the components logged on them.

      Nothing is opened or loaded.

      Rejects with a ViewerControlError with the code FAILED_PRECONDITION if no dataset_url is given and no dataset is on screen, and NOT_FOUND if the viewer does not know the dataset.

      This API is experimental, and may change between releases.

      Parameters

      Returns Promise<DatasetSchema>

    • Where the viewer is: a recording, a catalog entry, the settings, …

      Pass it to WebViewer.set_location to come back to it later. This is a Viewer URL, not the address of the web page. A recording is reported as about:recording?app_id=…&recording_id=….

      This API is experimental, and may change between releases.

      Returns Promise<string>

    • The viewer's recent log messages, INFO and above, oldest first.

      Pass the sequence of the last entry seen to only get what is new.

      This API is experimental, and may change between releases.

      Parameters

      • Optionalafter_sequence: bigint

      Returns Promise<ViewerLogEntry[]>

    • Get the play state.

      This always returns false if the recording can't be found.

      Parameters

      • recording_id: string

      Returns boolean

      Use the recording's play_state from WebViewer.get_state instead.

    • What the viewer currently shows.

      Covers the active recording, every open recording with its timelines, their time ranges and its time cursor, and every view of the current blueprint with the warnings and errors it reports.

      This API is experimental, and may change between releases.

      Returns Promise<ViewerState>

    • A table's columns in display order, hidden ones included.

      Takes a dataset or table url from the servers of WebViewer.get_state. If omitted, the table on screen.

      This API is experimental, and may change between releases.

      Parameters

      • Optionaltable_url: string

      Returns Promise<TableColumnSchema[]>

    • Get the time range for a timeline.

      This always returns null if the recording or timeline can't be found.

      Parameters

      • recording_id: string
      • timeline: string

      Returns { max: number; min: number } | null

      Use the timeline's time_range from WebViewer.get_state instead.

    • Draw a pulsing outline around a rectangle, to point the user at something.

      It pulses until the user clicks. Pass null to dismiss it.

      This API is experimental, and may change between releases.

      Parameters

      Returns Promise<void>

    • Unregister an event listener.

      The event emitter relies on referential equality to store callbacks. The callback passed in must be the exact same instance of the function passed in to on or once.

      See ViewerEvent for a full list of available events.

      Type Parameters

      • E extends
            | "fullscreen"
            | "play"
            | "pause"
            | "time_update"
            | "timeline_change"
            | "selection_change"
            | "recording_open"

      Parameters

      Returns void

    • Unregister an event listener.

      The event emitter relies on referential equality to store callbacks. The callback passed in must be the exact same instance of the function passed in to on or once.

      See ViewerEvent for a full list of available events.

      Type Parameters

      Parameters

      • event: E
      • callback: () => void

      Returns void

    • Register an event listener.

      Returns a function which removes the listener when called.

      See ViewerEvent for a full list of available events.

      Type Parameters

      • E extends
            | "fullscreen"
            | "play"
            | "pause"
            | "time_update"
            | "timeline_change"
            | "selection_change"
            | "recording_open"

      Parameters

      Returns () => void

    • Register an event listener.

      Returns a function which removes the listener when called.

      See ViewerEvent for a full list of available events.

      Type Parameters

      Parameters

      • event: E
      • callback: () => void

      Returns () => void

    • Register an event listener which runs only once.

      Returns a function which removes the listener when called.

      See ViewerEvent for a full list of available events.

      Type Parameters

      • E extends
            | "fullscreen"
            | "play"
            | "pause"
            | "time_update"
            | "timeline_change"
            | "selection_change"
            | "recording_open"

      Parameters

      Returns () => void

    • Register an event listener which runs only once.

      Returns a function which removes the listener when called.

      See ViewerEvent for a full list of available events.

      Type Parameters

      Parameters

      • event: E
      • callback: () => void

      Returns () => void

    • Open URLs: recording or blueprint files, rerun:// dataset URIs, server or catalog URLs, or links into a recording.

      A recording it opens becomes the active recording, unless navigate is false. A location the viewer already has open is not loaded again, only shown. Resolves once the initial load is done, or after about ten seconds, whichever comes first.

      const { store_ids } = await viewer.open("https://app.rerun.io/version/0.39.0/examples/dna.rrd");
      

      Rejects with a ViewerControlError with the code NOT_FOUND for an about:recording URL of a recording that is not loaded.

      This API is experimental, and may change between releases.

      Parameters

      Returns Promise<OpenResult>

    • Opens a new channel for sending log messages.

      The channel can be used to incrementally push rrd chunks into the viewer.

      Parameters

      • channel_name: string = "rerun-io/web-viewer"

        used to identify the channel.

      Returns LogChannel

    • Force a panel to a specific state.

      Parameters

      • panel: Panel

        which panel to configure

      • state: PanelState | null | undefined

        which state to force the panel into

      Returns void

    • Save the active blueprint as an .rbl byte stream.

      The snapshot is selected when this method is called. Concatenate all stream byte sequences to obtain one valid file. An individual sequence is not independently accepted by WebViewer.open_channel.

      Returns ReadableStream<Uint8Array<ArrayBufferLike>>

      If the viewer is stopped or has no active blueprint.

    • Save the active recording as an .rrd byte stream.

      The snapshot is selected when this method is called. Concatenate all stream byte sequences to obtain one valid file. An individual sequence is not independently accepted by WebViewer.open_channel.

      Returns ReadableStream<Uint8Array<ArrayBufferLike>>

      If the viewer is stopped or has no active recording.

    • Set the active timeline.

      This does nothing if the recording or timeline can't be found.

      Parameters

      • recording_id: string
      • timeline: string

      Returns void

      Use WebViewer.set_time with timeline instead.

    • Parameters

      • access_token: string
      • email: string

      Returns void

    • Set the current time.

      Equivalent to clicking on the timeline in the time panel at the specified time. The interpretation of time depends on what kind of timeline it is:

      • For time timelines, this is the time in nanoseconds.
      • For sequence timelines, this is the sequence number.

      This does nothing if the recording or timeline can't be found. A fractional time is rounded down.

      Parameters

      • recording_id: string
      • timeline: string
      • time: number

      Returns void

      Use WebViewer.set_time instead.

    • Show a location the viewer already has open.

      Takes a location from WebViewer.get_location, or the location of a recording from WebViewer.get_state. This only navigates, and never loads anything: use WebViewer.open for that.

      Rejects with a ViewerControlError with the code NOT_FOUND if the viewer does not have it open, and INVALID_ARGUMENT if it is not a location.

      This API is experimental, and may change between releases.

      Parameters

      • location: string

      Returns Promise<void>

    • Set the play state.

      This does nothing if the recording can't be found.

      Parameters

      • recording_id: string
      • value: boolean

      Returns void

      Use WebViewer.set_time with play_state instead.

    • Move the time cursor, switch the active timeline, or play, pause, or follow the latest data.

      await viewer.set_time({ timeline: "frame", sequence: 42, play_state: "playing" });
      

      Rejects with a ViewerControlError with the code INVALID_ARGUMENT if the recording or timeline doesn't exist, or if play_state is following and a time is set.

      This API is experimental, and may change between releases.

      Parameters

      Returns Promise<void>

    • Start the viewer.

      Parameters

      • rrd: string | string[] | null

        URLs to .rrd files or gRPC connections to our SDK.

      • parent: HTMLElement | null

        The element to attach the canvas onto.

      • options: WebViewerOptions | null

        Web Viewer configuration.

      Returns Promise<void>

    • Stop the viewer, freeing all associated memory.

      The same viewer instance may be started multiple times.

      Returns void

    • Take a screenshot of the viewer, or of one of its views, as a PNG.

      Rejects with a ViewerControlError with the code INVALID_ARGUMENT if view_id is not a UUID, NOT_FOUND if no such view is visible, and FAILED_PRECONDITION if the view is too small to capture.

      This API is experimental, and may change between releases.

      Parameters

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Toggle fullscreen mode.

      This does nothing if allow_fullscreen was not set to true when starting the viewer.

      Fullscreen mode works by updating the underlying <canvas> element's style:

      • position to fixed
      • width/height/top/left to cover the entire viewport

      When fullscreen mode is toggled off, the style is restored to its previous values.

      When fullscreen mode is toggled on, any other instance of the viewer on the page which is already in fullscreen mode is toggled off. This means that it doesn't have to be tracked manually.

      This functionality can also be directly accessed in the viewer:

      • The maximize/minimize top panel button
      • The Toggle fullscreen UI command (accessible via the command palette, CTRL+P)

      Returns void

    • Toggle panel overrides set via override_panel_state.

      Parameters

      • Optionalvalue: boolean | null

        set to a specific value. Toggles the previous value if not provided.

      Returns void