Skip to content

Конференция и устройства

Подключение к конференции и публикация устройств разделены. Сначала клиент входит в конференцию, затем создаёт локальные устройства через device_params, а сервер рассылает device_connect.

sequenceDiagram
    participant Client
    participant Control as CommandLoop
    participant Processor
    participant Conference
    participant Other as Other clients

    Client->>Control: connect_to_conference_request(tag, has_camera, has_microphone)
    Control->>Processor: request
    Processor->>Conference: add member / update state
    Processor-->>Client: connect_to_conference_response
    Processor-->>Client: existing device_connect events
    Processor-->>Other: member/device updates

    Client->>Client: start local capture
    Client->>Control: device_params(type, resolution, ssrc, metadata)
    Control->>Processor: create device
    Processor-->>Client: device_connect(my=1, author_ssrc, port, secure_key)
    Processor-->>Other: device_connect(my=0, receiver_ssrc, port, secure_key)

Local publish flow

flowchart TB
    Toggle[User toggles mic/cam/screen on]
    Capture[Start local capture]
    Params[Send device_params]
    Created[Receive device_connect my=1]
    Attach[Register author_ssrc in media transport]
    Encode[Encode Opus/VP8]
    Send[Send WSM media frames]

    Toggle --> Capture --> Params --> Created --> Attach --> Encode --> Send

Remote receive flow

flowchart TB
    Event[device_connect my=0]
    Session[Create MediaChannel]
    Register[Register receiver_ssrc in mux]
    Init[Send RTP init]
    Keyframe[Video: send ForceKeyFrame RTCP]
    Receive[Receive RTP frames by SSRC]
    Decode[Decode and render/play]

    Event --> Session --> Register --> Init --> Keyframe --> Receive --> Decode
    Init --> Receive

Device disconnect

sequenceDiagram
    participant Client
    participant Control
    participant Processor
    participant MediaMux

    Client->>Control: disconnect_device(device_id)
    Client->>MediaMux: unregister ssrc
    Control->>Processor: delete device
    Processor-->>Client: device_disconnect
    Processor-->>OtherClients: device_disconnect
    Note over MediaMux: shared media transport remains open

Moderation and device grants

Conference membership grants control whether the local client is allowed to publish or receive devices. The checks are done before creating local media devices, so a denied device should not reach device_params.

Relevant member grants:

Bit Name Effect
10 Presenter Owner/presenter role for the conference.
11 Speaker Participant currently has the floor.
12 Moderator Can moderate conference participants.
14 ReadOnly Participant cannot enable publishing devices.
15 Deaf Participant cannot receive/play conference audio.
16 DenyMicrophone Microphone publishing is blocked until this participant has Speaker.
17 DenyCamera Camera publishing is blocked until this participant has Speaker.

Relevant conference grants:

Bit Name Effect
0 DenyTurnSpeak Users cannot request the floor themselves.
1 DisableMicrophoneIfNoSpeak Microphone is available only while the member has Speaker.
2 DisableCameraIfNoSpeak Camera is available only while the member has Speaker.
7 DenyTurnMicrophone Microphone publishing is disabled by conference policy until the member has Speaker.
8 DenyTurnCamera Camera publishing is disabled by conference policy until the member has Speaker.

Client behavior:

  • ReadOnly and Deaf are hard member-level restrictions. UI controls must be disabled while these bits are set.
  • DenyMicrophone and DenyCamera block publishing only while the participant does not have Speaker. Once Speaker is granted, mic and camera controls become available without clearing the deny bits.
  • DisableMicrophoneIfNoSpeak and DisableCameraIfNoSpeak are floor-based restrictions. If the user does not have Speaker, the UI may offer want_speak.
  • DenyTurnMicrophone and DenyTurnCamera are conference-level listener-mode restrictions. They block publishing without creating a speaker request until Speaker is granted.
  • Moderators and presenters bypass floor-based restrictions, but ReadOnly still takes precedence.

When a moderator changes grants for an active participant, the server sends member updates and may also send TurnMicrophone, TurnCamera or TurnSpeaker actions to force already active devices down. Browser and native clients should update UI state from the member grants and treat the forced action as authoritative.

When Speaker is revoked, the server must force TurnMicrophone and/or TurnCamera if the resulting state makes the active device illegal again (ReadOnly, DenyMicrophone, DenyCamera, Disable*IfNoSpeak, or DenyTurn*). This keeps local capture state aligned with server-side media visibility.

Практические правила

  • device_id нужен для control lifecycle и UI.
  • author_ssrc используется для локальной отправки.
  • receiver_ssrc используется для remote receive и demux.
  • port указывает внутренний media endpoint на сервере/translator.
  • secure_key применяется на RTP payload level, а не на WebSocket session level.
  • A disabled mic/cam/speaker button is a protocol state, not just a local UI preference.