minerender 2.1.0-alpha.85 → 2.1.0-alpha.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2420,6 +2420,53 @@ declare class SceneExporter {
2420
2420
  static toGLTF(root: Object3D, options?: SceneGLTFExportOptions): Promise<Record<string, any> | ArrayBuffer>;
2421
2421
  }
2422
2422
 
2423
+ /** Settings passed to {@link Renderer.toVideo}. */
2424
+ interface VideoExportOptions {
2425
+ /** Recording duration in seconds, greater than zero and at most 2147483.647. */
2426
+ duration: number;
2427
+ /** Requested capture rate (default 30). Rendering and browser scheduling can lower the actual rate. */
2428
+ fps?: number;
2429
+ /** Supported video MIME type. Defaults to WebM when available, then MP4. */
2430
+ mimeType?: string;
2431
+ /** Target video bitrate in bits per second, as a positive unsigned 32-bit integer. */
2432
+ videoBitsPerSecond?: number;
2433
+ /** Cancels recording and discards its output. */
2434
+ signal?: AbortSignal;
2435
+ }
2436
+ /**
2437
+ * Records fresh canvas frames in a browser, at a fixed size with an opaque black background.
2438
+ * @internal
2439
+ */
2440
+ declare class VideoExporter {
2441
+ private readonly source;
2442
+ /** Resolves after the recorder provides its final video data. */
2443
+ readonly result: Promise<Blob>;
2444
+ private readonly canvas;
2445
+ private readonly context;
2446
+ private readonly signal?;
2447
+ private readonly duration;
2448
+ private stream?;
2449
+ private recorder?;
2450
+ private timer?;
2451
+ private readonly chunks;
2452
+ private settled;
2453
+ private stopping;
2454
+ private resolve;
2455
+ private reject;
2456
+ constructor(source: HTMLCanvasElement, options: VideoExportOptions);
2457
+ /** Copies a freshly drawn source frame before WebGL can clear its drawing buffer. */
2458
+ capture(): void;
2459
+ /** Cancels recording, releases its capture stream, and rejects {@link result}. */
2460
+ cancel(reason?: unknown): void;
2461
+ private readonly onStart;
2462
+ private readonly onData;
2463
+ private readonly onStop;
2464
+ private readonly onError;
2465
+ private readonly onAbort;
2466
+ private readonly onTrackEnded;
2467
+ private cleanup;
2468
+ }
2469
+
2423
2470
  /** Container coordinates in GUI pixels. Crops refer to vanilla's 256×256 sheets; {@link GuiHelper.container} scales them for resource packs. */
