diff --git a/src/main/java/com/sparrowwallet/sparrow/control/WebcamScanDriver.java b/src/main/java/com/sparrowwallet/sparrow/control/WebcamScanDriver.java index ca25239a..e31b3f66 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/WebcamScanDriver.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/WebcamScanDriver.java @@ -8,15 +8,21 @@ import java.util.ArrayList; import java.util.List; public class WebcamScanDriver extends WebcamDefaultDriver { + private List foundScanDevices; + @Override public List getDevices() { - List devices = super.getDevices(); - List scanDevices = new ArrayList<>(); - for(WebcamDevice device : devices) { - WebcamDefaultDevice defaultDevice = (WebcamDefaultDevice)device; - scanDevices.add(new WebcamScanDevice(defaultDevice.getDeviceRef())); + if(foundScanDevices == null || foundScanDevices.isEmpty()) { + List devices = super.getDevices(); + List scanDevices = new ArrayList<>(); + for(WebcamDevice device : devices) { + WebcamDefaultDevice defaultDevice = (WebcamDefaultDevice)device; + scanDevices.add(new WebcamScanDevice(defaultDevice.getDeviceRef())); + } + + foundScanDevices = scanDevices; } - return scanDevices; + return foundScanDevices; } }