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