# I want to show past scene which is few seconds ago in processing (capture cam)

**URL:** https://discourse.processing.org/t/i-want-to-show-past-scene-which-is-few-seconds-ago-in-processing-capture-cam/39235
**Category:** Libraries
**Created:** [October 12, 2022, 9:14pm UTC](https://discourse.processing.org/t/i-want-to-show-past-scene-which-is-few-seconds-ago-in-processing-capture-cam/39235 "2022-10-12T21:14:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![pushhand](https://avatars.discourse-cdn.com/v4/letter/p/4da419/32.png) [@pushhand](https://discourse.processing.org/u/pushhand)
#### Post date: [October 12, 2022, 9:14pm UTC](https://discourse.processing.org/t/i-want-to-show-past-scene-which-is-few-seconds-ago-in-processing-capture-cam/39235/1 "2022-10-12T21:14:59Z")

</div>

At first, I though that if I use ‘delay’, I can play the camera that shows 10 seconds past scene however, it just slow down the rate I think,  
Is there any code that make possible to show the scene which is ten seconds before…  
in other words, if I stare at video, that video must be showing the scene that is before 10seconds before than present time.

```auto
//import processing.video.*; 
//Capture cam; 
 
//void setup() { 
// size(500, 400); 
// cam = new Capture(this);
// cam.start(); 
// //delay(500);
 
//} 
 
//void draw() { 
// image(cam, 0, 0); 
//} 

//void captureEvent(Capture c) {
// c.read();
//}

```

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [October 12, 2022, 10:28pm UTC](https://discourse.processing.org/t/i-want-to-show-past-scene-which-is-few-seconds-ago-in-processing-capture-cam/39235/2 "2022-10-12T22:28:59Z")

</div>

Tricky

You want to store each image of the capture camera  
with a time stamp (millis() command) in an Arraylist.

Parallel you want to analyze the arraylist and display the images which time stamp is older than 10000 millis. And you want to delete the image.

You can make a class:

```auto
ArrayList<ImageWithTimeStamp> list = new ArrayList();

....
....

class ImageWithTimeStamp {

PImage img; 
int timeStamp=millis();

ImageWithTimeStamp(PImage img_) {
    img=img_;
}

void display() {
    image(img, 0,0);
} 

boolean isTenSeconds() {
    return 
       millis()-timeStamp>=10000; 
}

// I think that's all that's necessary for the class 

} // class
//

```

---

<div class="post-metadata">

### Author: ![pushhand](https://avatars.discourse-cdn.com/v4/letter/p/4da419/32.png) [@pushhand](https://discourse.processing.org/u/pushhand)
#### Post date: [October 16, 2022, 8:50am UTC](https://discourse.processing.org/t/i-want-to-show-past-scene-which-is-few-seconds-ago-in-processing-capture-cam/39235/4 "2022-10-16T08:50:02Z")

</div>

really appreciate for your solution, yet, I need interactive system…  
such as a security cam with showing the scene that is 10seconds before when people see the screen…
