# orbitControl() is loading super slowly

**URL:** <https://discourse.processing.org/t/orbitcontrol-is-loading-super-slowly/30588>\
**Category:** p5.js\
**Created:** [June 8, 2021, 9:38pm UTC](https://discourse.processing.org/t/orbitcontrol-is-loading-super-slowly/30588 "2021-06-08T21:38:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tofu3000](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tofu3000](https://discourse.processing.org/u/tofu3000)\
**Post date:** [June 8, 2021, 9:38pm UTC](https://discourse.processing.org/t/orbitcontrol-is-loading-super-slowly/30588/1 "2021-06-08T21:38:11Z")

</div>

In preload(), I have 17 images, 16 videos, and 11 3d objects (file sizes I believe are manageable… nothing exceeding 20 mb), and in setup() I am initializing webgl…

In draw(), I’m calling orbitControl() and rendering the content, but sometimes the videos aren’t loading/playing, and the code seems to run very slowly. Is there a way to get around this? I don’t think my content is that heavy in size or anything, but I’m not sure what is happening.

When I open the page in Safari, the browser complains that the page is consuming significant memory though… thank you!

Here’s some of my code… shortened because it is super repetitive

```auto
let img, img2 ...
let vid, vid2 ...
let dim, dim2 ...
var song;

function preload() {
    song = loadSound('/content/music/x.mp3');

    img = loadImage("/content/img/o_postcard_1.png");
    dim = loadModel("/content/3d/s_3D_object_1.obj");
    
    vid = createVideo("/content/vid/video1.mp4");
    vid.hide();
    vid.autoplay();
    vid.loop();
    vid.elt.muted = true;

    vid2 = createVideo("/content/vid/video2.mp4");
    vid2.hide();
    vid2.autoplay();
    vid2.loop();
    vid2.elt.muted = true;
}

function setup() {
    createCanvas(windowWidth, windowHeight, WEBGL);
    angleMode = DEGREES;
    song.play();
}

function draw() {
    orbitControl();
    background(0);
    noStroke();

    push();
    texture(img);
    rect(300,200, 250,250);
    pop();

    push();
    rotateY(36);
    texture(img2);
    rect(300,200, 250,250);
    pop();

    push();
    texture(vid);
    rect(450,-200, 300, 300);
    pop();

    push();
    rotateY(36);
    texture(vid2);
    rect(450,-200, 300, 300);
    pop();
}

```

---

<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:** [June 8, 2021, 10:18pm UTC](https://discourse.processing.org/t/orbitcontrol-is-loading-super-slowly/30588/2 "2021-06-08T22:18:06Z")

</div>

> [@tofu3000](#):
>
> nothing exceeding 20 mb

Approximately 40 files with each up to 20 mb is a lot

Did you run a test with 8 objects and each \<= 2 mb?

---

<div class="post-metadata">

**Author:** ![tofu3000](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tofu3000](https://discourse.processing.org/u/tofu3000)\
**Post date:** [June 9, 2021, 12:06am UTC](https://discourse.processing.org/t/orbitcontrol-is-loading-super-slowly/30588/3 "2021-06-09T00:06:40Z")

</div>

Thank you @chrisir !! I’ll go ahead and reduce the sizes and see if that helps \<3

---

<div class="post-metadata">

**Author:** ![tofu3000](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tofu3000](https://discourse.processing.org/u/tofu3000)\
**Post date:** [June 11, 2021, 1:52pm UTC](https://discourse.processing.org/t/orbitcontrol-is-loading-super-slowly/30588/4 "2021-06-11T13:52:43Z")

</div>

hhmm this still does not work for some reason - so confused! but thank you for the suggestion 🙂

---

<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:** [June 12, 2021, 11:06am UTC](https://discourse.processing.org/t/orbitcontrol-is-loading-super-slowly/30588/5 "2021-06-12T11:06:41Z")

</div>

you don’t need push and pop unless you use ` rotateY`

It’s probably hard for the processor to render two video parallel? Are they HD?

Did you try another browser, e.g. Chrome? Did you try on another computer or tablet?
