saltfish
Version:
An interactive video-guided tour system for web applications
121 lines • 3.28 kB
TypeScript
import type { DevicePlaybackHandler } from './DevicePlaybackHandler';
/**
* Callbacks for VideoControlsUI to communicate with VideoManager
*/
export interface VideoControlsCallbacks {
onSeek: (time: number) => void;
onMuteToggle: () => void;
on90PercentReached: () => void;
}
/**
* Manages video player UI controls (progress bar, mute button, CC button)
* Handles all visual updates, user interactions, and progress tracking
*/
export declare class VideoControlsUI {
private container;
private controlsElement;
private progressBar;
private muteButton;
private ccButton;
private deviceHandler;
private callbacks;
private updateInterval;
private animationFrameId;
private lastTimeupdateEvent;
private videoElement;
private buttonsShownAt90Percent;
constructor(container: HTMLElement, deviceHandler: DevicePlaybackHandler, callbacks: VideoControlsCallbacks);
/**
* Creates all UI control elements
*/
create(videoElement: HTMLVideoElement): void;
/**
* Updates the video element reference (used when swapping videos)
*/
updateVideoElement(videoElement: HTMLVideoElement): void;
/**
* Resets controls for new video
*/
reset(): void;
/**
* Resets the 90% button trigger flag (called when loading new video)
*/
reset90PercentTrigger(): void;
/**
* Destroys controls and cleans up
*/
destroy(): void;
/**
* Starts progress tracking using RAF or setTimeout based on device
*/
startProgressTracking(): void;
/**
* Stops progress tracking
*/
stopProgressTracking(): void;
/**
* Immediately updates progress bar to specific values (for pause/seek)
*/
updateProgressImmediate(currentTime: number, duration: number): void;
/**
* Updates the progress bar based on current playback position
*/
private updateProgress;
/**
* Handles detailed time updates for smooth progress bar and button visibility
*/
private handleDetailedTimeUpdate;
/**
* Handles seeking events to ensure smooth progress updates
*/
private handleSeeking;
/**
* Handles seeked events (seeking ended)
*/
private handleSeeked;
/**
* Handles click on the progress bar to seek
*/
private handleProgressBarClick;
/**
* Sets the muted state
*/
setMuted(muted: boolean): void;
/**
* Toggles the muted state
*/
private toggleMute;
/**
* Gets the current muted state
*/
getMuted(): boolean;
/**
* Updates the mute button icon based on muted state
*/
private updateMuteButtonIcon;
/**
* Updates the CC button icon based on enabled state
*/
updateCCButtonIcon(isEnabled: boolean): void;
/**
* Shows the progress bar
*/
showProgressBar(): void;
/**
* Hides the progress bar
*/
hideProgressBar(): void;
/**
* Shows the mute button
*/
showMuteButton(): void;
/**
* Hides the mute button
*/
hideMuteButton(): void;
/**
* Gets the CC button element (for TranscriptManager)
*/
getCCButton(): HTMLElement | null;
}
//# sourceMappingURL=VideoControlsUI.d.ts.map