Merge pull request #194 from matrix-org/audio_notifications

Make audio notifications work
This commit is contained in:
David Baker 2016-03-04 18:24:01 +00:00
commit 052925d95b

View File

@ -35,7 +35,7 @@ var Notifier = {
return TextForEvent.textForEvent(ev);
},
displayNotification: function(ev, room) {
displayNotification: function(ev, room, actions) {
if (!global.Notification || global.Notification.permission != 'granted') {
return;
}
@ -84,11 +84,19 @@ var Notifier = {
global.focus();
};
/*var audioClip;
var playAudio = function() {
var e = document.getElementById("messageAudio");
if (e) {
e.load();
e.play();
return e;
}
};
if (audioNotification) {
audioClip = playAudio(audioNotification);
}*/
var audioClip;
if (actions.tweaks.sound) {
audioClip = playAudio();
}
global.setTimeout(function() {
notification.close();
@ -198,7 +206,7 @@ var Notifier = {
var actions = MatrixClientPeg.get().getPushActionsForEvent(ev);
if (actions && actions.notify) {
this.displayNotification(ev, room);
this.displayNotification(ev, room, actions);
}
}
};