Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How I Embed Imou Camera Video in a SaaS App

Описание и применение

Внедрение безопасного, изолированного по арендаторам видео из камер Imou в SaaS: схема, эндпоинты, контроль доступа, управление возможностями и наблюдаемость.

Задача

Integrating third‑party camera streams into a multi‑tenant SaaS while ensuring tenant isolation, secure access, and graceful handling of device capabilities.

Результат

Implemented a secure, tenant‑aware camera embed that prevents cross‑tenant leaks, gates features by capability, and provides observability and testing coverage.

Рабочий процесс

  • Define camera schema with unique (tenant_id, external_id) mapping.
  • Create POST /tenants/:tid/sites/:sid/cameras/:cid/live endpoint that validates tenant and site access.
  • Open Cloud Live stream via gateway, return short‑lived handle to browser.
  • Mount player with handle; destroy on leaveSite or tenant switch.
  • Gate UI controls (PTZ, talk, screenshot, playback) based on camera capabilities.
  • Implement revocation logic: heartbeat remint only after ACL, fail on role revoke.
  • Add observability events (saas_embed_start|stop|fail) with tenant, site, camera, error class.
  • Write cross‑tenant tests: denied access, rebind handling, role revoke, overnight tab resume, capability flags, no public livestream.
  • Deploy gateway exposing only listBySite, openLive, command; keep vendor SDKs out of monolith.
  • Monitor first‑frame latency distribution per device and subscription.

Доказательства

Cameras map to tenant_id and site_id I already authorize.

Источник

I do not ship a public unauthenticated livestream.

Источник

I store handles only in page memory. Redis of live handles becomes a second auth system.

Источник

  • Дата записи: 2026-09-22T05:15:21.999Z