Skip to main content

stapel-video

CI coverage pypi downloads python license llms.txt

Video calls: rooms with shareable join codes, an access-level admission model (public / scope-trusted / restricted lobby) with a realtime waiting room over WebSockets, host admit/deny controls, join-token minting through a pluggable video-provider seam (LiveKit by default), a recording-egress seam (start/stop + a video.egress_ended event) that integrates with stapel-recordings by event and never by import, and a presence meter — per-connection spans fed by the media server's own join/leave webhooks, reconciled by a sweeper so a crashed client cannot bill forever, and read back as unioned presence time and a co-presence matrix for whatever prices them.

Part of the Stapel framework — composable Django apps that deploy as a monolith or as microservices without changing module code.

Install

pip install stapel-video

At a glance

Fact Value
Version 0.6.0
Python >=3.11 (3.11, 3.12, 3.13, 3.14)
HTTP operations 7
Config axes 3
Usage surface 25
Extension points 10
Error codes 49
Fleet dependencies stapel-auth (optional) · stapel-core · stapel-profiles (optional) · stapel-recordings (optional)

Documentation

OpenAPI · capabilities.json · llms.txt (for agents)

What this is

  • Rooms with human-shareable join codes (abc-defg-hij).
  • Admission modelpublic (anyone with the code joins), scope_trusted (members of the room's scope join instantly, others wait), restricted (everyone but the host waits in a lobby).
  • Realtime lobby over WebSockets (Channels) — waiting / admitted / denied, authenticated by the same Stapel JWT stack HTTP uses.
  • Host controls — admit / deny waiting guests.
  • Provider seam — one VideoProvider ABC (mint join token, create room, start/stop recording egress, verify webhook). Swap vendors without forking.
  • Recording is a seam, not a pipeline: start/stop_egress proxy the provider and a video.egress_ended comm event carries the storage key to stapel-recordings — by event, never by import.
  • Presence metering — per-connection spans fed by the media server's own join/leave webhooks (the only departure signal that survives a closed laptop), reconciled by a sweeper so a lost webhook cannot bill forever, and read back as unioned presence time and a co-presence matrix. Raw seconds, no threshold: this instance meters, whatever prices it decides what counts.

Alpha. See MODULE.md for the agent-facing map of seams.

Quick start

pip install stapel-video            # core library
pip install 'stapel-video[livekit]' # + the default LiveKit backend
pip install 'stapel-video[channels]'# + the realtime lobby (WebSockets)
# urls.py
path("video/", include("stapel_video.urls"))

# asgi.py (realtime lobby)
from channels.routing import ProtocolTypeRouter, URLRouter
from stapel_core.django.jwt.channels import JWTAuthMiddlewareStack
from stapel_video.routing import websocket_urlpatterns

application = ProtocolTypeRouter({
    "http": django_asgi_app,
    "websocket": JWTAuthMiddlewareStack(URLRouter(websocket_urlpatterns)),
})

API

Method Path What
POST /video/api/rooms Create a room (creator auto-admitted host, with a token)
GET /video/api/rooms/{join_code} Room info
POST /video/api/rooms/{join_code}/join Join → admitted / waiting / denied
GET /video/api/rooms/{join_code}/participants Participants (anchor-paginated)
POST /video/api/rooms/{join_code}/lobby/admit Admit a waiting guest (host-only)
POST /video/api/rooms/{join_code}/lobby/deny Deny a waiting guest (host-only)
POST /video/api/webhook Provider webhook ingress (signed, unauthenticated)

Configuration (STAPEL_VIDEO)

Key Default What
VIDEO_PROVIDER …livekit.LiveKitProvider Video backend (dotted path)
SCOPE_PROVIDER …scope.DefaultScopeProvider scope_key resolution + membership
DEFAULT_ACCESS_LEVEL restricted Access level for a room created without one
DEFAULT_ADMIT_REQUIRED True Whether new rooms start with the lobby on
LIVEKIT_URL / LIVEKIT_API_KEY / LIVEKIT_API_SECRET "" Default-provider credentials
WEBHOOK_HANDLERS {} Provider-event → handler, merged over the builtins
PRESENCE_SWEEP_INTERVAL_SECONDS 60 How often open presence spans are reconciled
PRESENCE_SPAN_RETENTION_DAYS 400 When a span is purged (None = never)

VIDEO_PROVIDER, DEFAULT_ACCESS_LEVEL and DEFAULT_ADMIT_REQUIRED are the three CTO-facing config axes surfaced in docs/capabilities.json.

Presence metering

Turn the provider's webhooks on (they point at POST /video/api/webhook), and schedule the two jobs — a meter without the sweeper measures an upper bound, not a duration:

from stapel_video.tasks import get_video_beat_schedule

CELERY_BEAT_SCHEDULE = {**get_video_beat_schedule(), ...}

Celery is optional: manage.py video_sweep_presence and manage.py video_purge_spans are the cron form. Then read the numbers by comm Function:

from stapel_core.comm import call

call("video.presence.aggregate", {"user_id": uid, "period": "2026-08"})
# {"presence_seconds": 5400, "rooms_count": 3, ...} — unioned, so a laptop
# and a phone are one person present, not two.

call("video.presence.pairs_export", {"period": "2026-08", "limit": 500})
# {"rows": [{"room_key", "user_a", "user_b", "co_presence_seconds"}, ...],
#  "cursor": ..., "total": None} — raw overlaps; the "counts as a real
#  conversation" threshold belongs to whoever asks, not to the meter.

License

MIT — see LICENSE.


This page is assembled by stapel-readme from docs/readme.md plus the contract artifacts in docs/. Edit the prose in docs/readme.md; the badges, facts and links above and below it are generated — do not hand-edit README.md.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stapel_video-0.6.0.tar.gz (113.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stapel_video-0.6.0-py3-none-any.whl (106.3 kB view details)

Uploaded Python 3

File details

Details for the file stapel_video-0.6.0.tar.gz.

File metadata

  • Download URL: stapel_video-0.6.0.tar.gz
  • Upload date:
  • Size: 113.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for stapel_video-0.6.0.tar.gz
Algorithm Hash digest
SHA256 c40b6a4bd994a4d1205b9b6af964c8a04f7e21d012e593fdb65d259fc2bf2870
MD5 5fc8e0705e971f4d9d254dff5fe148f7
BLAKE2b-256 e89fe00dfa4128f8d9283e2cf1bd78a88be440e871a0212fe4f0569a696675c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for stapel_video-0.6.0.tar.gz:

Publisher: publish.yml on usestapel/stapel-video

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stapel_video-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: stapel_video-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 106.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for stapel_video-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e9915b62e0fa81078408d57b6d2d77833dd86f0b335acc32979982b8e257490
MD5 2ab5842265f6a28b95332809545ca4c6
BLAKE2b-256 3cb8144fd6067888175fbc72e8203005ae277770778a4e3a6bedabd8633b0e27

See more details on using hashes here.

Provenance

The following attestation bundles were made for stapel_video-0.6.0-py3-none-any.whl:

Publisher: publish.yml on usestapel/stapel-video

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.11.2

2 files

0.11.1

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

This release

0.6.0 This release

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page