Hi,
I'm trying to use Web Audio to adjust tune of a song. I can play the song through a Dropbox shared link using
<audio src="https://www.dropbox.com/s/[my shared link here]?dl=1"></audio>
However, when I connect the audio node to Web Audio context and try to play it, it gives me this error:
MediaElementAudioSource outputs zeroes due to CORS access restrictions for https://www.dropbox.com/s/[my shared link here]?dl=1
I searched around and found that this CORS error is from the server side restrictions. Can you help me to resovle this? Thank you very much!
The javascript code is below:
<script>
var audioContext = new (window.AudioContext || window.webkitAudioContext)();
var audioNode = document.querySelector("audio");
var playable = false;
window.onload = function() {
document.body.addEventListener("click", function() {
if (playable) {
audioNode.play();
} else {
audioNode.addEventListener("loadstart", function(event) { console.log(event.type); });
audioNode.addEventListener("loadedmetadata", function(event) { console.log(event.type); });
audioNode.addEventListener("canplay", function(event) { console.log(event.type);
playable = true;
audioContext.createMediaElementSource(audioNode).connect(audioContext.destination);
audioNode.play();
});
audioNode.load();
}
});
}
</script>