mirror of https://github.com/vector-im/riot-web
Merge pull request #194 from matrix-org/audio_notifications
Make audio notifications workpull/21833/head
commit
052925d95b
|
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue