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
.viserextension, for example viapathlib.Path("file.viser").write_bytes(...).- Returns:
The recording as bytes.
- Return type:
- as_html(dark_mode: bool = False) str[source]
Get a standalone HTML string for the serialized scene.
Returns a self-contained HTML document that can be saved to a file or embedded in other contexts.