Skip to content

Show per-track role labels in VideoStreamCards #2730

Description

@oysand

Part of epic: equinor/isar-taurob#770

Goal

Show which camera each video card corresponds to, once a robot publishes multiple LiveKit tracks.

Where the label is actually lost

The card component already supports this. The name is discarded upstream, in two places:

  1. frontend/src/components/Contexts/MediaStreamContext.tsx:64

    room.on(RoomEvent.TrackSubscribed, (track) =>
      addTrackToConnection(track.mediaStreamTrack, config.robotId))

    Only track.mediaStreamTrack is retained. track.source, the publication's trackName, and every other identifying field are dropped here, so no label is available anywhere downstream.

  2. frontend/src/pages/MissionPage/VideoStream/VideoStreamWindow.tsx:25
    Passes videoStreamName={undefined} unconditionally.

  3. frontend/src/pages/MissionPage/VideoStream/VideoStreamCards.tsx:51
    Already renders the label when given one:

    {videoStreamName && <Typography variant="h5">{videoStreamName}</Typography>}

So this is a context-plumbing change, not a card change. The card is done.

Tasks

  • In MediaStreamContext.tsx, retain the track name (or source) alongside mediaStreamTrack when handling RoomEvent.TrackSubscribed, and carry it through the media-streams state.
  • In VideoStreamWindow.tsx, pass the real name through to videoStreamName instead of undefined.
  • Handle the empty/missing-name case gracefully — the existing conditional at VideoStreamCards.tsx:51 already degrades to today's behaviour.
  • (Optional) Surface a user-visible error or placeholder when room.connect() fails. The retry path (refreshRobotMediaConfig, lines 128-135) currently recovers silently, so a persistent failure is indistinguishable from "no video".

No backend change needed

Track names travel inside the LiveKit session, not through the MediaConfig contract. MediaConfig carries only url, token and media_connection_type (isar/src/robot_interface/models/robots/media.py:10-13, mirrored in backend/api/Services/Models/MediaConfig.cs). Nothing in ISAR or the Flotilla backend needs to change; the publisher sets the track name and livekit-client already receives it.

Testable without a Taurob robot

This no longer needs to wait for Taurob. equinor/isar-robot#388 adds a simulated publisher emitting several named tracks (front, back, left, right, arm) on the dev/staging isar-robot pods (equinor/robotics-infrastructure#1014). That is a complete test bed for this change.

Relevant because Taurob's Hercules is production-only, so waiting for it would mean this could only be verified in production.

Acceptance

  • Each video card shows its track role label.
  • Robots publishing a single unnamed track are unaffected.
  • (Optional) Failed connections show a non-blocking inline error rather than appearing as "no video".

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions