Create JitsiLocalTracks without createLocalTracks

Hello everyone, new user here! I’ve been using lib-jitsi-meet for some weeks now.

I want to ask if there is a way I can create a JitsiLocalTrack from a MediaStreamTrack (and probably the relevant MediaStream) without createLocalTracks. I looked at the JitsiLocalTrack constructor but I noticed there are other properties which Jitsi uses on creation, such as the rtcId. Besides, I don’t think the JitsiLocalTrack constructor is exposed on lib-jitsi-meet.

Here’s why I’m asking:
I have a m3u8 playlist which is being played in an HTMLVideo tag, and I want to stream it over Jitsi. I got the MediaStream and MediaStreamTracks from it, but I couldn’t find a way to create JitsiLocalTracks from them without using createLocalTracks (which uses getUserMedia). So I monkey-patched gUM to return the MediaStream, but after buffering on playback, the video source changes and the track goes black, since it is no longer serving any content.

I tried re-creating the local tracks (calling createLocalTracks again) with the new source, but after many times doing that, I get a warning about too many event listeners being added and thus it being a possible memory leak. I find that weird since I’m replacing the old LocalTracks with the new ones (JitsiConference.replaceTrack), and I would guess that that would remove the relevant event listeners.

I’ve tried drawing every frame on a canvas and sending that stream to gUM, and it works, but it is slow. Thank you in advance.