Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
Hi all,
I want to create a function that when a button is click a certain sound effect will appear. Is there a js code for this?
Solved! Go to Solution.
use this Script, and associate this function to Click or another event of Widget.
$scope.mp3play=function() {
var audioElement;
if(!audioElement) {
audioElement = document.createElement('audio');
audioElement.innerHTML = '<source src="' + 'app/resources/Uploaded/File_Name.mp3'+ '" type="audio/mpeg" />'
}
audioElement.play();
};
File_Name.mp3 = name of file saved into resource of project.
it has been tested and is working on Tablet (Android & IOS) ,Mobile (Android & IOS), Hololens.
I HOPE TO HELP YOU
Giuseppe
use this Script, and associate this function to Click or another event of Widget.
$scope.mp3play=function() {
var audioElement;
if(!audioElement) {
audioElement = document.createElement('audio');
audioElement.innerHTML = '<source src="' + 'app/resources/Uploaded/File_Name.mp3'+ '" type="audio/mpeg" />'
}
audioElement.play();
};
File_Name.mp3 = name of file saved into resource of project.
it has been tested and is working on Tablet (Android & IOS) ,Mobile (Android & IOS), Hololens.
I HOPE TO HELP YOU
Giuseppe