Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1020888 // selectWebCam_withPreferred - saves preferred cam name & auto-selects it

JavaX fragment (include)

!include once #1013490 // sarxos webcam

static void selectWebCam_withPreferred(final VF1<Webcam> onSelect) {
  fL<Webcam> webcams = new L(Webcam.getWebcams());
  S preferred = trim(loadTextFile(preferredWebCamFile()));
  final Webcam cam = findWebCamByName(webcams, preferred);
  if (cam != null) awt { callF(onSelect, cam) }
  else selectWebCam(webcams, voidfunc(Webcam cam) {
    if (saveTextFileIfChanged(preferredWebCamFile(), cam.getName()))
      infoBox("Saved preferred web cam: " + cam.getName());
    callF(onSelect, cam);
  });
}

Author comment

Began life as a copy of #1013488

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020888
Snippet name: selectWebCam_withPreferred - saves preferred cam name & auto-selects it
Eternal ID of this version: #1020888/5
Text MD5: 12972737383990abbebaa08c7c7489ba
Author: stefan
Category: javax / chat
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-08 14:42:20
Source code size: 553 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 288 / 332
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)