Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
How do you plan on updating the sequence for your model? You can use JS to update the audio source for a single audio widget based on which sequence is loaded.
If you are using a select widget to pick the sequence, you could do something like this:
$scope.checkSequence = function(){
var sequenceValue= $scope.app.view['Home'].wdg['select-1']['value'];
var sequenceList = $scope.app.view['Home'].wdg['select-1']['list'];
for (i = 0; i < sequenceList.length; i++){
var sequence = sequenceList[i].filename;
if (sequence == sequenceValue){
switch(i){
case 0:
$scope.view.wdg.sequenceAudio.audiosrc='app/resources/Uploaded/<your audio file>';
break;
case 1:
$scope.view.wdg.sequenceAudio.audiosrc='app/resources/Uploaded/<your audio file>';
break;
case 2:
$scope.view.wdg.sequenceAudio.audiosrc='app/resources/Uploaded/<your audio file>';
break;
default:
console.log('in change audio');
}
}
}
}
Call this function on the "Value Changed' Event for your 2D selector
If you want to use the same 'play' button that you're using to play the sequence, you can call a small function like the below on the button click event.
$scope.playAudio = function(){
twx.app.fn.triggerWidgetService('sequenceAudio', 'play');
}
For steps to set up the select widget see this community post: https://community.ptc.com/t5/Vuforia-Studio/Select-Widget-default-value/m-p/611653
Thank you for the response. I tried creating the experience but still am not able to make it. I have created a separate play button on the 2D canvas, by clicking on which we can play different sequences of animation. I have multiple audio files denoting each sequence separately by names Audio1, Audio2.... and so on. I want to link these audio files to the same button so that with each sequence the corresponding audio plays. Can you please provide me with the Javascript to upload in the format.