Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RTC): add support for creating non-standard tracks #2409

Merged
merged 5 commits into from
Dec 12, 2023

Conversation

DanielMcAssey
Copy link
Contributor

@DanielMcAssey DanielMcAssey commented Dec 8, 2023

We have this manually patched into our copy of lib-jitsi-meet, but thought it might be worth sharing.

This change allows applications that use lib-jitsi-meet to manually create JitiLocalTracks from some track metadata and mediastream, similar to what the library does internally, but exposing it.

We use it to create a track for our Canvas, that we then add to the conference, similar to below:

    const canvasStream = myCanvas.captureStream(desktopShareFPS);
    const newTracks = JitsiMeetJS.createLocalTracksFromMediaStreams([
      {
        stream: canvasStream,
        sourceId: 'my:canvas',
        sourceType: 'canvas',
        track: canvasStream.getVideoTracks()[0],
        videoType: 'desktop'
      }
    ]);

This would possibly fix #1593

@jitsi-jenkins
Copy link

Hi, thanks for your contribution!
If you haven't already done so, could you please make sure you sign our CLA (https://jitsi.org/icla for individuals and https://jitsi.org/ccla for corporations)? We would unfortunately be unable to merge your patch unless we have that piece :(.

@saghul
Copy link
Member

saghul commented Dec 8, 2023

Yes! I have needed this myself too and was on my list of things, Good to see!

JitsiMeetJS.ts Outdated Show resolved Hide resolved
@DanielMcAssey DanielMcAssey requested a review from saghul December 8, 2023 16:47
JitsiMeetJS.ts Outdated Show resolved Hide resolved
Copy link
Member

@saghul saghul left a comment

Choose a reason for hiding this comment

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

LGTM with a question. Excellent work!

import { MediaType } from './service/RTC/MediaType';
import { JitsiTrackErrors } from './JitsiTrackErrors';

describe('JitsiMeetJS', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for this! ❤️

@@ -90,6 +91,13 @@ interface IJitsiMeetJSOptions {
}
}

interface ICreateLocalTrackFromMediaStreamOptions {
stream: MediaStream,
sourceType: string,
Copy link
Member

Choose a reason for hiding this comment

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

What is this used for, other than documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Purely documentation and typings for the function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or if you mean the sourceType, then it seems to be a way for client apps to determine the type of stream, e.g.

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha. We are planning to phase that one out, so I can take of it when the day comes. Thanks for checking!

@jallamsetty1
Copy link
Member

@DanielMcAssey Thanks for the PR. I will update the handbook.

@jallamsetty1 jallamsetty1 merged commit 8bee451 into jitsi:master Dec 12, 2023
1 check passed
@DanielMcAssey DanielMcAssey deleted the dev/expose-create-tracks branch December 12, 2023 15:41
subhamcyara pushed a commit to subhamcyara/lib-jitsi-meet that referenced this pull request Jul 19, 2024
* feat(RTC): add support for creating non-standard tracks

* fix(RTC): add additional checks for creating tracks via mediastream

* fix(RTC): simplify options to create track

* fix(RTC): fix tests

* fix(RTC): update sourceId documentation
subhamcyara pushed a commit to subhamcyara/lib-jitsi-meet that referenced this pull request Jul 19, 2024
* feat(RTC): add support for creating non-standard tracks

* fix(RTC): add additional checks for creating tracks via mediastream

* fix(RTC): simplify options to create track

* fix(RTC): fix tests

* fix(RTC): update sourceId documentation
subhamcyara pushed a commit to subhamcyara/lib-jitsi-meet that referenced this pull request Jul 19, 2024
* feat(RTC): add support for creating non-standard tracks

* fix(RTC): add additional checks for creating tracks via mediastream

* fix(RTC): simplify options to create track

* fix(RTC): fix tests

* fix(RTC): update sourceId documentation
subhamcyara pushed a commit to subhamcyara/lib-jitsi-meet that referenced this pull request Jul 19, 2024
* feat(RTC): add support for creating non-standard tracks

* fix(RTC): add additional checks for creating tracks via mediastream

* fix(RTC): simplify options to create track

* fix(RTC): fix tests

* fix(RTC): update sourceId documentation
subhamcyara pushed a commit to subhamcyara/lib-jitsi-meet that referenced this pull request Jul 19, 2024
* feat(RTC): add support for creating non-standard tracks

* fix(RTC): add additional checks for creating tracks via mediastream

* fix(RTC): simplify options to create track

* fix(RTC): fix tests

* fix(RTC): update sourceId documentation
subhamcyara pushed a commit to subhamcyara/lib-jitsi-meet that referenced this pull request Jul 19, 2024
* feat(RTC): add support for creating non-standard tracks

* fix(RTC): add additional checks for creating tracks via mediastream

* fix(RTC): simplify options to create track

* fix(RTC): fix tests

* fix(RTC): update sourceId documentation
subhamcyara pushed a commit to subhamcyara/lib-jitsi-meet that referenced this pull request Jul 19, 2024
* feat(RTC): add support for creating non-standard tracks

* fix(RTC): add additional checks for creating tracks via mediastream

* fix(RTC): simplify options to create track

* fix(RTC): fix tests

* fix(RTC): update sourceId documentation
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.

4 participants