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)

1  
!include once #1013490 // sarxos webcam
2  
3  
static void selectWebCam_withPreferred(final VF1<Webcam> onSelect) {
4  
  fL<Webcam> webcams = new L(Webcam.getWebcams());
5  
  S preferred = trim(loadTextFile(preferredWebCamFile()));
6  
  final Webcam cam = findWebCamByName(webcams, preferred);
7  
  if (cam != null) awt { callF(onSelect, cam) }
8  
  else selectWebCam(webcams, voidfunc(Webcam cam) {
9  
    if (saveTextFileIfChanged(preferredWebCamFile(), cam.getName()))
10  
      infoBox("Saved preferred web cam: " + cam.getName());
11  
    callF(onSelect, cam);
12  
  });
13  
}

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: 289 / 333
Version history: 4 change(s)
Referenced in: [show references]