Studenlar bağlanınca default sessiz ve görüntü
This commit is contained in:
parent
f19a49b227
commit
55c9464c5e
3 changed files with 23 additions and 8 deletions
|
|
@ -27,16 +27,19 @@ public class ClassroomParticipant : FullAuditedEntity<Guid>
|
|||
Guid sessionId,
|
||||
Guid? userId,
|
||||
string userName,
|
||||
bool isTeacher
|
||||
bool isTeacher,
|
||||
bool isAudioMuted,
|
||||
bool isVideoMuted,
|
||||
bool isHandRaised
|
||||
) : base(id)
|
||||
{
|
||||
SessionId = sessionId;
|
||||
UserId = userId;
|
||||
UserName = userName;
|
||||
IsTeacher = isTeacher;
|
||||
IsAudioMuted = false;
|
||||
IsVideoMuted = false;
|
||||
IsHandRaised = false;
|
||||
IsAudioMuted = isAudioMuted;
|
||||
IsVideoMuted = isVideoMuted;
|
||||
IsHandRaised = isHandRaised;
|
||||
JoinTime = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging;
|
|||
using Volo.Abp.Guids;
|
||||
using Volo.Abp.Users;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Kurs.Platform.Classrooms;
|
||||
|
||||
|
|
@ -43,6 +44,15 @@ public class ClassroomHub : Hub
|
|||
[HubMethodName("JoinClass")]
|
||||
public async Task JoinClassAsync(Guid sessionId, Guid userId, string userName, bool isTeacher)
|
||||
{
|
||||
var classroom = await _classSessionRepository.GetAsync(sessionId);
|
||||
if (classroom == null)
|
||||
{
|
||||
await Clients.Caller.SendAsync("Error", "Classroom not found");
|
||||
return;
|
||||
}
|
||||
|
||||
var classroomSettings = JsonSerializer.Deserialize<ClassroomSettingsDto>(classroom.SettingsJson);
|
||||
|
||||
var participant = await _participantRepository.FirstOrDefaultAsync(
|
||||
x => x.SessionId == sessionId && x.UserId == userId
|
||||
);
|
||||
|
|
@ -54,13 +64,15 @@ public class ClassroomHub : Hub
|
|||
sessionId,
|
||||
userId,
|
||||
userName,
|
||||
isTeacher
|
||||
isTeacher,
|
||||
classroomSettings.DefaultMicrophoneState == "muted",
|
||||
classroomSettings.DefaultCameraState == "off",
|
||||
false
|
||||
);
|
||||
participant.UpdateConnectionId(Context.ConnectionId);
|
||||
await _participantRepository.InsertAsync(participant, autoSave: true);
|
||||
|
||||
// 🔑 Katılımcı sayısını güncelle
|
||||
var classroom = await _classSessionRepository.GetAsync(sessionId);
|
||||
var participantCount = await _participantRepository.CountAsync(x => x.SessionId == sessionId);
|
||||
classroom.ParticipantCount = participantCount;
|
||||
await _classSessionRepository.UpdateAsync(classroom, autoSave: true);
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ const RoomDetail: React.FC = () => {
|
|||
id: userId,
|
||||
name,
|
||||
isTeacher,
|
||||
isAudioMuted: classSettings.autoMuteNewParticipants,
|
||||
isAudioMuted: classSettings.defaultMicrophoneState === 'muted',
|
||||
isVideoMuted: classSettings.defaultCameraState === 'off',
|
||||
})
|
||||
}
|
||||
|
|
@ -315,7 +315,7 @@ const RoomDetail: React.FC = () => {
|
|||
id: participant.userId,
|
||||
name: participant.userName,
|
||||
isTeacher: participant.isTeacher,
|
||||
isAudioMuted: classSettings.autoMuteNewParticipants,
|
||||
isAudioMuted: classSettings.defaultMicrophoneState === 'muted',
|
||||
isVideoMuted: classSettings.defaultCameraState === 'off',
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue