Skip to content

Tracking subscribers of local tracks #503

@jon-mcmillan

Description

@jon-mcmillan

Summary

Looking for a way to learn which remote participants are currently subscribed to a local track from the Python SDK. I didn't find an event or API that exposes the subscriber list, so I can't automatically tear down unwatched streams.

Steps to Reproduce

  1. Publish a local video or audio track from a Python client .
  2. Have another participant subscribe to the track.
  3. Observe that local_track_subscribed doesn't tell us who subscribed to our local track.

Repo for reproduction: https://github.com/jon-mcmillan/livekit-subscription-events

Observed Behavior

I couldn't find any SDK call that returns the current subscriber list, which means I'd have to track subscriptions via events. However,

  • track_subscribed has the remote participant info, but it fires on the subscriber side, not the publisher side.
  • local_track_subscribed fires on the publisher side, but there's no remote participant argument.

Expected Behavior

Either an event or an API surface that lets me query the current subscribers for each local track so I can shut down streams when nobody is watching.

Use Case

Our publishers are robots streaming video; they need to conserve bandwidth, data, and compute by shutting off unused tracks as soon as there are no subscribers.

Version

livekit-api==1.0.5
livekit==1.0.13

Is there an existing way to retrieve current subscribers for a local track, or would this require a new API/event?

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