fix xem nhieu video
All checks were successful
Deploy on Master Change / deploy (push) Successful in 47s

This commit is contained in:
2026-07-03 06:46:17 +07:00
parent b19bd7537e
commit 9a994da7f8
4 changed files with 649 additions and 2 deletions

View File

@@ -106,6 +106,11 @@ func (h *WsHub) Register(c *SocketClient) {
if c.Role == "student" {
h.students[c.StudentID] = c
log.Printf("[WS] Student %d registered (Address: %s, Class: %d)", c.StudentID, c.Addr, c.ClassID)
if subs, exists := h.subscribers[c.StudentID]; exists && len(subs) > 0 {
_ = c.Conn.WriteJSON(SocketMsg{Event: "start_screenshot_stream"})
_ = c.Conn.WriteJSON(SocketMsg{Event: "start_webcam_stream"})
log.Printf("[WS] Student %d has active subscribers. Sent start stream commands.", c.StudentID)
}
} else if c.Role == "teacher" {
h.teachers[c.Addr] = c
if c.StaffID > 0 {