support notifications in firefox

This commit is contained in:
Luke Pulverenti 2013-05-31 11:03:40 -04:00
parent 1ac0f71d1e
commit d4ba64d07a
2 changed files with 20 additions and 13 deletions

View File

@ -69,18 +69,24 @@ var WebNotifications = {
} }
} }
else if (window.Notification) { else if (window.Notification) {
if (Notification.permissionLevel() === "granted") {
var notif = new Notification(data.title, data);
notif.show();
if (data.timeout) { var level = Notification.permissionLevel ? Notification.permissionLevel() : Notification.permission;
if (level === "granted") {
var notif = new Notification(data.title, data);
if (notif.show) {
notif.show();
}
if (data.timeout && notif.cancel) {
setTimeout(function () { setTimeout(function () {
notif.cancel(); notif.cancel();
}, data.timeout); }, data.timeout);
} }
return notif; return notif;
} else if (Notification.permissionLevel() === "default") { } else if (level === "default") {
Notification.requestPermission(function () { Notification.requestPermission(function () {
return WebNotifications.show(data); return WebNotifications.show(data);
}); });
@ -97,8 +103,10 @@ var WebNotifications = {
} }
} }
else if (window.Notification) { else if (window.Notification) {
if (Notification.permissionLevel() === "granted") {
} else if (Notification.permissionLevel() === "default") { var level = Notification.permissionLevel ? Notification.permissionLevel() : Notification.permission;
if (level === "default") {
Notification.requestPermission(function () { Notification.requestPermission(function () {
}); });
} }

View File

@ -884,13 +884,12 @@ var Dashboard = {
else if (msg.MessageType === "Play") { else if (msg.MessageType === "Play") {
ApiClient.getItems(Dashboard.getCurrentUserId(), { ApiClient.getItems(Dashboard.getCurrentUserId(), {
Ids: msg.Data.ItemIds.join(','),
Fields: 'MediaStreams,UserData,DisplayMediaType,SeriesInfo,AudioInfo,Chapters'
}).done(function(result) {
Ids: msg.Data.ItemIds.join(','),
Fields: 'MediaStreams,UserData,DisplayMediaType,SeriesInfo,AudioInfo,Chapters,Path'
}).done(function (result) {
MediaPlayer.play(result.Items, msg.Data.StartPositionTicks); MediaPlayer.play(result.Items, msg.Data.StartPositionTicks);
}); });