State Serializer

class viser.infra.StateSerializer[source]

Handle for serializing messages. In Viser, this is used to save the scene state so it can be shared/embedded in static webpages.

insert_sleep(duration: float) None[source]

Insert a sleep into the recorded file. This can be useful for dynamic 3D data.

Parameters:

duration (float)

Return type:

None

serialize() bytes[source]

Serialize saved messages. Should only be called once. Our convention is to write this binary format to a file with a .viser extension, for example via pathlib.Path("file.viser").write_bytes(...).

Returns:

The recording as bytes.

Return type:

bytes