summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2025-01-05 14:43:20 +0200
committerMaxim Devaev <[email protected]>2025-01-05 14:43:20 +0200
commita12163a7978fe2edf1649064e0b00694e315c84d (patch)
tree3b00054ead09abe739d2e4576ddae575fd6d66e0
parent43e6cd3e26fc80663cb74bc7d7b995aa435ec08d (diff)
kvmd-media: renamed kind to type
-rw-r--r--kvmd/apps/media/server.py10
-rw-r--r--web/share/js/kvm/stream_media.js2
2 files changed, 6 insertions, 6 deletions
diff --git a/kvmd/apps/media/server.py b/kvmd/apps/media/server.py
index 2763ffa0..1f96b353 100644
--- a/kvmd/apps/media/server.py
+++ b/kvmd/apps/media/server.py
@@ -45,7 +45,7 @@ from ...clients.streamer import BaseStreamerClient
# =====
@dataclasses.dataclass
class _Source:
- kind: str
+ type: str
fmt: str
streamer: BaseStreamerClient
meta: dict = dataclasses.field(default_factory=dict)
@@ -90,7 +90,7 @@ class MediaServer(HttpServer):
async with self._ws_session(req) as ws:
media: dict = {self.__K_VIDEO: {}}
for src in self.__srcs:
- media[src.kind][src.fmt] = src.meta
+ media[src.type][src.fmt] = src.meta
await ws.send_event("media", media)
return (await self._ws_loop(ws))
@@ -101,15 +101,15 @@ class MediaServer(HttpServer):
@exposed_ws("start")
async def __ws_start_handler(self, ws: WsSession, event: dict) -> None:
try:
- kind = str(event.get("kind"))
- fmt = str(event.get("format"))
+ req_type = str(event.get("type"))
+ req_fmt = str(event.get("format"))
except Exception:
return
src: (_Source | None) = None
for cand in self.__srcs:
if ws in cand.clients:
return # Don't allow any double streaming
- if (cand.kind, cand.fmt) == (kind, fmt):
+ if (cand.type, cand.fmt) == (req_type, req_fmt):
src = cand
if src:
client = _Client(ws, src, asyncio.Queue(self.__Q_SIZE))
diff --git a/web/share/js/kvm/stream_media.js b/web/share/js/kvm/stream_media.js
index ca269b53..fe34c136 100644
--- a/web/share/js/kvm/stream_media.js
+++ b/web/share/js/kvm/stream_media.js
@@ -220,7 +220,7 @@ export function MediaStreamer(__setActive, __setInactive, __setInfo) {
__ws.send(JSON.stringify({
"event_type": "start",
- "event": {"kind": "video", "format": "h264"},
+ "event": {"type": "video", "format": "h264"},
}));
};