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