Files
Дамян Минков ab58977caf fix(recording): preselect a storage service that is actually offered (#17877)
* fix(recording): preselect a storage service that is actually offered

The record & transcribe dialog computed its default storage service
without the constraints the storage selector applies: while a live
stream runs, or without the recording JWT feature, the file recordings
service and Dropbox are not offered. With the recording service enabled
the default stayed recording-service while the selector showed local
recording (the first option), so pressing Start started a Jibri file
recording instead of the local one the user saw.

Compute the offered services in one helper used by both the dialog and
its content, pick the default among them, and recompute it whenever the
selection stops being offered while no recording runs (e.g. a live
stream starts while the dialog is open).

Starting transcription on its own no longer depends on the storage
selection: it always goes through setRequestingSubtitles. Previously it
only did so when the recording service was selected, which is what kept
transcription working during a live stream; with local recording now
preselected there it would have only written the room metadata.

Follow-up to #17732.

* fix(recording): only request recording in metadata for a file recording

Starting transcription on its own passed isRecordingRequested=true
whenever any recording ran, including a local one. A local recording is
never announced through the room metadata, so remote participants saw
isRecordingRequested flip to true, waited for a file recording session
that never came, and never showed the transcription start notification.

Set it only when a file recording is started or already active.

* feat(recording): disable starting transcription while subtitles are transcribed

When a transcriber is in the meeting only for the subtitles, a recorder
transcription cannot be started on top of it: the dialog still offered
Start transcription, but nothing happened. Disable it, and the start
both button, in that case, with a tooltip on web saying transcription is
already on, and do not start transcription along with the recording when
auto transcribe on record is on.

* fix(recording): announce recording started from the suggestion notification

With autoTranscribeOnRecord, starting the recording from the suggestion
notification requested the subtitles without forcing the metadata
update, so the room metadata was only written with async transcription
on. Without it, and whenever a transcriber was already in the meeting,
remote participants got no recording start notification.

Force the metadata update like the dialog and the external API do, only
auto transcribe when no transcriber is in the meeting yet, and keep a
running transcription in the metadata when only recording is announced.

* test(recording): cover the dialog during a live stream and with a subtitles transcriber

- local recording is preselected while a live stream runs, including
  when the live stream starts while the dialog is open;
- Start transcription and Start both are disabled, with a tooltip,
  while a transcriber is in the meeting only for the subtitles;
- starting transcription during a local recording does not set
  isRecordingRequested in the room metadata a remote participant sees.

* test(recording): wait for the tooltip text, not just the tooltip element

The tooltip fades in: it is in the DOM before it is visible, and
getText() returns an empty string for it until then.

* fix(recording): clear the transcription flag when inviting the transcriber fails

When starting transcription, the recording room metadata gets
isTranscribingEnabled before the transcriber is invited. If inviting it
failed the flag stayed set, so remote participants kept waiting for the
transcription and never got the notification about a recording started
along with it.

Clear the flag on failure, keeping the rest of the recording metadata.
On the receiving side, the flag cleared with no transcriber in the
meeting is a failed start rather than a stop: stop waiting for the
transcription, so the recording start is still notified, and do not
notify a transcription stop.

* test(recording): cover a failed transcriber invite when starting recording and transcription

The transcription flag is cleared while the recording stays requested,
and the remote participant stops waiting for the transcription and gets
the recording-only start notification once the file recording is on.

* test(recording): wait for Start both to be enabled

The dialog keeps it disabled while validating the Dropbox token, on
deployments with Dropbox enabled.

* fix(subtitles): clear the transcription flag without waiting for the metadata echo

When inviting the transcriber fails before the server has echoed back
the metadata update requesting it, the local copy of the metadata does
not have isTranscribingEnabled set yet, so the flag was not cleared.
Re-apply what the request wrote instead: isRecordingRequested when a
recording was requested along with it, and isTranscribingEnabled off.

* fix(recording): do not validate an empty Dropbox token

mapStateToProps maps a missing Dropbox token to '', so the dialog
validated it against the Dropbox API on every open, which fails, and
kept the start buttons disabled until the request came back.

* fix(recording): notify a transcription stop when the transcriber left first

The recording metadata listener treated the transcription flag cleared
with no transcriber in the meeting as a failed start. A normal stop can
also look like that, when TRANSCRIBER_LEFT arrives before the metadata
update, and its stop notification was then suppressed.

Only treat it as a failed start while a start is still waiting for the
transcription, or after inviting the transcriber failed on this client.

* fix(subtitles): clear the transcription flag from the latest metadata

After a failed transcriber invite, the error handler re-applied the
recording request it was made with, so a recording stopped while the
invite was pending was requested again.

Build the update from the latest metadata instead, only turning
isTranscribingEnabled off. When the metadata update requesting the
transcription has not been echoed back yet, wait for that echo first.

* test(recording): cover a cancelled recording and a stop after the transcriber left

- a failed transcriber invite does not restore a recording request
  cancelled while the invite was pending;
- a transcription stop is notified when the transcriber left before the
  transcription flag was cleared.

* fix(recording): stop waiting for a recording cancelled before it started

When the recording request was withdrawn before any file recording
session existed, e.g. stopped while the transcriber invite was pending,
remote participants kept a start intent waiting for that recording, and
a later start would not be announced correctly. They also notified a
stop for a recording that never started.

Treat it like a failed transcription start: drop the recording from the
pending start, and do not notify a recording stop.

* test(recording): check a cancelled recording leaves nothing pending

The remote participant stops waiting for the recording and notifies no
recording stop.

* test(recording): wait for the previous test's recording stopped notification to go away

The previous test's cleanup stops its fake recording, which the remote
participant notifies. That notification was still shown when the check
that a cancelled recording notifies no stop ran.

* test(recording): skip the transcriber invite failure tests with async transcription

With async transcription the client does not invite the transcriber
itself, so there is no invite that can fail.

* refactor(recording): decide auto transcription on record in one place

shouldAutoTranscribeOnRecord() now also answers no while a transcriber is in
the meeting, for the subtitles or for a running transcription, since it cannot
be started again. The suggestion notification and the dialog no longer repeat
that check with their own formulas.

* refactor(recording): decide the dialog state in a single model

getRecordingDialogModel() in dialogModel.ts now computes everything the
recording & transcription dialog decides, from the redux facts and the
dialog's own state: the services offered and the one selected, whether each
section and the footer are shown, what is running, whether each start button
is enabled and why not (a blocker, which the web content turns into a
tooltip when there is an explanation for the user).

The dialog builds the model and applies it in its handlers, the content
renders it. The content no longer derives any of those decisions from redux
on its own, so the dialog and its content cannot disagree, and the web and
native contents no longer repeat the start-both and start-transcription
rules.

* fix(recording): invite the transcriber when starting it with a local or Dropbox recording

Starting transcription along with a local or a Dropbox recording only wrote
isTranscribingEnabled to the room metadata: nothing requested the
transcriber, so remote participants waited for a transcription that never
came. Requesting the subtitles now invites it whatever recording starts with
it, and writes the metadata the same way for every storage service.

A local recording also no longer seeds the start intent: it is not a file
recording session, the coordinator could never resolve it, and the local
recording middleware notifies about it on its own.

* fix(recording): sign out of Dropbox only when the user picks another service

The content signed out whenever the selected service moved away from Dropbox,
including when the dialog re-picked it on its own because the services offered
changed (a live stream started, another moderator started a session). A signed
in user lost the stored token without touching anything. The sign-out now
happens in the service change handler, with the user's choice.

* fix(recording): do not block Start both on a running transcription's reason

With a recorder transcription running and end-to-end encryption turned on
meanwhile, Start both only starts the recording, yet it was disabled with the
E2EE reason. A transcription blocker now only counts while no transcription
runs, as the recording one already did.

* fix(subtitles): clear the transcription flag reliably after a failed invite

Waiting for the echo of the metadata update compared the local copy by
identity, so any other metadata update arriving first ended the wait on a copy
without the flag, and the echo then left it set. The wait now ends when the
flag shows up in the local copy, whatever arrives before it, and when nothing
sets it in time the flag is cleared anyway instead of staying set for the
remote participants.

* fix(recording): do not take a stop for a cancelled start after the session was on

A recording request withdrawn with a start intent still pending and no active
file session counted as a start cancelled before it began, which silenced the
stop notification. A start intent can stay pending after the session was on,
e.g. while waiting for an initiator jicofo never delivers, and the session's
off update can arrive before the metadata update: a real stop then went
unnoticed. The intent now records that its session was seen on, and only a
start without that counts as cancelled.

* docs(recording): describe the service kept while a recording runs accurately

The selection kept while a recording runs is the service whose options are
shown, not necessarily the one recording: the dialog opens on the default
service whatever runs, as it did before.

* refactor(recording): take the auto transcription decision from the selector alone

The model repeated the conditions shouldAutoTranscribeOnRecord() already
folds in, so a change to the selector would have silently diverged from the
dialog.

* refactor(recording): validate the Dropbox token unconditionally on mount

mapStateToProps maps a missing token to '', and _onTokenUpdated() handles
that itself, so the undefined check on mount was dead and read as if an
undefined token were a real state.

* test(recording): join once per live stream describe and scope the tooltip lookup

Every test of the live stream describe rejoined the conference its setup had
already joined; the fake live stream is now ended after each test instead,
with no side effect. The tooltip lookup matched any popover on the page; it
now looks for the one repeating the button's description.

* docs(recording): describe the live stream spec's config and support flag

The inner functions of the subtitles middleware got theirs along with the
rewrite of the metadata echo wait.

* fix(subtitles): clear the transcription flag from what the participant asked for

After a failed transcriber invite the flag was cleared from the local copy of
the room metadata, which only reflects a write once the server echoed it back.
Depending on the timing of that echo the clear either waited for the flag to
show up, and then cleared the next transcription started within ten seconds,
or restored a recording request the participant had withdrawn meanwhile.

The clear now happens at once, with isRecordingRequested taken from the redux
state: a file recording on or requested and not stopped since. The server
applies the updates in order, so it lands after the request whether or not
the echo arrived.

* fix(recording): keep recordingStarted when a failed transcription rewrites the intent

Rewriting the start intent after a failed transcriber invite dropped the
recordingStarted flag, so a recording whose session was already on looked
like one that never started: a later stop whose off update arrived before the
metadata echo was then taken for a cancelled start and went unnoticed.

* refactor(recording): move the dialog model into functions.ts

The dialog model, its facts and blockers now live with the other recording
selectors instead of in a file of their own next to the dialog components.
2026-11-06 16:28:12 -06:00
..
2025-01-10 20:09:11 +01:00