Skip to content

Data tracks support#647

Draft
ladvoc wants to merge 7 commits intomainfrom
ladvoc/data-tracks
Draft

Data tracks support#647
ladvoc wants to merge 7 commits intomainfrom
ladvoc/data-tracks

Conversation

@ladvoc
Copy link
Copy Markdown
Contributor

@ladvoc ladvoc commented Apr 8, 2026

Resolves BOT-281

@ladvoc ladvoc requested a review from lukasIO April 8, 2026 01:23
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 8, 2026

⚠️ No Changeset found

Latest commit: 2fa4c32

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

* Unpublish the track from the SFU. Once this is called, any further calls to
* {@link tryPush} will fail.
*/
async unpublish(): Promise<void> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is async, do we need to await a dataTrackUnpublished response ?

*
* @throws {@link DataTrackPushFrameError} If the push fails.
*/
tryPush(frame: DataTrackFrame): void {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought(non-blocking): I left a similar comment on the JS implementation, it seems a bit counter-intuitive that a try* method can throw.
Although I don't know if there's a good alternative here. If users aren't expected to gain additional insight from the error's message maybe returning a "success" boolean from the method would be sufficient?

case 'eos': {
this.dispose();
if (event.detail.value.error) {
controller.error(new Error(event.detail.value.error));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion(non-blocking): maybe nice to have a more specific (tagged) error here

},
});

return new ReadableStream<DataTrackFrame>(new DataTrackStreamSource(res.stream!), {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: should we be worried about the fact that each subscribe call pushes the same frames across the FFI boundary each time?
Not sure if there's a good way to re-use an existing source.
We could also think about teeing the stream but that comes with it's own pitfalls when reading at different rates in different places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants