mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-02 06:59:45 +00:00
Compare commits
1 Commits
media-state
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 8cbcad7645 |
@@ -59,9 +59,10 @@ export const Avatar = React.memo(
|
|||||||
<text
|
<text
|
||||||
x="50"
|
x="50"
|
||||||
y="50"
|
y="50"
|
||||||
|
dy="-0.08em"
|
||||||
textAnchor="middle"
|
textAnchor="middle"
|
||||||
dominantBaseline="central"
|
dominantBaseline="central"
|
||||||
fontSize={initials.length > 1 ? 48 : 52}
|
fontSize="52"
|
||||||
fontWeight="500"
|
fontWeight="500"
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
import { useLocalParticipant } from '@livekit/components-react'
|
|
||||||
import { useEffect } from 'react'
|
|
||||||
|
|
||||||
export const MEDIA_STATE_ELEMENT_ID = 'media-state'
|
|
||||||
export const MEDIA_STATE_CHANGED_EVENT = 'media-state-changed'
|
|
||||||
|
|
||||||
export type MediaStateChangedDetail = {
|
|
||||||
microphoneEnabled: boolean
|
|
||||||
cameraEnabled: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exposes the local participant's media state in the DOM so external tools
|
|
||||||
* (e.g. bots automating the frontend) can reliably read the microphone and
|
|
||||||
* camera state, and watch for changes with a MutationObserver:
|
|
||||||
*
|
|
||||||
* const el = document.getElementById('media-state')
|
|
||||||
* new MutationObserver(...).observe(el, { attributes: true })
|
|
||||||
*/
|
|
||||||
export const MediaStateObserver = () => {
|
|
||||||
const { isMicrophoneEnabled, isCameraEnabled } = useLocalParticipant()
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
window.dispatchEvent(
|
|
||||||
new CustomEvent<MediaStateChangedDetail>(MEDIA_STATE_CHANGED_EVENT, {
|
|
||||||
detail: {
|
|
||||||
microphoneEnabled: isMicrophoneEnabled,
|
|
||||||
cameraEnabled: isCameraEnabled,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}, [isMicrophoneEnabled, isCameraEnabled])
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
id={MEDIA_STATE_ELEMENT_ID}
|
|
||||||
style={{ display: 'none' }}
|
|
||||||
data-microphone-enabled={isMicrophoneEnabled ? 'true' : 'false'}
|
|
||||||
data-camera-enabled={isCameraEnabled ? 'true' : 'false'}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -11,7 +11,6 @@ import { SidePanel } from '../components/SidePanel'
|
|||||||
import { RecordingProvider } from '@/features/recording'
|
import { RecordingProvider } from '@/features/recording'
|
||||||
import { ScreenShareErrorModal } from '../components/ScreenShareErrorModal'
|
import { ScreenShareErrorModal } from '../components/ScreenShareErrorModal'
|
||||||
import { ConnectionObserver } from '../components/ConnectionObserver'
|
import { ConnectionObserver } from '../components/ConnectionObserver'
|
||||||
import { MediaStateObserver } from '../components/MediaStateObserver'
|
|
||||||
import { RoomMetadataSynchronizer } from '../components/RoomMetadataSynchronizer'
|
import { RoomMetadataSynchronizer } from '../components/RoomMetadataSynchronizer'
|
||||||
import { useRoomPageTitle } from '../hooks/useRoomPageTitle'
|
import { useRoomPageTitle } from '../hooks/useRoomPageTitle'
|
||||||
import { useNoiseReduction } from '../hooks/useNoiseReduction'
|
import { useNoiseReduction } from '../hooks/useNoiseReduction'
|
||||||
@@ -64,7 +63,6 @@ export function VideoConference({ ...props }: VideoConferenceProps) {
|
|||||||
<>
|
<>
|
||||||
<RoomMetadataSynchronizer />
|
<RoomMetadataSynchronizer />
|
||||||
<ConnectionObserver />
|
<ConnectionObserver />
|
||||||
<MediaStateObserver />
|
|
||||||
<ChatProvider />
|
<ChatProvider />
|
||||||
<VideoResolutionSubscription />
|
<VideoResolutionSubscription />
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user