Audio in p5 sketch running in safari browser within sketch, but not hosted.

Hey guys! So I'm working on an audio music visualizer that will be viewed on an iPad. Problem I'm running into is that the sketch runs fine in Safari within p5, but not when its hosted. And yes, the entire file structure (html, libraries, sketch) are uploaded to my host. I'm getting the error below. Also attached is my very basic sketch code. The website is mmengle.com and my sketch is grid1. Help!

var shiftX, shiftY;
var x, y, spacing;
var song;
//var r, o, y, g, b;
// var c1 = [(fill(243, 158, 34)), (fill(57, 178, 136)), (fill(239, 73, 36)), (fill(234, 130, 36)), (fill(66, 104, 177))];



function preload() {
  mySound = loadSound('assets/Finding Nemo - Nemo Egg (Main Theme).mp3');
}

function setup() {
  createCanvas(1024, 760);
  spacing = 150;
  // c1[k] = 0, 4;

  //music

  mySound.play();

}

function draw() {
  background(18, 21, 24);

  //shifting + grid

  shiftX = (1024 / 2) - 320;
  shiftY = (760 / 2) - 250;
  translate(shiftX, shiftY);


  //all the squares; color generation

  for (var i = 0; i < 5; i++) {
    for (var j = 0; j < 4; j++) {

      x = i * spacing;
      y = j * spacing;
      // fill(c1[i]);
      noStroke();
      fill(243, 158, 34);
      rect(x, y, 40, 40, 10);

    }

  }
}

Screen Shot 2016-07-18 at 10.12.28 AM

Answers

Sign In or Register to comment.