Skip to content

feature: expose public RemoteTrackPublication.setVideoQuality method #670

Description

@richtodd

Context: subscribers using @livekit/rtc-node server-side need to request a specific simulcast layer for a RemoteTrackPublication. The Rust FFI supports this via SetRemoteTrackPublicationQualityRequest, but the JS-side RemoteTrackPublication class does not expose a public method to invoke it.

Current workaround (broken): reaching into the @internal ffiHandle and dispatching livekitFfiRequest directly:

import { FfiRequest, SetRemoteTrackPublicationQualityRequest, VideoQuality, livekitFfiRequest } from "@livekit/rtc-ffi-bindings";

const handle = (pub as unknown as { ffiHandle: { handle: bigint } }).ffiHandle.handle;
const req = new FfiRequest({
  message: {
    case: "setRemoteTrackPublicationQuality",
    value: new SetRemoteTrackPublicationQualityRequest({ trackPublicationHandle: handle, quality: VideoQuality.HIGH }),
  },
});
livekitFfiRequest(req.toBinary());

This throws at runtime: failed to handle request: invalid request: handle not found. The handle from pub.ffiHandle.handle does not match what the Rust handler expects in the publication-handle HashMap.

Request: expose a public method RemoteTrackPublication.setVideoQuality(quality: VideoQuality) that performs the correct FFI dispatch using the right handle. Mirror what Room.LocalParticipant and similar classes already expose.

Use case: hidden server-side subscribers (recorders, transcoders, RTMP republishers) need to request HIGH simulcast layer for downstream encoding instead of accepting LiveKit's default LOW.

Workaround until landed: publish only the high simulcast layer from publishers (disable simulcast). Acceptable for single-subscriber recorder setups; not ideal for multi-bitrate fan-out.

Affected version: @livekit/[email protected] + @livekit/[email protected]
Platform: Cloud Run Linux x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions