Play sound upon microphone being muted

This commit is contained in:
David Rowe 2015-06-12 12:33:17 -07:00
parent 546442ff9a
commit f0b6b0f548

View file

@ -13,17 +13,24 @@
// setup the local sound we're going to use
var connectSound = SoundCache.getSound("file:///" + Paths.resources + "sounds/hello.wav");
var disconnectSound = SoundCache.getSound("file:///" + Paths.resources + "sounds/goodbye.wav");
var micMutedSound = SoundCache.getSound("file:///" + Paths.resources + "sounds/goodbye.wav");
// setup the options needed for that sound
var connectSoundOptions = {
var soundOptions = {
localOnly: true
};
// play the sound locally once we get the first audio packet from a mixer
Audio.receivedFirstPacket.connect(function(){
Audio.playSound(connectSound, connectSoundOptions);
Audio.playSound(connectSound, soundOptions);
});
Audio.disconnected.connect(function(){
Audio.playSound(disconnectSound, connectSoundOptions);
Audio.playSound(disconnectSound, soundOptions);
});
AudioDevice.muteToggled.connect(function () {
if (AudioDevice.getMuted()) {
Audio.playSound(micMutedSound, soundOptions);
}
});