Update environment configuration and enhance control features in WebRTC
- Changed VITE_API_URL and VITE_WEBRTC_URL in .env to point to local IP addresses. - Added react-hot-toast for user notifications in the application. - Integrated toast notifications for control acquisition in SessionPage. - Enhanced PixelStreamingWrapper and SessionUsersPanel to manage control states for participants. - Implemented grant and revoke control functionalities in the WebRTC service, allowing dynamic control management among users. - Updated various components to reflect control states and improve user experience during sessions.
This commit is contained in:
@@ -34,6 +34,9 @@ function SessionUsersPanel({
|
||||
updateSpeakingState,
|
||||
muteParticipant,
|
||||
disableParticipantVideo,
|
||||
grantControl,
|
||||
revokeControl,
|
||||
hasControl: localHasControl,
|
||||
currentUserId,
|
||||
} = useWebRTC(roomId, autoJoin);
|
||||
|
||||
@@ -212,13 +215,15 @@ function SessionUsersPanel({
|
||||
name="Вы"
|
||||
isMuted={isLocalAudioMuted}
|
||||
isVideoOff={isLocalVideoMuted}
|
||||
hasControl={false}
|
||||
hasControl={localHasControl}
|
||||
isAdmin={isLocalUserOrganizer}
|
||||
isLocal={true}
|
||||
mediaStream={localStream}
|
||||
onSpeakingChange={handleSpeakingChange}
|
||||
isLocalUserOrganizer={isLocalUserOrganizer}
|
||||
participantId={currentUserId}
|
||||
onGrantControl={grantControl}
|
||||
onRevokeControl={revokeControl}
|
||||
className={clsx(
|
||||
mode === "full" &&
|
||||
(activeCamerasCount <= 2
|
||||
@@ -249,7 +254,7 @@ function SessionUsersPanel({
|
||||
isMuted={participant.isMuted || false}
|
||||
isVideoOff={participant.isVideoOff || false}
|
||||
isSpeaking={participant.isSpeaking}
|
||||
hasControl={false}
|
||||
hasControl={participant.hasControl || false}
|
||||
isAdmin={isParticipantOrganizer(participant.id) || undefined}
|
||||
mediaStream={participant.stream}
|
||||
hasLocalMediaPermission={hasLocalStream}
|
||||
@@ -257,6 +262,8 @@ function SessionUsersPanel({
|
||||
participantId={participant.id}
|
||||
onMuteParticipant={muteParticipant}
|
||||
onDisableParticipantVideo={disableParticipantVideo}
|
||||
onGrantControl={grantControl}
|
||||
onRevokeControl={revokeControl}
|
||||
/>
|
||||
))}
|
||||
|
||||
@@ -267,6 +274,14 @@ function SessionUsersPanel({
|
||||
isAudioMuted={isLocalAudioMuted}
|
||||
isVideoMuted={isLocalVideoMuted}
|
||||
hasLocalStream={hasLocalStream}
|
||||
hasControl={localHasControl}
|
||||
onToggleControl={() => {
|
||||
// Организатор всегда может вернуть управление себе
|
||||
if (isLocalUserOrganizer) {
|
||||
revokeControl();
|
||||
}
|
||||
}}
|
||||
isOrganizer={isLocalUserOrganizer}
|
||||
/>
|
||||
</DraggableContainer>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user