forked from Simnation/Main
wd
This commit is contained in:
parent
307f4c0d90
commit
1c16382e41
10 changed files with 307 additions and 2 deletions
25
resources/[tools]/interact-sound/client/html/index.html
Normal file
25
resources/[tools]/interact-sound/client/html/index.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
<html>
|
||||
<head>
|
||||
<!-- Need to include jQuery! -->
|
||||
<script src="nui://game/ui/jquery.js" type="text/javascript"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.1.1/howler.min.js" type="text/javascript"></script>
|
||||
<script>
|
||||
var audioPlayer = null;
|
||||
// Listen for NUI Messages.
|
||||
window.addEventListener('message', function(event) {
|
||||
// Check for playSound transaction
|
||||
if (event.data.transactionType == "playSound") {
|
||||
|
||||
if (audioPlayer != null) {
|
||||
audioPlayer.pause();
|
||||
}
|
||||
|
||||
audioPlayer = new Howl({src: ["./sounds/" + event.data.transactionFile + ".ogg"]});
|
||||
audioPlayer.volume(event.data.transactionVolume);
|
||||
audioPlayer.play();
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue