Skip to content

Calls: a page for group and DM video calls, and a Call link in Messages - #2070

Closed
svaka2000 wants to merge 2 commits into
Open-Coding-Society:mainfrom
svaka2000:feat/calls-page
Closed

svaka2000 wants to merge 2 commits into
Open-Coding-Society:mainfrom
svaka2000:feat/calls-page

Conversation

@svaka2000

Copy link
Copy Markdown
Contributor

This is the page side of video calls: a call page for each group, DM and class, and a Call link in Messages. It uses the routes from spring#287, so that has to be merged and running before calls are turned on. Until then this changes nothing people see: calls are off in _config.yml, /calls/ only says they're off, nothing links to it, and /dm comes out exactly as it does now (a test checks that).

  • A group or DM in /dm gets a Call link in its header that opens /calls/?group=<id> or /calls/?dm=<id>. /calls/?course=csa opens a class's call.
  • The call page starts with a lobby where you see your camera and can turn your mic or camera off before you join. If there's no camera or mic, or you block them, you can still join to listen.
  • In the call, each person has a cell with their camera (or initials), their name and role, and Speaking, Muted or Paused. Up to four people get two big cells a row, and a bigger call gets the card grid's smaller cells. The chat and a People list are beside the call, and on a phone they go under it.
  • Students in a group can call each other without a teacher. A mentor (an account with ROLE_MENTOR) and a student are never in a call together without a teacher: whoever comes second waits in the lobby, which says it's waiting for a teacher, and goes in when one joins. If the last teacher leaves, the mentor is paused and the page says why.
  • Paused means no video or sound either way: they can't be seen or heard, and they can't see or hear anyone. A mentor paused because the teacher left goes back in when a teacher is back.
  • A teacher can pause, resume or remove someone from the People list (under Manage), or end the call for everyone. Remove and End ask first.
  • Spring decides all of this for groups, DMs and classes, and spring#287 has the tests for it. It also turns away anyone who isn't in the group, DM or class (teachers can join any call), and anyone a teacher removed, until that call ends.
  • While a call is on, the group's chat in /dm shows "A call is on with 3 in it" and a Join link. Spring sends a small callServer message on the chat's connection when a call starts or changes, and the line shows only after the page asks Spring and the call is live in that same group or DM.
  • It's a new system, _projects/systems/calls/, built only from the ocs__ grammar: the grid and its cells, video embeds, avatars, status pills, the viewer bar, the split layout and callouts. It has no Sass of its own, its words are in data/calls.yml, and its modules export classes.
  • The video goes through LiveKit, an open-source video server that runs next to Spring. It isn't running on the OCS servers yet; spring#287's docs/calls-deployment.md has the setup. Calls aren't recorded. Spring only keeps who was in each call and when, for 30 days. The page loads LiveKit's browser library (2.23.0) from cdnjs with its integrity hash, only on /calls/.
  • On a Flask-only site (spring: false) there's no Call link, and /calls/ just says calls are off without sending anything to Spring.
  • In Messages I only added the Call link, the "A call is on" line, and passing the callServer message to them (messages-model.js, thread.js, messages-page.js, dm.md), with tests.

A call with three people, the People list and the chat

A mentor waiting in the lobby for a teacher

The mentor paused after the teacher left

The call line in /dm

A call on a phone

How to try it:

  1. Run Spring from spring#287 with calls on and a local LiveKit server ("Local development" in its docs/calls-deployment.md).
  2. Turn calls on in _config.yml, then run make and sign in:
    calls:
      enabled: true
  3. Open a group in /dm, click Call, then Join. In another browser, sign in as someone else in the group and join too.
  4. To see the mentor rule, give a third account in the group ROLE_MENTOR (I added it in Spring's database) and join with it while only a student is in.
  5. Run node --test _projects/systems/calls/tests/*.test.mjs _projects/systems/messages/tests/*.test.mjs and bundle exec ruby scripts/test_calls_page.rb.

Other notes:

  • I tried it on my laptop against spring#287 and a LiveKit server with a teacher, a student and a mentor in Chrome: the mentor waiting and then going in, pausing and resuming, the mentor paused when the teacher left, ending the call, the line in /dm, and phone widths of 375 and 320 px. The most I had in a call at once was three. The screenshots are from a page I built locally with the site's stylesheet and this system's files, so the site header isn't in them.
  • Calls on an iPhone aren't tested yet, only the phone layout. WebKit (the engine Safari and every iPhone browser use) loads the page and handles a failed connection, but it couldn't connect to LiveKit on my laptop.
  • While a mentor waits, the console shows a 403 each time the lobby asks Spring again (about once a minute, or when someone joins or leaves). That's Spring's "wait" answer. When a teacher ends a call, LiveKit's library logs errors about its closed connection for the people still in it.
  • tests/csa_curriculum.test.mjs and tests/csa_capstone_objectives.test.mjs fail 6 tests on main too; that isn't from this PR.

- /calls/?group=, ?dm= and ?course= open that place's call through
  Spring's /api/calls (spring#287): a lobby with your camera, then a cell
  per person, a toolbar, and the group's chat and people beside it.
- Built from the OCS grammar only (ocs__grid--col2 or --card,
  ocs__embed--video, ocs__avatar, ocs__status-pill, ocs__viewer,
  ocs__split--aside-end), with every word in data/calls.yml.
- The safety rules show on the page: a mentor waits in the lobby until a
  teacher is in, and someone paused sees why.
- A teacher can pause, resume or remove someone, and end the call for
  everyone, each after a confirm.
- Messages gets a Call link in a group's or DM's header, and a line while
  a call is on there, shown only after Spring confirms it.
- Off by default: calls: enabled: false in _config.yml, and a
  spring: false site shows none of it.
- The lobby's Mic and Camera wait while a join is on its way, and a Join
  waits for every device the lobby is still asking for, so each one is
  either sent or stopped.
- While someone waits for a teacher, Join and the toggles stay usable,
  and pressing Join keeps a single watch on the room.
- The lobby's status line sits above the preview, where it is seen, and
  its no-devices line goes once a camera or microphone works.
- While you're paused, everyone else shows as initials instead of frozen
  video.
- A teacher's Manage stays open while people talk and come and go, and
  keyboard focus stays on it when the people list redraws: the list
  redraws only when what it shows changes.
- The sound button can be pressed again after a failed try.
- A device that doesn't come back after a pause is reported.
- A body that can't be read is a CallsApiError too.
- The fake LiveKit stops a paused person's tracks, as livekit-client does.
- The docs show the calls switch as `enabled: true` under `calls:`.
  Written on one line, `calls: enabled: true` isn't valid YAML.
- CallsApi drops its method for Spring's live-calls list, which
  nothing on the page used.
@jm1021

jm1021 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

We will wait until spring is deployed

@svaka2000

Copy link
Copy Markdown
Contributor Author

Combined into #2091 with the same commits.

@svaka2000 svaka2000 closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants