From 3bb824484f4dd9fc60035e164f4ad8354f319304 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 3 Mar 2016 08:18:41 -0500 Subject: [PATCH] Added very basic audio notifications. This plays the same message.ogg/message.mp3 regardless of event type. It also does not check the user's event settings (LOUD/OFF/etc), instead playing a sound upon every single notification. Clearly, it still needs some work. Signed-off-by: Andrew Johnson --- src/Notifier.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Notifier.js b/src/Notifier.js index b64a001a5f..8e60aee24c 100644 --- a/src/Notifier.js +++ b/src/Notifier.js @@ -83,15 +83,24 @@ var Notifier = { }); global.focus(); }; - - /*var audioClip; - - if (audioNotification) { - audioClip = playAudio(audioNotification); - }*/ + + var playAudio = function() { + var e = document.getElementById("messageAudio"); + if (e) { + e.load(); + e.play(); + return e; + } + }; + + var audioClip; + audioClip = playAudio(); global.setTimeout(function() { notification.close(); + if (audioClip) { + audioClip.pause(); + } }, 5 * 1000); },