import * as THREE from 'three'; import { ContextManager, Event, Observable, PlayOptions, Stream } from '@zcomponent/core'; import { Object3D } from './Object3D'; import { MeshChromaKeyMaterial } from '../internal/MeshChromaKeyMaterial'; import { MeshSideBySideAlphaMaterial, SideBySideDirection } from '../internal/MeshSideBySideAlphaMaterial'; export declare enum VideoTransparencyType { none = "none", chromaKey = "chromaKey", sideBySide = "sideBySide" } interface VideoConstructorProps { geometry?: THREE.BufferGeometry; /** @zprop * @zvalues files *.+(mp4) */ source: string; /** * Support videos with transparency * * @zprop * @zdefault none */ transparent?: VideoTransparencyType; /** @zprop * @zdefault false */ autoplay?: boolean; /** * @zprop * @zdefault default */ audioLayer?: string; /** * @zprop * @zdefault false */ legacyAudio?: boolean; } /** * * Manages the playback and display of a video in a 3D environment, extending the basic Object3D component. * Supports various video transparency types, including chroma key and side-by-side transparency. * Provides control over video playback properties like volume, looping, and muting. * * * Root element: [THREE.Group](https://threejs.org/docs/index.html#api/en/objects/Group) * @zcomponent * @zicon movie * @ztag three/Object3D/Video * @zparents three/Object3D/Group/** * @zgroup Media * @zstream */ export declare class Video extends Object3D implements Stream { protected constructorProps: VideoConstructorProps; /** * Event emitted when the video playback ends. * @zui * @public * @type {Event<[Video]>} */ onEnded: Event<[Video]>; /** * Event emitted when the video playback is paused. * @zui * @public * @type {Event<[Video]>} */ onPause: Event<[Video]>; /** * Event emitted when the video playback starts. * @zui */ onPlay: Event<[Video]>; /** * Event emitted when the video starts playing after being paused or buffered. * @zui */ onPlaying: Event<[Video]>; /** * Event emitted when the video playback is waiting for more data to continue. * @zui */ onWaiting: Event<[Video]>; /** * Event emitted when an error occurs during video loading or playback. * @zui */ onError: Event<[Video]>; /** * The primary group element of the video, used as a container in the 3D scene. */ element: THREE.Group; /** * The geometry of the video mesh, defining its shape in the 3D space. */ geometry: THREE.BufferGeometry; /** * The material applied to the video mesh, determining its visual appearance. * The material can be a basic mesh material, chroma key material, or side-by-side alpha material * based on the transparency type. */ material: THREE.MeshBasicMaterial | MeshChromaKeyMaterial | MeshSideBySideAlphaMaterial; /** * The mesh representing the video. It combines the geometry and material. */ mesh: THREE.Mesh; /** * The three.js VideoTexture object associated with this video. Note that this object may be reused by * multiple components if they share the same source video. **/ texture: THREE.VideoTexture; /** * Whether the video is transparent, and if so, what type of transparency is used. */ transparent: VideoTransparencyType; /** * The HTML video element associated with this video. This element is used to control video playback. */ videoElement: HTMLVideoElement; private _hadUserEvent; private _gain; /** * Constructs an instance of Video, setting up the geometry, material, and mesh for the video. * @param ctx - The context manager. * @param constructorProps - Properties for constructing the video, including source URL and autoplay option. */ constructor(ctx: ContextManager, constructorProps: VideoConstructorProps); private _updateMute; /** * The volume of the video, from 0 to 1. * @zprop * @ztype proportion * @zdefault 1 */ volume: Observable; /** * Whether the video is muted. * @zprop * @zdefault false * @zgroup Video * @zgrouppriority 20 */ muted: Observable; /** * Whether the video should loop when it reaches the end. * @zprop * @zdefault false * @zgroup Video * @zgrouppriority 20 */ loop: Observable; /** * Plays the video, optionally at a specified speed. * @zprop * @zui */ play(opts?: PlayOptions): void; /** * Pauses the video. * @zprop * @zui */ pause(): void; /** * Stops the video and resets the playback position to the beginning. * @zprop * @zui */ stop(): void; /** * Seeks to a specified time in the video in milliseconds. * @zprop * @zui */ seek(/** @ztype time-milliseconds */ t: number): void; /** * * @returns The current playback time in milliseconds. */ length(): number | undefined; /** * * @returns The current playback time in milliseconds. */ isStalled(): boolean; /** * TThe chroma key similarity value, from 0 to 1. * @zprop * @zgroup Chroma Key Transparency * @zgrouppriority 20 * @ztype proportion * @zdefault 0.05 */ similarity: Observable; /** * The smoothness of the chroma key, from 0 to 1. * @zprop * @zgroup Chroma Key Transparency * @zgrouppriority 20 * @ztype proportion * @zdefault 0.08 */ smoothness: Observable; /** * The spill of the chroma key, from 0 to 1. * @zprop * @zgroup Chroma Key Transparency * @zgrouppriority 20 * @ztype proportion * @zdefault 0.2 */ spill: Observable; /** * The key color of the chroma key, as an RGB array. * @zprop * @zgroup Chroma Key Transparency * @zgrouppriority 20 * @ztype color-norm-rgb-linear * @zdefault [0, 1, 0] */ keyColor: Observable<[number, number, number], never>; /** * The direction of the side-by-side transparency. * @zprop * @zgroup Side By Side Transparency * @zgrouppriority 20 * @zdefault LeftRight */ direction: Observable; /** * Weather the alpha channel is first or second in the side-by-side transparency. * @zprop * @zgroup Side By Side Transparency * @zgrouppriority 20 * @zdefault false */ alphaFirst: Observable; dispose(): never; } export {};