chooseDesktopMedia method

int chooseDesktopMedia(
  1. List<DesktopCaptureSourceType> sources,
  2. Tab? targetTab,
  3. ChooseDesktopMediaOptions? options,
  4. JSFunction callback,
)

Shows desktop media picker UI with the specified set of sources. sources Set of sources that should be shown to the user. The sources order in the set decides the tab order in the picker. targetTab Optional tab for which the stream is created. If not specified then the resulting stream can be used only by the calling extension. The stream can only be used by frames in the given tab whose security origin matches tab.url. The tab's origin must be a secure origin, e.g. HTTPS. options Mirrors members of DisplayMediaStreamConstraints which need to be applied before the user makes their selection, and must therefore be provided to chooseDesktopMedia() rather than be deferred to getUserMedia(). returns An id that can be passed to cancelChooseDesktopMedia() in case the prompt need to be canceled.

Implementation

int chooseDesktopMedia(
  List<DesktopCaptureSourceType> sources,
  Tab? targetTab,
  ChooseDesktopMediaOptions? options,
  JSFunction callback,
) {
  return $js.chrome.desktopCapture.chooseDesktopMedia(
    sources.toJSArray((e) => e.toJS),
    targetTab?.toJS,
    options?.toJS,
    callback,
  );
}