Processing can't find built in camera

I’ve written the following code

<import processing.video.*;
//PImage unicorn;
Capture unicorn;

void setup(){
size(640,480);
unicorn=new Capture (this,640,480);
unicorn.start();
background(0);
}

void captureEvent(Capture video){
video.read();
}
void draw(){
for(int i=0; i<100; i++){
float x=random(width);
float y=random(height);
color c=unicorn.get(int(x),int(y));
fill©;
noStroke();
ellipse(x,y,16,16);
}
}>

And I get error ‘‘IllegalStateException: Could not find any devices
IllegalStateException: Could not find any devices
IllegalStateException: Could not find any devices
IllegalStateException: Could not find any devices’’

Hello !

First, don’t hesitate to format your code using the </> button when writing a message.

Secondly, try running this code (that should tell you available video devices). What is written in console ?

import processing.video.*;

void setup() {
  size(1280, 720);

  String[] cameras = Capture.list();

  if (cameras.length == 0) {
    println("There are no cameras available for capture.");
    exit();
  }
  else {
    println("Available cameras:");
    for (int i = 0; i < cameras.length; i++) println(cameras[i]);
  }
}

I ran the code you sent me and I get the ‘‘There are no cameras available for capture.’’. But I don’t understand why cause I have a built in web cam on my laptop.