You can't use something before it's defined, which in your case, is AR
. Assuming AR
is defined in your architect.js
file, you need to move the inline script to somewhere after the library is loaded.
<script type="text/javascript" src="architect.js"></script>
<script type="text/javascript">
var sound = new AR.Sound("assets/bell.mp3", {
onLoaded : function() {
sound.play();
},
onError : function() {}
});
AR.sound.onFinishedPlaying = function(){alert("Playing finished");};
AR.sound.load();
AR.sound.play();
</script>