Skip to content

Join Flow

This document specifies how a Proctor joins a Sentinel’s video stream.

Overview

When a Proctor wants to view a Sentinel’s screen, it must:

  1. Request to join the stream
  2. Receive the initialization segment
  3. Receive a join fragment (IDR entry point)
  4. Continue receiving live fragments

See Terminology for the distinction between fragments (live delivery units) and join fragments (keyframe entry points).

Join Flow Diagram

Step-by-Step

Proctor Sends Join Request

The Proctor sends a message over WebSocket requesting to join a specific Sentinel’s stream.

Required fields:

FieldTypeDescription
sentinelIdstringThe Sentinel to subscribe to

Optional fields:

FieldTypeDescription
startFromstring"oldest" (default) or "latest"

Server Validates and Looks Up

The Server:

  • Validates the Proctor is authorized to view the Sentinel
  • Checks if the Sentinel is currently streaming
  • Locates the session data in memory

If the Sentinel is not streaming, the Server responds with an error.

Server Sends Initialization Segment

The Server sends the cached initialization segment for the Sentinel’s current session.

Required fields:

FieldTypeDescription
sentinelIdstringIdentifies the stream
sessionIdstringCurrent session identifier
databytesRaw fMP4 initialization segment

Server Sends Join Fragment

The Server selects a join fragment from the memory buffer and sends it.

Selection strategy:

startFromJoin Fragment Selected
"oldest"Oldest join fragment in buffer (maximum catch-up time)
"latest"Most recent join fragment (lowest latency)

The selected fragment is guaranteed to start with an IDR keyframe (join fragment).

Required fields:

FieldTypeDescription
sentinelIdstringIdentifies the stream
sequenceintegerFragment sequence number
databytesRaw fMP4 fragment (moof + mdat)

Server Continues Pushing Fragments

From this point, the Server pushes new fragments to the Proctor as they arrive from the Sentinel.

Server-Initiated Keyframe for Fast Join

If a Proctor joins and there is no recent join fragment in the buffer, the Server requests an on-demand keyframe from the Sentinel.

See Control Messages for the keyframe request flow.

With a server-initiated keyframe:

Instant Preview (UX Strategy)

For carousel-style switching, the Proctor can join the next stream ~5 seconds early so video is already flowing before the user switches.

This is a UX optimization only. It does not introduce new protocol messages or change Server behavior.

Switching Streams

When a Proctor switches from one Sentinel to another:

Unsubscribe from Current Stream

Proctor notifies Server to stop sending fragments for the current Sentinel.

Join New Stream

Follow the standard join flow for the new Sentinel.

Reset MSE Buffer

In the browser, the Proctor must:

  • Clear the existing SourceBuffer
  • Append the new initialization segment
  • Begin appending fragments from the new stream

Error Handling

ConditionServer Response
Sentinel not foundError: unknown Sentinel
Sentinel not streamingError: Sentinel offline
Authorization failureError: not authorized
No join fragment in bufferSend initialization segment, request/await next join fragment

Latency Considerations

FactorImpact on Join Latency
Buffer has join fragmentsImmediate join (send from buffer)
Server requests keyframeWait for next capture cycle
No join fragment availableUp to max keyframe interval (20-30s) unless server requests a keyframe

For lowest latency joins:

  1. Use startFrom: "latest"
  2. Keep recent join fragments in memory
“20-30 seconds” is the maximum keyframe interval (join fragment spacing). Live video is still delivered continuously as fragments.
Last updated on • J.H.F.