This message was deleted.
# helpdesk
s
This message was deleted.
d
You'll need to publish the track by
Copy code
const tracks = await createLocalTracks({
  audio: true,
  video: true,
});
for (let i = 0; i < tracks.length; i++) {
	const track = tracks[i];
	await room.localParticipant.publishTrack(track);
}
aha! sorry I missed to read your full message. In that case you can manually create stream & later publish. https://docs.livekit.io/client-sdk-js/index.html#md:publish-tracks-from-any-source
s
cheers for the links, ok so we do have to manage our own localStream it looks like, livekit don’t seem to keep anything pre-publish
a
@straight-river-10244 what are you trying to do? are you trying to read the video data directly?
s
i need to kill the last stream once the user change device before publish
a
I don’t understand what you mean 😅 what’s the user flow you’re trying to handle? I can’t tell whether you’re describing a case where the user is already publishing or not
s
ok we have a preconnect device settings menu, which allow users to switch what mic/cam they wanna use, thats pre-publish, what i see so far is if we use the switchActiveDevice, the last mic/cam is kept opened, so i need to close those tracks
hope thats clear