catch for notificationa not existing on some devices

This commit is contained in:
Your Name
2018-07-15 15:44:43 -04:00
parent c75537d4b8
commit 4dfe5e061f
3 changed files with 52 additions and 49 deletions

View File

@@ -817,7 +817,8 @@ var Player = {
notifyUser: function(id, title) {
title = title.replace(/\\\'/g, "'").replace(/"/g,"'").replace(/&/g,"&");
if (Notification.permission === "granted" && document.hidden && !embed) {
try{
if (Notification != undefined && Notification.permission === "granted" && document.hidden && !embed) {
var icon = "https://img.youtube.com/vi/"+id+"/mqdefault.jpg";
if(videoSource) icon = full_playlist[full_playlist.length - 1].thumbnail;
var notification = new Notification("Now Playing", {body: title, icon: icon, iconUrl: icon});
@@ -826,6 +827,7 @@ var Player = {
notification.close();
},5000);
}
}catch(e){}
},
setup_all_listeners: function() {