2424
2471
  declare const GUI_CONTAINER_LAYOUTS: {
2425
2472
  readonly generic_54: {
@@ -2630,6 +2677,7 @@ declare class Renderer implements Disposable {
2630
2677
  private _running;
2631
2678
  private _inAnimationLoop;
2632
2679
  private _disposed;
2680
+ private _videoExporter?;
2633
2681
  private readonly _frameCallbacks;
2634
2682
  private readonly _debugHelpers;
2635
2683
  private readonly _eventDispatchers;
@@ -2659,9 +2707,9 @@ declare class Renderer implements Disposable {
2659
2707
  * Registering the same callback twice has no effect. Image exports do not invoke callbacks.
2660
2708
  */
2661
2709
  onFrame(callback: FrameCallback): () => void;
2662
- /** Starts or resumes the animation loop and registered frame callbacks. */
2710
+ /** Starts or resumes the animation loop and registered frame callbacks. Has no effect while running. */
2663
2711
  start(): void;
2664
- /** Pauses rendering and frame callbacks. Call {@link start} to resume. */
2712
+ /** Pauses rendering and frame callbacks, and cancels video export. Call {@link start} to resume. */
2665
2713
  stop(): void;
2666
2714
  /**
2667
2715
  * Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
@@ -2677,6 +2725,14 @@ declare class Renderer implements Disposable {
2677
2725
  * MIME type support and lossy quality (0–1) follow the canvas encoder.
2678
2726
  */
2679
2727
  toImage(trim?: boolean, mime?: string, quality?: number): string;
2728
+ /**
2729
+ * Records a silent browser video in real time, including frame callbacks and animated textures.
2730
+ * Keep the tab visible; browser scheduling and `render.fpsLimit` limit the capture rate.
2731
+ * The video keeps the initial drawing-buffer size and fills transparent pixels with black.
2732
+ * Temporarily starts a stopped renderer. Stop, disposal, or `options.signal` cancels the export.
2733
+ * Only one export can run at a time. Use the returned Blob's type to select a file extension.
2734
+ */
2735
+ toVideo(options: VideoExportOptions): Promise<Blob>;
2680
2736
  /** Exports visible scene meshes as OBJ text, without texture images. */
2681
2737
  toObj(): string;
2682
2738
  /** Exports visible scene meshes as PLY. Set `options.binary` for an ArrayBuffer. */
@@ -3296,4 +3352,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
3296
3352
  */
3297
3353
  declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
3298
3354
 
3299
- export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
3355
+ export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
@@ -2420,6 +2420,53 @@ declare class SceneExporter {
2420
2420
  static toGLTF(root: Object3D, options?: SceneGLTFExportOptions): Promise<Record<string, any> | ArrayBuffer>;
2421
2421
  }
2422
2422
 
2423
+ /** Settings passed to {@link Renderer.toVideo}. */
2424
+ interface VideoExportOptions {
2425
+ /** Recording duration in seconds, greater than zero and at most 2147483.647. */
2426
+ duration: number;
2427
+ /** Requested capture rate (default 30). Rendering and browser scheduling can lower the actual rate. */
2428
+ fps?: number;
2429
+ /** Supported video MIME type. Defaults to WebM when available, then MP4. */
2430
+ mimeType?: string;
2431
+ /** Target video bitrate in bits per second, as a positive unsigned 32-bit integer. */
2432
+ videoBitsPerSecond?: number;
2433
+ /** Cancels recording and discards its output. */
2434
+ signal?: AbortSignal;
2435
+ }
2436
+ /**
2437
+ * Records fresh canvas frames in a browser, at a fixed size with an opaque black background.
2438
+ * @internal
2439
+ */
2440
+ declare class VideoExporter {
2441
+ private readonly source;
2442
+ /** Resolves after the recorder provides its final video data. */
2443
+ readonly result: Promise<Blob>;
2444
+ private readonly canvas;
2445
+ private readonly context;
2446
+ private readonly signal?;
2447
+ private readonly duration;
2448
+ private stream?;
2449
+ private recorder?;
2450
+ private timer?;
2451
+ private readonly chunks;
2452
+ private settled;
2453
+ private stopping;
2454
+ private resolve;
2455
+ private reject;
2456
+ constructor(source: HTMLCanvasElement, options: VideoExportOptions);
2457
+ /** Copies a freshly drawn source frame before WebGL can clear its drawing buffer. */
2458
+ capture(): void;
2459
+ /** Cancels recording, releases its capture stream, and rejects {@link result}. */
2460
+ cancel(reason?: unknown): void;
2461
+ private readonly onStart;
2462
+ private readonly onData;
2463
+ private readonly onStop;
2464
+ private readonly onError;
2465
+ private readonly onAbort;
2466
+ private readonly onTrackEnded;
2467
+ private cleanup;
2468
+ }
2469
+
2423
2470
  /** Container coordinates in GUI pixels. Crops refer to vanilla's 256×256 sheets; {@link GuiHelper.container} scales them for resource packs. */
2424
2471
  declare const GUI_CONTAINER_LAYOUTS: {
2425
2472
  readonly generic_54: {
@@ -2630,6 +2677,7 @@ declare class Renderer implements Disposable {
2630
2677
  private _running;
2631
2678
  private _inAnimationLoop;
2632
2679
  private _disposed;
2680
+ private _videoExporter?;
2633
2681
  private readonly _frameCallbacks;
2634
2682
  private readonly _debugHelpers;
2635
2683
  private readonly _eventDispatchers;
@@ -2659,9 +2707,9 @@ declare class Renderer implements Disposable {
2659
2707
  * Registering the same callback twice has no effect. Image exports do not invoke callbacks.
2660
2708
  */
2661
2709
  onFrame(callback: FrameCallback): () => void;
2662
- /** Starts or resumes the animation loop and registered frame callbacks. */
2710
+ /** Starts or resumes the animation loop and registered frame callbacks. Has no effect while running. */
2663
2711
  start(): void;
2664
- /** Pauses rendering and frame callbacks. Call {@link start} to resume. */
2712
+ /** Pauses rendering and frame callbacks, and cancels video export. Call {@link start} to resume. */
2665
2713
  stop(): void;
2666
2714
  /**
2667
2715
  * Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
@@ -2677,6 +2725,14 @@ declare class Renderer implements Disposable {
2677
2725
  * MIME type support and lossy quality (0–1) follow the canvas encoder.
2678
2726
  */
2679
2727
  toImage(trim?: boolean, mime?: string, quality?: number): string;
2728
+ /**
2729
+ * Records a silent browser video in real time, including frame callbacks and animated textures.
2730
+ * Keep the tab visible; browser scheduling and `render.fpsLimit` limit the capture rate.
2731
+ * The video keeps the initial drawing-buffer size and fills transparent pixels with black.
2732
+ * Temporarily starts a stopped renderer. Stop, disposal, or `options.signal` cancels the export.
2733
+ * Only one export can run at a time. Use the returned Blob's type to select a file extension.
2734
+ */
2735
+ toVideo(options: VideoExportOptions): Promise<Blob>;
2680
2736
  /** Exports visible scene meshes as OBJ text, without texture images. */
2681
2737
  toObj(): string;
2682
2738
  /** Exports visible scene meshes as PLY. Set `options.binary` for an ArrayBuffer. */
@@ -3296,4 +3352,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
3296
3352
  */
3297
3353
  declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
3298
3354
 
3299
- export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
3355
+ export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
@@ -18790,6 +18790,7 @@ __export(index_browser_exports, {
18790
18790
  Ticker: () => Ticker,
18791
18791
  TintColors: () => TintColors,
18792
18792
  UVMapper: () => UVMapper,
18793
+ VideoExporter: () => VideoExporter,
18793
18794
  WrappedImage: () => WrappedImage,
18794
18795
  addBox3WireframeToObject: () => addBox3WireframeToObject,
18795
18796
  addWireframeToMesh: () => addWireframeToMesh,
@@ -22165,6 +22166,131 @@ function copyDataTexture(source) {
22165
22166
  return new import_three19.Texture().copy(copySource);
22166
22167
  }
22167
22168
 
22169
+ // src/export/VideoExporter.ts
22170
+ var VideoExporter = class {
22171
+ constructor(source, options) {
22172
+ this.source = source;
22173
+ this.chunks = [];
22174
+ this.settled = false;
22175
+ this.stopping = false;
22176
+ this.onStart = () => {
22177
+ this.timer = setTimeout(() => {
22178
+ this.stopping = true;
22179
+ try {
22180
+ this.recorder.stop();
22181
+ } catch (error) {
22182
+ this.cancel(error);
22183
+ }
22184
+ }, this.duration * 1e3);
22185
+ };
22186
+ this.onData = (event) => {
22187
+ if (event.data.size) this.chunks.push(event.data);
22188
+ };
22189
+ this.onStop = () => {
22190
+ if (!this.stopping) return this.cancel(new Error("Video recording stopped before its duration elapsed"));
22191
+ if (!this.chunks.length) return this.cancel(new Error("The browser produced no video data"));
22192
+ const mimeType = this.chunks.find((chunk) => chunk.type)?.type || this.recorder.mimeType;
22193
+ const blob = new Blob(this.chunks, { type: mimeType });
22194
+ this.settled = true;
22195
+ this.cleanup();
22196
+ this.resolve(blob);
22197
+ };
22198
+ this.onError = (event) => {
22199
+ this.cancel(event.error ?? new Error("Video recording failed"));
22200
+ };
22201
+ this.onAbort = () => {
22202
+ this.cancel(this.signal.reason);
22203
+ };
22204
+ this.onTrackEnded = () => {
22205
+ this.cancel(new Error("The video capture stream stopped producing frames"));
22206
+ };
22207
+ const fps = options.fps ?? 30;
22208
+ if (!Number.isFinite(options.duration) || options.duration <= 0 || options.duration * 1e3 > 2147483647) {
22209
+ throw new RangeError("Video duration must be greater than zero and at most 2147483.647 seconds");
22210
+ }
22211
+ if (!Number.isFinite(fps) || fps <= 0) throw new RangeError("Video fps must be a finite positive number");
22212
+ const bitrate = options.videoBitsPerSecond;
22213
+ if (bitrate !== void 0 && (!Number.isInteger(bitrate) || bitrate <= 0 || bitrate > 4294967295)) {
22214
+ throw new RangeError("Video bitrate must be a positive unsigned 32-bit integer");
22215
+ }
22216
+ if (!source.width || !source.height) throw new Error("Cannot export video from an empty canvas");
22217
+ options.signal?.throwIfAborted();
22218
+ if (typeof document === "undefined" || typeof MediaRecorder === "undefined" || typeof MediaRecorder.isTypeSupported !== "function") {
22219
+ throw new Error("Video export requires a browser with MediaRecorder support");
22220
+ }
22221
+ const mimeTypes = options.mimeType === void 0 ? ["video/webm;codecs=vp9", "video/webm;codecs=vp8", "video/webm", "video/mp4"] : [options.mimeType];
22222
+ const mimeType = mimeTypes.find((type) => type.startsWith("video/") && MediaRecorder.isTypeSupported(type));
22223
+ if (!mimeType) throw new Error("The browser does not support the requested video format");
22224
+ this.canvas = document.createElement("canvas");
22225
+ this.canvas.width = source.width;
22226
+ this.canvas.height = source.height;
22227
+ if (typeof this.canvas.captureStream !== "function") throw new Error("Video export requires canvas captureStream support");
22228
+ const context = this.canvas.getContext("2d", { alpha: false });
22229
+ if (!context) throw new Error("Could not create a canvas for video export");
22230
+ this.context = context;
22231
+ this.signal = options.signal;
22232
+ this.duration = options.duration;
22233
+ this.result = new Promise((resolve, reject) => {
22234
+ this.resolve = resolve;
22235
+ this.reject = reject;
22236
+ });
22237
+ try {
22238
+ this.stream = this.canvas.captureStream(fps);
22239
+ this.recorder = new MediaRecorder(this.stream, { mimeType, videoBitsPerSecond: bitrate });
22240
+ this.recorder.addEventListener("start", this.onStart);
22241
+ this.recorder.addEventListener("dataavailable", this.onData);
22242
+ this.recorder.addEventListener("stop", this.onStop);
22243
+ this.recorder.addEventListener("error", this.onError);
22244
+ for (const track of this.stream.getTracks()) {
22245
+ track.addEventListener("ended", this.onTrackEnded);
22246
+ }
22247
+ this.signal?.addEventListener("abort", this.onAbort, { once: true });
22248
+ this.recorder.start();
22249
+ } catch (error) {
22250
+ this.cancel(error);
22251
+ }
22252
+ }
22253
+ /** Copies a freshly drawn source frame before WebGL can clear its drawing buffer. */
22254
+ capture() {
22255
+ if (this.settled || this.stopping) return;
22256
+ try {
22257
+ this.context.fillStyle = "#000000";
22258
+ this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
22259
+ this.context.drawImage(this.source, 0, 0, this.canvas.width, this.canvas.height);
22260
+ } catch (error) {
22261
+ this.cancel(error);
22262
+ }
22263
+ }
22264
+ /** Cancels recording, releases its capture stream, and rejects {@link result}. */
22265
+ cancel(reason = new DOMException("Video export cancelled", "AbortError")) {
22266
+ if (this.settled) return;
22267
+ this.settled = true;
22268
+ this.cleanup();
22269
+ this.reject(reason);
22270
+ }
22271
+ cleanup() {
22272
+ if (this.timer !== void 0) clearTimeout(this.timer);
22273
+ this.signal?.removeEventListener("abort", this.onAbort);
22274
+ if (this.recorder) {
22275
+ this.recorder.removeEventListener("start", this.onStart);
22276
+ this.recorder.removeEventListener("dataavailable", this.onData);
22277
+ this.recorder.removeEventListener("stop", this.onStop);
22278
+ this.recorder.removeEventListener("error", this.onError);
22279
+ if (this.recorder.state !== "inactive") {
22280
+ try {
22281
+ this.recorder.stop();
22282
+ } catch {
22283
+ }
22284
+ }
22285
+ }
22286
+ for (const track of this.stream?.getTracks() ?? []) {
22287
+ track.removeEventListener("ended", this.onTrackEnded);
22288
+ track.stop();
22289
+ }
22290
+ this.chunks.length = 0;
22291
+ }
22292
+ };
22293
+
22168
22294
  // src/gui/GuiHelper.ts
22169
22295
  init_AssetKey();
22170
22296
  init_ModelTextures();
@@ -27474,6 +27600,9 @@ var _Renderer = class _Renderer {
27474
27600
  this._inAnimationLoop = true;
27475
27601
  try {
27476
27602
  this.animate(time);
27603
+ } catch (error) {
27604
+ this._videoExporter?.cancel(error);
27605
+ throw error;
27477
27606
  } finally {
27478
27607
  this._inAnimationLoop = false;
27479
27608
  }
@@ -27668,16 +27797,18 @@ var _Renderer = class _Renderer {
27668
27797
  if (this._frameCallbacks.get(callback) === subscription) this._frameCallbacks.delete(callback);
27669
27798
  };
27670
27799
  }
27671
- /** Starts or resumes the animation loop and registered frame callbacks. */
27800
+ /** Starts or resumes the animation loop and registered frame callbacks. Has no effect while running. */
27672
27801
  start() {
27673
- if (this._disposed) return;
27802
+ if (this._disposed || this._running) return;
27674
27803
  this.stop();
27675
27804
  this._running = true;
27676
27805
  if (!this._inAnimationLoop) this.renderer.setAnimationLoop(this._animationLoop);
27677
27806
  }
27678
- /** Pauses rendering and frame callbacks. Call {@link start} to resume. */
27807
+ /** Pauses rendering and frame callbacks, and cancels video export. Call {@link start} to resume. */
27679
27808
  stop() {
27680
27809
  if (this._disposed) return;
27810
+ this._videoExporter?.cancel();
27811
+ this._videoExporter = void 0;
27681
27812
  this._running = false;
27682
27813
  if (this._inAnimationLoop) {
27683
27814
  queueMicrotask(() => {
@@ -27739,7 +27870,7 @@ var _Renderer = class _Renderer {
27739
27870
  this._controls.update();
27740
27871
  }
27741
27872
  if (!this._running) return;
27742
- if (!this.dirty && !this.options.render.renderAlways && !this._frameCallbacks.size) return;
27873
+ if (!this.dirty && !this.options.render.renderAlways && !this._frameCallbacks.size && !this._videoExporter) return;
27743
27874
  const interval = this._frameInterval;
27744
27875
  if (interval) {
27745
27876
  const next = this._nextFrameTime;
@@ -27764,6 +27895,7 @@ var _Renderer = class _Renderer {
27764
27895
  } else {
27765
27896
  this.renderer.render(this.scene, this.camera);
27766
27897
  }
27898
+ this._videoExporter?.capture();
27767
27899
  this.dirty = false;
27768
27900
  if (this._stats) {
27769
27901
  this._stats.end();
@@ -27784,6 +27916,35 @@ var _Renderer = class _Renderer {
27784
27916
  const canvas = trim ? trimCanvas(this.renderer.domElement) : this.renderer.domElement;
27785
27917
  return canvas.toDataURL(mime, quality);
27786
27918
  }
27919
+ /**
27920
+ * Records a silent browser video in real time, including frame callbacks and animated textures.
27921
+ * Keep the tab visible; browser scheduling and `render.fpsLimit` limit the capture rate.
27922
+ * The video keeps the initial drawing-buffer size and fills transparent pixels with black.
27923
+ * Temporarily starts a stopped renderer. Stop, disposal, or `options.signal` cancels the export.
27924
+ * Only one export can run at a time. Use the returned Blob's type to select a file extension.
27925
+ */
27926
+ async toVideo(options) {
27927
+ if (this._disposed) throw new Error("Cannot export a video from a disposed renderer");
27928
+ if (this._videoExporter) throw new Error("A video export is already running");
27929
+ const exporter = new VideoExporter(this.renderer.domElement, options);
27930
+ const wasRunning = this._running;
27931
+ try {
27932
+ try {
27933
+ if (!wasRunning) this.start();
27934
+ this._videoExporter = exporter;
27935
+ if (this._controls?.enabled) this._controls.update();
27936
+ this.drawFrame();
27937
+ } catch (error) {
27938
+ exporter.cancel(error);
27939
+ }
27940
+ return await exporter.result;
27941
+ } finally {
27942
+ if (this._videoExporter === exporter) {
27943
+ this._videoExporter = void 0;
27944
+ if (!wasRunning) this.stop();
27945
+ }
27946
+ }
27947
+ }
27787
27948
  /** Exports visible scene meshes as OBJ text, without texture images. */
27788
27949
  toObj() {
27789
27950
  return SceneExporter.toObj(this.scene);