@fraku/video 0.0.1 → 0.0.2
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/package.json +2 -3
- package/src/App.tsx +0 -7
- package/src/components/ZoomVideoPlugin/ZoomVideoPlugin.stories.tsx +0 -50
- package/src/components/ZoomVideoPlugin/ZoomVideoPlugin.tsx +0 -253
- package/src/components/ZoomVideoPlugin/components/ButtonsDock/ButtonsDock.tsx +0 -353
- package/src/components/ZoomVideoPlugin/components/ButtonsDock/DockButton.tsx +0 -90
- package/src/components/ZoomVideoPlugin/components/ButtonsDock/MenuItemTemplate.tsx +0 -35
- package/src/components/ZoomVideoPlugin/components/ButtonsDock/index.ts +0 -1
- package/src/components/ZoomVideoPlugin/components/MobileIconButton/MobileIconButton.tsx +0 -30
- package/src/components/ZoomVideoPlugin/components/MobileIconButton/index.ts +0 -1
- package/src/components/ZoomVideoPlugin/components/Overlay/Overlay.tsx +0 -74
- package/src/components/ZoomVideoPlugin/components/Overlay/index.ts +0 -1
- package/src/components/ZoomVideoPlugin/components/ParticipantsList.tsx +0 -52
- package/src/components/ZoomVideoPlugin/components/SettingsOverlay/SettingsContent.tsx +0 -19
- package/src/components/ZoomVideoPlugin/components/SettingsOverlay/SettingsMenu.tsx +0 -30
- package/src/components/ZoomVideoPlugin/components/SettingsOverlay/SettingsOverlay.tsx +0 -52
- package/src/components/ZoomVideoPlugin/components/SettingsOverlay/Tabs/AudioSettings.tsx +0 -191
- package/src/components/ZoomVideoPlugin/components/SettingsOverlay/Tabs/BackgroundSettings.tsx +0 -47
- package/src/components/ZoomVideoPlugin/components/SettingsOverlay/Tabs/DropdownItemTemplate.tsx +0 -20
- package/src/components/ZoomVideoPlugin/components/SettingsOverlay/Tabs/DropdownValueTemplate.tsx +0 -12
- package/src/components/ZoomVideoPlugin/components/SettingsOverlay/Tabs/VideoSettings.tsx +0 -30
- package/src/components/ZoomVideoPlugin/components/SettingsOverlay/context.ts +0 -20
- package/src/components/ZoomVideoPlugin/components/SettingsOverlay/index.ts +0 -1
- package/src/components/ZoomVideoPlugin/components/Video.tsx +0 -35
- package/src/components/ZoomVideoPlugin/constants.ts +0 -4
- package/src/components/ZoomVideoPlugin/context.ts +0 -86
- package/src/components/ZoomVideoPlugin/hooks/useClientMessages.ts +0 -142
- package/src/components/ZoomVideoPlugin/hooks/useDeviceSize.ts +0 -24
- package/src/components/ZoomVideoPlugin/hooks/useStartVideoOptions.ts +0 -14
- package/src/components/ZoomVideoPlugin/hooks/useZoomVideoPlayer.tsx +0 -142
- package/src/components/ZoomVideoPlugin/index.ts +0 -2
- package/src/components/ZoomVideoPlugin/lib/platforms.ts +0 -17
- package/src/components/ZoomVideoPlugin/pages/AfterSession.tsx +0 -14
- package/src/components/ZoomVideoPlugin/pages/MainSession.tsx +0 -53
- package/src/components/ZoomVideoPlugin/pages/PanelistsSession.tsx +0 -97
- package/src/components/ZoomVideoPlugin/pages/PreSessionConfiguration.tsx +0 -154
- package/src/components/ZoomVideoPlugin/types.global.d.ts +0 -15
- package/src/components/ZoomVideoPlugin/types.ts +0 -23
- package/src/global.d.ts +0 -46
- package/src/index.css +0 -4
- package/src/index.ts +0 -4
- package/src/main.tsx +0 -10
- package/src/vite-env.d.ts +0 -12
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { useCallback, useRef } from 'react'
|
|
2
|
-
import { Button } from 'primereact/button'
|
|
3
|
-
import { useUnmount } from 'react-use'
|
|
4
|
-
import Video from '../components/Video'
|
|
5
|
-
import { useZoomVideoContext } from '../context'
|
|
6
|
-
import { useZoomVideoPlayer } from '../hooks/useZoomVideoPlayer'
|
|
7
|
-
import ParticipantsList from '../components/ParticipantsList'
|
|
8
|
-
import ButtonsDock from '../components/ButtonsDock'
|
|
9
|
-
import { SessionStep } from '../types'
|
|
10
|
-
|
|
11
|
-
const PanelistsSession = ({ initMainSession }: { initMainSession: () => void }) => {
|
|
12
|
-
const {
|
|
13
|
-
activeMicrophone,
|
|
14
|
-
activeAudioOutput,
|
|
15
|
-
activeVideoId,
|
|
16
|
-
mediaStream,
|
|
17
|
-
stopSession,
|
|
18
|
-
setIsCamOn,
|
|
19
|
-
setIsMicOn,
|
|
20
|
-
participants,
|
|
21
|
-
switchActiveMicrophone,
|
|
22
|
-
setActiveCamera,
|
|
23
|
-
switchActiveAudioOutput,
|
|
24
|
-
zmClient
|
|
25
|
-
} = useZoomVideoContext()
|
|
26
|
-
|
|
27
|
-
const fullRef = useRef<HTMLVideoElement>(null)
|
|
28
|
-
|
|
29
|
-
useZoomVideoPlayer({ fullRef })
|
|
30
|
-
|
|
31
|
-
const switchActiveCamera = useCallback(
|
|
32
|
-
(deviceId: string) => {
|
|
33
|
-
setActiveCamera(deviceId)
|
|
34
|
-
mediaStream?.switchCamera(deviceId)
|
|
35
|
-
},
|
|
36
|
-
[mediaStream, setActiveCamera]
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
const toggleMicrophone = useCallback(async () => {
|
|
40
|
-
if (!mediaStream || !zmClient) return
|
|
41
|
-
if (zmClient.getCurrentUserInfo().audio) {
|
|
42
|
-
await mediaStream.stopAudio().catch(console.warn)
|
|
43
|
-
setIsMicOn(false)
|
|
44
|
-
} else {
|
|
45
|
-
await mediaStream.startAudio({ microphoneId: activeMicrophone, speakerId: activeAudioOutput }).catch(console.warn)
|
|
46
|
-
setIsMicOn(true)
|
|
47
|
-
}
|
|
48
|
-
}, [activeMicrophone, activeAudioOutput, mediaStream, setIsMicOn, zmClient])
|
|
49
|
-
|
|
50
|
-
useUnmount(() => {
|
|
51
|
-
if (zmClient?.getSessionInfo().isInMeeting) {
|
|
52
|
-
if (zmClient?.getCurrentUserInfo().audio) {
|
|
53
|
-
mediaStream?.stopAudio().catch(console.warn)
|
|
54
|
-
}
|
|
55
|
-
if (zmClient?.getCurrentUserInfo()?.bVideoOn) {
|
|
56
|
-
mediaStream?.stopVideo().catch(console.warn)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
mediaStream?.stopShareScreen().catch(console.warn)
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<div className="flex flex-col gap-24 py-16 justify-start w-full">
|
|
65
|
-
<div className="flex flex-col @sm:flex-row gap-8 p-16 items-center justify-between bg-warning-90 w-full">
|
|
66
|
-
<p>Estás en una conferencia de prueba, abre sesión para invitar a todos el listado de asistentes.</p>
|
|
67
|
-
<Button onClick={initMainSession} className="whitespace-pre-line">
|
|
68
|
-
Abrir videoconferencia
|
|
69
|
-
</Button>
|
|
70
|
-
</div>
|
|
71
|
-
|
|
72
|
-
<div className="flex flex-col gap-16 items-center justify-center w-full @sm:w-[640px] @md:w-[680px] mx-auto">
|
|
73
|
-
<Video fullRef={fullRef} />
|
|
74
|
-
|
|
75
|
-
<ButtonsDock
|
|
76
|
-
exit={stopSession}
|
|
77
|
-
sessionStep={SessionStep.OnlyPanelistsSession}
|
|
78
|
-
setIsCamOn={() => setIsCamOn((prev) => !prev)}
|
|
79
|
-
setIsMicOn={toggleMicrophone}
|
|
80
|
-
setActiveMicrophone={switchActiveMicrophone}
|
|
81
|
-
setActiveCamera={switchActiveCamera}
|
|
82
|
-
setActiveAudioOutput={switchActiveAudioOutput}
|
|
83
|
-
/>
|
|
84
|
-
|
|
85
|
-
<p>Active video id: {activeVideoId}</p>
|
|
86
|
-
<ParticipantsList
|
|
87
|
-
zmClient={zmClient}
|
|
88
|
-
setIsCamOn={setIsCamOn}
|
|
89
|
-
setIsMicOn={setIsMicOn}
|
|
90
|
-
participants={participants}
|
|
91
|
-
/>
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export default PanelistsSession
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { useRef, useState, useCallback } from 'react'
|
|
2
|
-
import ZoomVideo from '@zoom/videosdk'
|
|
3
|
-
import { Button } from 'primereact/button'
|
|
4
|
-
import { useEffectOnce, useUnmount } from 'react-use'
|
|
5
|
-
import { useZoomVideoContext } from '../context'
|
|
6
|
-
import Video from '../components/Video'
|
|
7
|
-
import ButtonsDock from '../components/ButtonsDock'
|
|
8
|
-
import { VIDEO_PLACEHOLDER } from '../constants'
|
|
9
|
-
import { SessionStep } from '../types'
|
|
10
|
-
|
|
11
|
-
const PreSessionConfiguration = ({ joinSession }: { joinSession: () => Promise<void> }) => {
|
|
12
|
-
const {
|
|
13
|
-
closeParentContainer,
|
|
14
|
-
localAudio,
|
|
15
|
-
localVideo,
|
|
16
|
-
setIsCamOn,
|
|
17
|
-
setIsMicOn,
|
|
18
|
-
setActiveCamera,
|
|
19
|
-
switchActiveAudioOutput,
|
|
20
|
-
switchActiveMicrophone,
|
|
21
|
-
setLocalVideo
|
|
22
|
-
} = useZoomVideoContext()
|
|
23
|
-
const [isVideoStarted, setIsVideoStarted] = useState(false)
|
|
24
|
-
const [isAudioStarted, setIsAudioStarted] = useState(false)
|
|
25
|
-
const videoRef = useRef<HTMLVideoElement | null>(null)
|
|
26
|
-
|
|
27
|
-
const stopLocalVideo = useCallback(async () => {
|
|
28
|
-
const containerEl = videoRef.current
|
|
29
|
-
if (!containerEl || !localVideo) return
|
|
30
|
-
try {
|
|
31
|
-
await localVideo.stop()
|
|
32
|
-
setIsVideoStarted(false)
|
|
33
|
-
containerEl.innerHTML = VIDEO_PLACEHOLDER
|
|
34
|
-
setIsCamOn(false)
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.error('Error stopping local video:', error)
|
|
37
|
-
await localVideo.start(containerEl)
|
|
38
|
-
setIsVideoStarted(true)
|
|
39
|
-
}
|
|
40
|
-
}, [localVideo, setIsCamOn])
|
|
41
|
-
|
|
42
|
-
const stopLocalAudio = useCallback(async () => {
|
|
43
|
-
if (!localAudio) return
|
|
44
|
-
try {
|
|
45
|
-
await localAudio.stop()
|
|
46
|
-
setIsAudioStarted(false)
|
|
47
|
-
setIsMicOn(false)
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.error('Error stopping local audio:', error)
|
|
50
|
-
await localAudio.start()
|
|
51
|
-
}
|
|
52
|
-
}, [localAudio, setIsMicOn])
|
|
53
|
-
|
|
54
|
-
const toggleLocalVideo = useCallback(async () => {
|
|
55
|
-
if (!localVideo) return
|
|
56
|
-
if (isVideoStarted) {
|
|
57
|
-
await stopLocalVideo()
|
|
58
|
-
} else if (videoRef.current) {
|
|
59
|
-
try {
|
|
60
|
-
await localVideo.start(videoRef.current)
|
|
61
|
-
setIsVideoStarted(true)
|
|
62
|
-
setIsCamOn(true)
|
|
63
|
-
} catch (error) {
|
|
64
|
-
console.error('Error starting local video:', error)
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}, [localVideo, isVideoStarted, stopLocalVideo, setIsCamOn])
|
|
68
|
-
|
|
69
|
-
const toggleAudioMuteStatus = useCallback(async () => {
|
|
70
|
-
if (!localAudio) return
|
|
71
|
-
if (isAudioStarted) {
|
|
72
|
-
await stopLocalAudio()
|
|
73
|
-
} else {
|
|
74
|
-
try {
|
|
75
|
-
await localAudio.start()
|
|
76
|
-
setIsAudioStarted(true)
|
|
77
|
-
setIsMicOn(true)
|
|
78
|
-
} catch (error) {
|
|
79
|
-
console.error('Error starting local audio:', error)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, [isAudioStarted, localAudio, stopLocalAudio, setIsMicOn])
|
|
83
|
-
|
|
84
|
-
const switchActiveCamera = async (deviceId: string) => {
|
|
85
|
-
if (!localVideo) return
|
|
86
|
-
setActiveCamera(deviceId)
|
|
87
|
-
if (!isVideoStarted) return
|
|
88
|
-
await localVideo.stop()
|
|
89
|
-
setLocalVideo(ZoomVideo.createLocalVideoTrack(deviceId))
|
|
90
|
-
if (!videoRef.current) return
|
|
91
|
-
await localVideo.start(videoRef.current)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const exit = useCallback(async () => {
|
|
95
|
-
if (isVideoStarted) await stopLocalVideo()
|
|
96
|
-
if (isAudioStarted) await stopLocalAudio()
|
|
97
|
-
closeParentContainer()
|
|
98
|
-
}, [isVideoStarted, isAudioStarted, stopLocalVideo, stopLocalAudio, closeParentContainer])
|
|
99
|
-
|
|
100
|
-
useEffectOnce(() => {
|
|
101
|
-
const startLocalMedia = async () => {
|
|
102
|
-
if (!videoRef.current || !localVideo || !localAudio) return
|
|
103
|
-
try {
|
|
104
|
-
await localVideo.start(videoRef.current).catch(console.error)
|
|
105
|
-
await localAudio.start().catch(console.error)
|
|
106
|
-
setIsVideoStarted(true)
|
|
107
|
-
setIsAudioStarted(true)
|
|
108
|
-
setIsCamOn(true)
|
|
109
|
-
setIsMicOn(true)
|
|
110
|
-
} catch (error) {
|
|
111
|
-
console.error('Error starting local media:', error)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
startLocalMedia()
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
useUnmount(async () => {
|
|
119
|
-
if (isAudioStarted) {
|
|
120
|
-
await stopLocalAudio().catch(console.error)
|
|
121
|
-
}
|
|
122
|
-
if (isVideoStarted) {
|
|
123
|
-
await stopLocalVideo().catch(console.error)
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
return (
|
|
128
|
-
<div className="flex flex-col gap-24 py-16 items-center justify-between w-full">
|
|
129
|
-
<section className="flex flex-col gap-8 py-16 items-center text-center">
|
|
130
|
-
<h3>Acceso a la videoconferencia</h3>
|
|
131
|
-
<p>Comprueba que todo funciona correctamente para una mejor experiencia en la videollamada.</p>
|
|
132
|
-
</section>
|
|
133
|
-
|
|
134
|
-
<div className="flex flex-col gap-16 items-center justify-center w-full sm:w-[640px] md:w-[680px] mx-auto">
|
|
135
|
-
<Video fullRef={videoRef} />
|
|
136
|
-
<ButtonsDock
|
|
137
|
-
exit={exit}
|
|
138
|
-
sessionStep={SessionStep.LocalSettingsConfiguration}
|
|
139
|
-
setIsCamOn={toggleLocalVideo}
|
|
140
|
-
setIsMicOn={toggleAudioMuteStatus}
|
|
141
|
-
setActiveMicrophone={switchActiveMicrophone}
|
|
142
|
-
setActiveCamera={switchActiveCamera}
|
|
143
|
-
setActiveAudioOutput={switchActiveAudioOutput}
|
|
144
|
-
/>
|
|
145
|
-
</div>
|
|
146
|
-
|
|
147
|
-
<section className="flex flex-col gap-8">
|
|
148
|
-
<Button onClick={joinSession} label="Acceder a la videoconferencia" />
|
|
149
|
-
</section>
|
|
150
|
-
</div>
|
|
151
|
-
)
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export default PreSessionConfiguration
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Global type declarations for Zoom Video SDK custom elements
|
|
2
|
-
declare global {
|
|
3
|
-
interface Window {
|
|
4
|
-
webEndpoint?: string
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
namespace JSX {
|
|
8
|
-
interface IntrinsicElements {
|
|
9
|
-
'video-player-container': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>
|
|
10
|
-
'video-player': React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export {}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
export enum SessionStep {
|
|
4
|
-
LocalSettingsConfiguration,
|
|
5
|
-
OnlyPanelistsSession,
|
|
6
|
-
MainSession,
|
|
7
|
-
AfterSession
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export type Credentials = {
|
|
11
|
-
sessionName: string
|
|
12
|
-
signature: string
|
|
13
|
-
userName: string
|
|
14
|
-
sessionPasscode: string
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type ReactSetter<T> = React.Dispatch<React.SetStateAction<T>>
|
|
18
|
-
|
|
19
|
-
export type ZoomVideoPluginProps = {
|
|
20
|
-
credentials: Credentials | null
|
|
21
|
-
closeParentContainer: () => void
|
|
22
|
-
setIsCloseButtonVisible: ReactSetter<boolean>
|
|
23
|
-
}
|
package/src/global.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
type PromiseType<T extends (..._: any) => any> = Awaited<ReturnType<T>>
|
|
2
|
-
|
|
3
|
-
type DeepPartial<T> = {
|
|
4
|
-
[P in keyof T]?: DeepPartial<T[P]>
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
type ReactSetter<T> = React.Dispatch<React.SetStateAction<T>>
|
|
8
|
-
|
|
9
|
-
interface AwsWafCaptcha {
|
|
10
|
-
renderCaptcha: (
|
|
11
|
-
container: HTMLElement,
|
|
12
|
-
options: {
|
|
13
|
-
apiKey: string
|
|
14
|
-
onSuccess: (wafToken: string) => void
|
|
15
|
-
onLoad?: () => void
|
|
16
|
-
onError?: () => void
|
|
17
|
-
onPuzzleTimeout?: () => void
|
|
18
|
-
onPuzzleIncorrect?: () => void
|
|
19
|
-
onPuzzleCorrect?: () => void
|
|
20
|
-
defaultLocale?: string
|
|
21
|
-
disableLanguageSelector?: boolean
|
|
22
|
-
dynamicWidth?: boolean
|
|
23
|
-
skipTitle?: boolean
|
|
24
|
-
}
|
|
25
|
-
) => void
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface AwsWafIntegration {
|
|
29
|
-
getToken: () => Promise<string>
|
|
30
|
-
hasToken: () => boolean
|
|
31
|
-
forceRefreshToken: () => Promise<void>
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
interface Window {
|
|
35
|
-
dataLayer: Record<string, unknown>[]
|
|
36
|
-
AwsWafCaptcha: AwsWafCaptcha
|
|
37
|
-
AwsWafIntegration: AwsWafIntegration
|
|
38
|
-
awsWafCookieDomainList: string[]
|
|
39
|
-
|
|
40
|
-
documentPictureInPicture: {
|
|
41
|
-
requestWindow: (options: { width: number; height: number }) => Promise<Window>
|
|
42
|
-
addEventListener: (type: 'enter' | 'leave', listener: (event: any) => void) => void
|
|
43
|
-
window: Window | null
|
|
44
|
-
}
|
|
45
|
-
webEndpoint: string | undefined
|
|
46
|
-
}
|
package/src/index.css
DELETED
package/src/index.ts
DELETED
package/src/main.tsx
DELETED
package/src/vite-env.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
2
|
-
|
|
3
|
-
interface ImportMetaEnv {
|
|
4
|
-
readonly VITE_ZOOM_SESSION_NAME?: string
|
|
5
|
-
readonly VITE_ZOOM_SIGNATURE?: string
|
|
6
|
-
readonly VITE_ZOOM_USER_NAME?: string
|
|
7
|
-
readonly VITE_ZOOM_SESSION_PASSCODE?: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface ImportMeta {
|
|
11
|
-
readonly env: ImportMetaEnv
|
|
12
|
-
}
|