@fraku/video 0.1.58 → 0.1.59
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.
- package/dist/components/ConfigDialog/Tabs/BackgroundOptionButton.d.ts +10 -0
- package/dist/components/ConfigDialog/tests/BackgroundSettings.test.d.ts +1 -0
- package/dist/components/ConfigDialog/tests/DropdownItemTemplate.test.d.ts +1 -0
- package/dist/components/ConfigDialog/tests/DropdownValueTemplate.test.d.ts +1 -0
- package/dist/components/ConfigDialog/tests/MenuButton.test.d.ts +1 -0
- package/dist/i18n/locales/ca.json.d.ts +9 -0
- package/dist/i18n/locales/de.json.d.ts +9 -0
- package/dist/i18n/locales/en.json.d.ts +9 -0
- package/dist/i18n/locales/es.json.d.ts +9 -0
- package/dist/i18n/locales/fr.json.d.ts +9 -0
- package/dist/index.cjs +165 -165
- package/dist/index.css +1 -1
- package/dist/index.js +14718 -14320
- package/dist/providers/VideoProvider/constants.d.ts +13 -0
- package/dist/providers/VideoProvider/context.d.ts +14 -2
- package/dist/providers/VideoProvider/tests/utils.test.d.ts +1 -0
- package/dist/providers/VideoProvider/useLocalVideo.d.ts +9 -0
- package/dist/providers/VideoProvider/useVideoDevices.d.ts +12 -0
- package/dist/providers/VideoProvider/useVideoEventHandlers.d.ts +15 -0
- package/dist/providers/VideoProvider/useVirtualBackground.d.ts +21 -0
- package/dist/providers/VideoProvider/utils.d.ts +67 -0
- package/dist/themes/lara-light-blue/theme.css +1307 -416
- package/dist/themes/theme.css +1307 -416
- package/package.json +6 -5
- package/dist/providers/VideoProvider/hooks.d.ts +0 -8
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MediaDevice, MobileVideoFacingMode } from '@zoom/videosdk';
|
|
2
|
+
|
|
3
|
+
export declare const VALID_IMAGE_TYPES: readonly ["image/jpeg", "image/png", "image/jpg", "image/webp"];
|
|
4
|
+
export declare const MAX_IMAGE_SIZE_BYTES: number;
|
|
5
|
+
export declare const VIDEO_QUALITY_LEVEL = 3;
|
|
6
|
+
export declare const DEFAULT_VIDEO_OPTIONS: {
|
|
7
|
+
readonly hd: true;
|
|
8
|
+
readonly fullHd: false;
|
|
9
|
+
readonly ptz: false;
|
|
10
|
+
readonly originalRatio: true;
|
|
11
|
+
};
|
|
12
|
+
export declare const DEFAULT_MOBILE_CAMERA_LIST: MediaDevice[];
|
|
13
|
+
export declare const MOBILE_CAMERA_FACING_MODES: readonly [MobileVideoFacingMode.User, MobileVideoFacingMode.Environment];
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { MutableRefObject } from 'react';
|
|
2
2
|
import { MediaDevice, VideoPlayer } from '@zoom/videosdk';
|
|
3
3
|
|
|
4
|
+
export type VirtualBackgroundMode = 'none' | 'blur' | 'image';
|
|
5
|
+
export type CustomBackgroundImage = {
|
|
6
|
+
id: string;
|
|
7
|
+
url: string;
|
|
8
|
+
};
|
|
9
|
+
export type VirtualBackgroundState = {
|
|
10
|
+
mode: VirtualBackgroundMode;
|
|
11
|
+
customImages: CustomBackgroundImage[];
|
|
12
|
+
activeCustomImageId: string | null;
|
|
13
|
+
};
|
|
4
14
|
export type VideoContextType = {
|
|
5
15
|
activeCameraId: string;
|
|
6
16
|
attachSharedVideo: ({ userId, videoPlayer }: {
|
|
@@ -13,18 +23,20 @@ export type VideoContextType = {
|
|
|
13
23
|
detachSharedVideo: (userId: number) => Promise<void>;
|
|
14
24
|
detachUserVideo: (userId: number) => Promise<void>;
|
|
15
25
|
finishScreenSharing: () => Promise<void>;
|
|
16
|
-
isBlurred: boolean;
|
|
17
26
|
localVideoRef: MutableRefObject<HTMLVideoElement | null>;
|
|
18
27
|
localVideoStarted: boolean;
|
|
19
28
|
selfVideoStarted: boolean;
|
|
29
|
+
setVirtualBackgroundMode: (mode: VirtualBackgroundMode, imageId?: string) => Promise<void>;
|
|
30
|
+
removeBackgroundImage: (imageId: string) => Promise<void>;
|
|
20
31
|
startScreenSharing: (params: {
|
|
21
32
|
selfShareCanvas: HTMLVideoElement | null;
|
|
22
33
|
}) => Promise<void>;
|
|
23
34
|
startVideo: () => Promise<void>;
|
|
24
35
|
stopLocalVideo: () => Promise<void>;
|
|
25
36
|
stopVideo: () => Promise<void>;
|
|
26
|
-
switchBlurred: (blurred: boolean) => Promise<void>;
|
|
27
37
|
switchCamera: (deviceId: string) => Promise<void>;
|
|
38
|
+
uploadBackgroundImage: (file: File) => Promise<void>;
|
|
39
|
+
virtualBackground: VirtualBackgroundState;
|
|
28
40
|
};
|
|
29
41
|
export declare const VideoContext: import('react').Context<VideoContextType>;
|
|
30
42
|
export declare const useVideoContext: () => VideoContextType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type LocalVideoTrack = {
|
|
2
|
+
ref: React.MutableRefObject<HTMLVideoElement | null>;
|
|
3
|
+
started: boolean;
|
|
4
|
+
start: (cameraId: string, virtualBackgroundImageUrl?: string) => Promise<void>;
|
|
5
|
+
stop: () => Promise<void>;
|
|
6
|
+
switch: (cameraId: string) => Promise<void>;
|
|
7
|
+
updateVirtualBackground: (imageUrl: string) => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export declare const useLocalVideo: () => LocalVideoTrack;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MediaDevice } from '@zoom/videosdk';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook to manage video device state (camera list and active camera)
|
|
5
|
+
*/
|
|
6
|
+
export declare const useVideoDevices: () => {
|
|
7
|
+
cameraList: MediaDevice[];
|
|
8
|
+
activeCameraId: string;
|
|
9
|
+
setActiveCameraId: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
10
|
+
handleDeviceChange: () => void;
|
|
11
|
+
isMobile: boolean;
|
|
12
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as ZoomVideo } from '@zoom/videosdk';
|
|
2
|
+
|
|
3
|
+
type UseVideoEventHandlersParams = {
|
|
4
|
+
zmClient: ReturnType<typeof ZoomVideo.createClient>;
|
|
5
|
+
sessionStarted: boolean;
|
|
6
|
+
onVideoStarted: () => void;
|
|
7
|
+
onVideoStopped: () => void;
|
|
8
|
+
onDeviceChange: () => void;
|
|
9
|
+
onScreenShareStopped: () => void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Custom hook to manage Zoom video event subscriptions
|
|
13
|
+
*/
|
|
14
|
+
export declare const useVideoEventHandlers: ({ zmClient, sessionStarted, onVideoStarted, onVideoStopped, onDeviceChange, onScreenShareStopped }: UseVideoEventHandlersParams) => void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as ZoomVideo } from '@zoom/videosdk';
|
|
2
|
+
import { VirtualBackgroundMode, VirtualBackgroundState } from './context';
|
|
3
|
+
import { LocalVideoTrack } from './useLocalVideo';
|
|
4
|
+
import { NotifyProps } from '../DialogsProvider/context';
|
|
5
|
+
|
|
6
|
+
type UseVirtualBackgroundParams = {
|
|
7
|
+
zmClient: ReturnType<typeof ZoomVideo.createClient>;
|
|
8
|
+
sessionStarted: boolean;
|
|
9
|
+
isSessionStarted: () => boolean;
|
|
10
|
+
localVideo: LocalVideoTrack;
|
|
11
|
+
activeCameraId: string;
|
|
12
|
+
notify: (props: NotifyProps) => void;
|
|
13
|
+
t: (key: string) => string;
|
|
14
|
+
};
|
|
15
|
+
export declare const useVirtualBackground: ({ zmClient, sessionStarted, isSessionStarted, localVideo, activeCameraId, notify, t }: UseVirtualBackgroundParams) => {
|
|
16
|
+
virtualBackground: VirtualBackgroundState;
|
|
17
|
+
setVirtualBackgroundMode: (mode: VirtualBackgroundMode, imageId?: string) => Promise<void>;
|
|
18
|
+
uploadBackgroundImage: (file: File) => Promise<void>;
|
|
19
|
+
removeBackgroundImage: (imageId: string) => Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { VirtualBackgroundMode, VirtualBackgroundState, CustomBackgroundImage } from './context';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Converts virtual background state to Zoom SDK image URL format
|
|
5
|
+
* @param mode - The virtual background mode
|
|
6
|
+
* @param customImages - Array of custom background images
|
|
7
|
+
* @param activeCustomImageId - ID of the active custom image
|
|
8
|
+
* @returns SDK-compatible image URL string ('', 'blur', or data URL)
|
|
9
|
+
*/
|
|
10
|
+
export declare const getVirtualBackgroundImageUrl: (mode: VirtualBackgroundMode, customImages: CustomBackgroundImage[], activeCustomImageId: string | null) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Validates background image file type
|
|
13
|
+
* @param file - The file to validate
|
|
14
|
+
* @returns true if valid, false otherwise
|
|
15
|
+
*/
|
|
16
|
+
export declare const isValidImageType: (file: File) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Validates background image file size
|
|
19
|
+
* @param file - The file to validate
|
|
20
|
+
* @returns true if valid, false otherwise
|
|
21
|
+
*/
|
|
22
|
+
export declare const isValidImageSize: (file: File) => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Validation result for background image files
|
|
25
|
+
*/
|
|
26
|
+
export type FileValidationResult = {
|
|
27
|
+
valid: true;
|
|
28
|
+
} | {
|
|
29
|
+
valid: false;
|
|
30
|
+
reason: 'invalid-type' | 'too-large';
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Validates a background image file
|
|
34
|
+
* @param file - The file to validate
|
|
35
|
+
* @returns Validation result with reason if invalid
|
|
36
|
+
*/
|
|
37
|
+
export declare const validateBackgroundImageFile: (file: File) => FileValidationResult;
|
|
38
|
+
/**
|
|
39
|
+
* Reads a file as a data URL (Base64)
|
|
40
|
+
* @param file - The file to read
|
|
41
|
+
* @returns Promise resolving to data URL string
|
|
42
|
+
* @throws Error if file reading fails
|
|
43
|
+
*/
|
|
44
|
+
export declare const readFileAsDataURL: (file: File) => Promise<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the virtual background state from mode and image ID
|
|
47
|
+
* @param mode - The virtual background mode
|
|
48
|
+
* @param imageId - Optional image ID for custom backgrounds
|
|
49
|
+
* @param currentState - Current virtual background state
|
|
50
|
+
* @returns New virtual background state
|
|
51
|
+
*/
|
|
52
|
+
export declare const getVirtualBackgroundState: (mode: VirtualBackgroundMode, imageId: string | undefined, currentState: VirtualBackgroundState) => VirtualBackgroundState;
|
|
53
|
+
/**
|
|
54
|
+
* Saves custom background images to localStorage
|
|
55
|
+
* @param images - Array of custom background images
|
|
56
|
+
* @returns true if saved successfully, false otherwise
|
|
57
|
+
*/
|
|
58
|
+
export declare const saveCustomImagesToLocalStorage: (images: CustomBackgroundImage[]) => boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Loads custom background images from localStorage
|
|
61
|
+
* @returns Array of custom background images, or empty array if none found
|
|
62
|
+
*/
|
|
63
|
+
export declare const loadCustomImagesFromLocalStorage: () => CustomBackgroundImage[];
|
|
64
|
+
/**
|
|
65
|
+
* Clears all custom background images from localStorage
|
|
66
|
+
*/
|
|
67
|
+
export declare const clearCustomImagesFromLocalStorage: () => void;
|