Vote count:
0
I have a website that worked great yesterday and today, I've opened it up again and the audio no longer plays
this doesn't happen on firefox nor on the one I've hosted on google drive
here's the html part calling the scripts:
<script src="Scripts/frenzyMode.js"></script>
<script src="Scripts/DVR media player.js"></script>
<script src="Scripts/visualizer.js"></script>
<script src="Scripts/bodyScript.js"></script>
and here's visualizer.js:
var canvas, ctx, source, context, analyser, fbc_array, bars, bar_x, bar_width, bar_height;
function initVisualizer() {
context = new AudioContext();
analyser = context.createAnalyser();
biquad = context.createBiquadFilter();
gainNode = context.createGain();
canvas = document.getElementById("visualizer");
ctx = canvas.getContext('2d');
ctx.fillStyle = "#3f3f3f";
analyser.smoothingTimeConstant = 0.8;
biquad.frequency.value = 15000;
gainNode.gain.value = 1;
source = context.createMediaElementSource(Musique);
source.connect(biquad);
biquad.connect(gainNode);
gainNode.connect(analyser);
analyser.connect(context.destination);
$("#frequencyNumber").html(biquad.frequency.value);
$("#visualizerSensibilityNumber").html(analyser.smoothingTimeConstant);
$("#gainNumber").html(gainNode.gain.value.toPrecision(3));
framelooper()
}
function framelooper() {
window.requestAnimationFrame(framelooper);
fbcArray = new Uint8Array(analyser.frequencyBinCount);
analyser.getByteFrequencyData(fbcArray);
ctx.clearRect(0, 0, canvas.width, canvas.height);
bars = 50;
for (i=0; i < bars; i++) {
bar_x = i * 6;
bar_width = 5;
bar_height = -(fbcArray[i] / 1.75); //6 //1.75
if (visualizerStyle == 1){
//Simple
ctx.fillRect(bar_x, canvas.height, bar_width, bar_height);
$("#visualizerStyleType").html("Simple");
}
else if (visualizerStyle == 2) {
//Reflection
ctx.fillRect(bar_x, canvas.height/2, bar_width, bar_height/2);
ctx.fillRect(bar_x, canvas.height/2, bar_width, -bar_height/2);
$("#visualizerStyleType").html("Reflection");
}
else {
//Two-faced
ctx.fillRect(0, bar_x, -bar_height, bar_width);
ctx.fillRect(canvas.width, bar_x, bar_height, bar_width);
$("#visualizerStyleType").html("Face to Face");
}
}
}
I have absolutely no idea why this is happening, as the console is not giving any errors at all
asked 33 secs ago
web audio API not working in chrome localy
Aucun commentaire:
Enregistrer un commentaire