orbitControl() is loading super slowly

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

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();
}

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

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

1 Like

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

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

1 Like

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?