diff --git a/examples/audioExamples/acAudioSearching/ACAudioSearchAndInject.js b/examples/audioExamples/acAudioSearching/ACAudioSearchAndInject.js index 88bb17ca0e..0b3aab0b84 100644 --- a/examples/audioExamples/acAudioSearching/ACAudioSearchAndInject.js +++ b/examples/audioExamples/acAudioSearching/ACAudioSearchAndInject.js @@ -41,7 +41,7 @@ var DEFAULT_SOUND_DATA = { var MIN_INTERVAL = 0.2; function messageReceived(channel, message, sender) { - + print("EBL MESSAGE RECIEVED"); var entityID = JSON.parse(message).id; if (soundEntityMap[entityID]) { // We already have this entity in our sound map, so don't re-add @@ -49,7 +49,15 @@ function messageReceived(channel, message, sender) { } EntityViewer.queryOctree(); + Script.setTimeout(function() { + handleIncomingEntity(entityID); + }, 2000); + +} + +function handleIncomingEntity(entityID) { var soundData = getEntityCustomData(SOUND_DATA_KEY, entityID); + print("SOUND DATA " + JSON.stringify(soundData)); if (soundData && soundData.url) { var soundProperties = { url: soundData.url, @@ -80,6 +88,7 @@ function messageReceived(channel, message, sender) { soundEntityMap[entityID] = soundProperties; } } + } function update(deltaTime) { @@ -93,6 +102,7 @@ function update(deltaTime) { var soundProperties = soundEntityMap[entity]; if (soundProperties.readyToPlay) { var newPosition = Entities.getEntityProperties(entity, "position").position + print("EBL SHOULD BE PLAYING SOUND!") Audio.playSound(soundProperties.sound, { volume: soundProperties.volume, position: newPosition, diff --git a/examples/audioExamples/acAudioSearching/acAudioSearchCompatibleEntitySpawner.js b/examples/audioExamples/acAudioSearching/acAudioSearchCompatibleEntitySpawner.js index 6264c62964..876f5e6461 100644 --- a/examples/audioExamples/acAudioSearching/acAudioSearchCompatibleEntitySpawner.js +++ b/examples/audioExamples/acAudioSearching/acAudioSearchCompatibleEntitySpawner.js @@ -17,7 +17,7 @@ Script.include("../../libraries/utils.js"); var SOUND_DATA_KEY = "soundKey"; var MESSAGE_CHANNEL = "Hifi-Sound-Entity"; -var SCRIPT_URL = Script.resolvePath("soundEntityScript.js"); +var SCRIPT_URL = Script.resolvePath("soundEntityScript.js?v1" + Math.random()); var userData = { soundKey: { url: "https://s3-us-west-1.amazonaws.com/hifi-content/eric/Sounds/dove.wav", diff --git a/examples/audioExamples/acAudioSearching/soundEntityScript.js b/examples/audioExamples/acAudioSearching/soundEntityScript.js index 0f466c2c2b..b58a4cc0fe 100644 --- a/examples/audioExamples/acAudioSearching/soundEntityScript.js +++ b/examples/audioExamples/acAudioSearching/soundEntityScript.js @@ -24,10 +24,11 @@ Script.setTimeout(function() { var soundData = getEntityCustomData("soundKey", _this.entityID); // Just a hack for now until bug https://app.asana.com/0/26225263936266/86767805352289 is fixed + print("EBL SEND MESSAGE"); Messages.sendMessage(_this.MESSAGE_CHANNEL, JSON.stringify({ id: _this.entityID })); - }, 1000); + }, 2000); }, }; // entity scripts always need to return a newly constructed object of our type