refactor(backend): rename mediacore package to media

This commit is contained in:
Gabriel20xx committed 2026-11-01 21:50:47 +01:00
1 parent e8cb7c6c68
commit 75c08beec6
34 files changed
+837 -656

No files matched your search

+7 -9
View File
@@ -1,9 +1,7 @@
// Package syncsocket is the media-backend family's cross-device playback-sync
// websocket hub: multiple clients viewing the same media session (identified
// by a caller-chosen sessionId) see each other's play/pause/seek/remote-control
// state live. Promoted unchanged from each service's own internal sync.go into
// this shared library so the 6 media-family backends that mount it (every one
// except KioskDisplay) use one copy instead of duplicating it.
// Package syncsocket is a cross-device playback-sync websocket hub: multiple clients viewing the
// same media session (identified by a caller-chosen sessionId) see each other's
// play/pause/seek/remote-control state live. It is shared so every project that offers live sync
// uses one copy instead of duplicating it.
//
// A service wires this up as:
//
@@ -12,7 +10,7 @@
// hub.ServeWebSocket(w, r, cfg.AllowedOrigin)
// })
//
// and mediacore's shared GET/PUT /sync HTTP routes call hub.HTTPState/
// and MountRoutes' GET/PUT /sync HTTP routes call hub.HTTPState/
// SetHTTPState/Broadcast to read and mutate the same session state the
// websocket peers see.
package syncsocket
@@ -204,7 +202,7 @@ func (h *Hub) stateLocked(sessionID string) map[string]any {
}
// HTTPState returns the current playback state for a session, as seen by the
// GET /sync HTTP endpoint (mounted by mediacore).
// GET /sync HTTP endpoint (mounted by MountRoutes).
func (h *Hub) HTTPState(sessionID string) map[string]any {
h.mu.Lock()
defer h.mu.Unlock()
@@ -212,7 +210,7 @@ func (h *Hub) HTTPState(sessionID string) map[string]any {
}
// SetHTTPState overwrites a session's playback state, as driven by the
// PUT /sync HTTP endpoint (mounted by mediacore) - callers should follow this
// PUT /sync HTTP endpoint (mounted by MountRoutes) - callers should follow this
// with Broadcast to notify connected websocket peers.
func (h *Hub) SetHTTPState(sessionID string, state map[string]any) {
h.mu.Lock()