# Video does not show up when object oriented code runs

**URL:** <https://discourse.processing.org/t/video-does-not-show-up-when-object-oriented-code-runs/2976>\
**Category:** Coding Questions\
**Created:** [August 25, 2018, 10:19pm UTC](https://discourse.processing.org/t/video-does-not-show-up-when-object-oriented-code-runs/2976 "2018-08-25T22:19:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tefa](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tefa/32/1181_2.png) [@tefa](https://discourse.processing.org/u/tefa)\
**Post date:** [August 25, 2018, 10:19pm UTC](https://discourse.processing.org/t/video-does-not-show-up-when-object-oriented-code-runs/2976/1 "2018-08-25T22:19:13Z")

</div>

Hello Processors, thank you for your time. I made an object using another object called Movie, so that two videos appear floating upwards and stay in the top. The code runs but only the white background appears.

```auto
import processing.video.*;
Movie myMovie;
Video v1;
Video v2; 

void setup() {
  size(640, 360);
  myMovie = new Movie(this, "fogata.mp4");
  myMovie.loop();
  v1 = new Video(74);
  v2 = new Video(26);// this is calling the constructor
}

void draw() {
  background(255);
  v1.display();
  v1.ascend();
  v1.top();
  
  v2.display();
  v2.ascend();
  v2.top();
}

class Video {

  //data
  float x;
  float y;
  float size;

  Video(float tempD) {//here is where initialization starts
    x = width/2;
    y = height;
    size = tempD;

  }
  void ascend() {
    y--;
    x = x + random(-1, 1);
  }

  void top() {
    if (y < size/2) {
      y = size/2;
    }
  }
  
  //functuality: function definitions
  void display() {
    image(myMovie, x, y, size, size);
  }
}

```

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [August 25, 2018, 10:22pm UTC](https://discourse.processing.org/t/video-does-not-show-up-when-object-oriented-code-runs/2976/2 "2018-08-25T22:22:17Z")

</div>

I’m not an expert on the video library, but don’t you need to read the video as it plays? Something like this:

```auto
void movieEvent(Movie m) {
  m.read();
}

```

---

<div class="post-metadata">

**Author:** ![tefa](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tefa/32/1181_2.png) [@tefa](https://discourse.processing.org/u/tefa)\
**Post date:** [August 25, 2018, 10:23pm UTC](https://discourse.processing.org/t/video-does-not-show-up-when-object-oriented-code-runs/2976/3 "2018-08-25T22:23:38Z")

</div>

> [@Kevin](#):
>
> void movieEvent(Movie m) { m.read(); }

YAAAS !! that was it, Thank you Kevin.

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [August 25, 2018, 10:25pm UTC](https://discourse.processing.org/t/video-does-not-show-up-when-object-oriented-code-runs/2976/4 "2018-08-25T22:25:39Z")

</div>

You’re very welcome.

For future reference, this info is usually in the reference pages for the library you’re using. In this case, I’d start [here](https://processing.org/reference/libraries/video/index.html).

---

<div class="post-metadata">

**Author:** ![tefa](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tefa/32/1181_2.png) [@tefa](https://discourse.processing.org/u/tefa)\
**Post date:** [August 25, 2018, 11:05pm UTC](https://discourse.processing.org/t/video-does-not-show-up-when-object-oriented-code-runs/2976/5 "2018-08-25T23:05:17Z")

</div>

is it okay if I make a different question regarding the same code (i added some line) in this same post?

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [August 25, 2018, 11:09pm UTC](https://discourse.processing.org/t/video-does-not-show-up-when-object-oriented-code-runs/2976/6 "2018-08-25T23:09:09Z")

</div>

It’s up to you. There aren’t any strict rules. If it’s about the same code it’s probably fine, but if it’s a different problem then a new post is probably best.

As long as you’re working from a [small example program](https://stackoverflow.com/help/mcve) and not posting unrelated code, it should be fine either way.
