public static synchronized List < Webcam > getWebcams ( long timeout , TimeUnit tunit ) throws TimeoutException , WebcamException { if ( timeout < 0 ) { throw new IllegalArgumentException ( String . format ( "Timeout cannot be negative (%d)" , timeout ) ) ; } if ( tunit == null ) { throw new IllegalArgumentException ( "Time unit cannot be null!" ) ; } WebcamDiscoveryService discovery = getDiscoveryService ( ) ; assert discovery != null ; List < Webcam > webcams = discovery . getWebcams ( timeout , tunit ) ; if ( ! discovery . isRunning ( ) ) { discovery . start ( ) ; } return webcams ; }
Get list of webcams to use . This method will wait given time interval for webcam devices to be discovered .