Rebinding an active LocalVideoTrack to a new DOM element without reacquiring the camera (Electron / Windows)

Hello Team,

We are building a Windows desktop application using Electron with an embedded web frontend powered by @zoom/videosdk (running in the Chromium renderer). To minimize startup latency before joining a session—especially given camera cold-start initialization times on Windows—we warm up the camera early in our pre-session flow, before the preview UI components have mounted, by calling LocalVideoTrack.start(target) against a detached (off-DOM) HTMLVideoElement.

Once our pre-session UI mounts or transitions between preview views (prior to joining the session), we want to bind that already-open camera capture to the newly mounted DOM element without re-acquiring the hardware device, as calling start() again triggers a full camera re-initialization and adds noticeable delay.

Current Limitation

Looking at LocalVideoTrack in the SDK typings (dist/types/preview.d.ts) and API reference, start() couples both camera acquisition and render-target binding into a single call. Unlike the in-session stream.attachVideo() and stream.detachVideo() APIs, LocalVideoTrack exposes no separate attach() / detach() or retargeting method.

Current Workaround

Currently, we transfer the underlying MediaStream directly (newElement.srcObject = detachedElement.srcObject), bypassing the SDK for the DOM rebinding. While this works for raw video in initial testing on Electron/Windows, we want to avoid relying on undocumented internals in production—especially since copying srcObject bypasses the video-player custom element / canvas rendering pipelines (which breaks virtual backgrounds and blur) and could interfere with the SDK’s internal cleanup lifecycle.

Questions / Feature Request

  1. Is there a supported way to rebind a running LocalVideoTrack to a different DOM element (HTMLVideoElement or video-player custom element) without calling start() and reacquiring the camera?

  2. Until a dedicated API exists, is there an officially recommended pattern for pre-warming LocalVideoTrack ahead of UI mount (e.g., creating and reparenting a single detached video-player / HTMLVideoElement in the DOM vs. reassigning srcObject)?

  3. Could decoupled attach() / detach() methods be considered for LocalVideoTrack to match the pattern already available for in-session video tracks? Pre-warming media before SPA views mount is a common requirement, and first-class support would make pre-session track lifecycle management much cleaner.

We are on v2.4.0 right now.

Thanks!

Hey @Niki_Jeavio

Thank you for the feedback. This is a great feature request, and it’s on our roadmap for an upcoming release.

Let me briefly describe what we plan to support: we will add a mediaTrack inject option to the startVideo method in session, so that video you acquire during the preview stage (before joining the session) can be used in session without being stopped first.

  1. Is there a supported way to rebind a running LocalVideoTrack to a different DOM element (HTMLVideoElement or video-player custom element) without calling start() and reacquiring the camera?

Currently there is no such option. A video created by LocalVideoTrack is only shown in the local preview. Only video captured through startVideo is published to remote participants.

  1. Until a dedicated API exists, is there an officially recommended pattern for pre-warming LocalVideoTrack ahead of UI mount (e.g., creating and reparenting a single detached video-player / HTMLVideoElement in the DOM vs. reassigning srcObject)?

There is currently no workaround.

  1. Could decoupled attach() / detach() methods be considered for LocalVideoTrack to match the pattern already available for in-session video tracks? Pre-warming media before SPA views mount is a common requirement, and first-class support would make pre-session track lifecycle management much cleaner.

The future implementation won’t work this way. We may provide a mediaTrack option to reuse the video from the preview stage.

Thanks
Vic