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 sessionId,
|
||||||
Guid? userId,
|
Guid? userId,
|
||||||
string userName,
|
string userName,
|
||||||
bool isTeacher
|
bool isTeacher,
|
||||||
|
bool isAudioMuted,
|
||||||
|
bool isVideoMuted,
|
||||||
|
bool isHandRaised
|
||||||
) : base(id)
|
) : base(id)
|
||||||
{
|
{
|
||||||
SessionId = sessionId;
|
SessionId = sessionId;
|
||||||
UserId = userId;
|
UserId = userId;
|
||||||
UserName = userName;
|
UserName = userName;
|
||||||
IsTeacher = isTeacher;
|
IsTeacher = isTeacher;
|
||||||
IsAudioMuted = false;
|
IsAudioMuted = isAudioMuted;
|
||||||
IsVideoMuted = false;
|
IsVideoMuted = isVideoMuted;
|
||||||
IsHandRaised = false;
|
IsHandRaised = isHandRaised;
|
||||||
JoinTime = DateTime.UtcNow;
|
JoinTime = DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging;
|
||||||
using Volo.Abp.Guids;
|
using Volo.Abp.Guids;
|
||||||
using Volo.Abp.Users;
|
using Volo.Abp.Users;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace Kurs.Platform.Classrooms;
|
namespace Kurs.Platform.Classrooms;
|
||||||
|
|
||||||
|
|
@ -43,6 +44,15 @@ public class ClassroomHub : Hub
|
||||||
[HubMethodName("JoinClass")]
|
[HubMethodName("JoinClass")]
|
||||||
public async Task JoinClassAsync(Guid sessionId, Guid userId, string userName, bool isTeacher)
|
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(
|
var participant = await _participantRepository.FirstOrDefaultAsync(
|
||||||
x => x.SessionId == sessionId && x.UserId == userId
|
x => x.SessionId == sessionId && x.UserId == userId
|
||||||
);
|
);
|
||||||
|
|
@ -54,13 +64,15 @@ public class ClassroomHub : Hub
|
||||||
sessionId,
|
sessionId,
|
||||||
userId,
|
userId,
|
||||||
userName,
|
userName,
|
||||||
isTeacher
|
isTeacher,
|
||||||
|
classroomSettings.DefaultMicrophoneState == "muted",
|
||||||
|
classroomSettings.DefaultCameraState == "off",
|
||||||
|
false
|
||||||
);
|
);
|
||||||
participant.UpdateConnectionId(Context.ConnectionId);
|
participant.UpdateConnectionId(Context.ConnectionId);
|
||||||
await _participantRepository.InsertAsync(participant, autoSave: true);
|
await _participantRepository.InsertAsync(participant, autoSave: true);
|
||||||
|
|
||||||
// 🔑 Katılımcı sayısını güncelle
|
// 🔑 Katılımcı sayısını güncelle
|
||||||
var classroom = await _classSessionRepository.GetAsync(sessionId);
|
|
||||||
var participantCount = await _participantRepository.CountAsync(x => x.SessionId == sessionId);
|
var participantCount = await _participantRepository.CountAsync(x => x.SessionId == sessionId);
|
||||||
classroom.ParticipantCount = participantCount;
|
classroom.ParticipantCount = participantCount;
|
||||||
await _classSessionRepository.UpdateAsync(classroom, autoSave: true);
|
await _classSessionRepository.UpdateAsync(classroom, autoSave: true);
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@ const RoomDetail: React.FC = () => {
|
||||||
id: userId,
|
id: userId,
|
||||||
name,
|
name,
|
||||||
isTeacher,
|
isTeacher,
|
||||||
isAudioMuted: classSettings.autoMuteNewParticipants,
|
isAudioMuted: classSettings.defaultMicrophoneState === 'muted',
|
||||||
isVideoMuted: classSettings.defaultCameraState === 'off',
|
isVideoMuted: classSettings.defaultCameraState === 'off',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -315,7 +315,7 @@ const RoomDetail: React.FC = () => {
|
||||||
id: participant.userId,
|
id: participant.userId,
|
||||||
name: participant.userName,
|
name: participant.userName,
|
||||||
isTeacher: participant.isTeacher,
|
isTeacher: participant.isTeacher,
|
||||||
isAudioMuted: classSettings.autoMuteNewParticipants,
|
isAudioMuted: classSettings.defaultMicrophoneState === 'muted',
|
||||||
isVideoMuted: classSettings.defaultCameraState === 'off',
|
isVideoMuted: classSettings.defaultCameraState === 'off',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue