mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Use full image for MediaSession
This commit is contained in:
parent
564ab1f7b4
commit
3dd141915e
1 changed files with 12 additions and 29 deletions
|
@ -11,13 +11,12 @@ define(['playbackManager', 'nowPlayingHelper', 'events', 'connectionManager'], f
|
||||||
var currentPlayer;
|
var currentPlayer;
|
||||||
var lastUpdateTime = 0;
|
var lastUpdateTime = 0;
|
||||||
|
|
||||||
function seriesImageUrl(item, options) {
|
function seriesImageUrl(item, options = {}) {
|
||||||
|
|
||||||
if (item.Type !== 'Episode') {
|
if (item.Type !== 'Episode') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
options = options || {};
|
|
||||||
options.type = options.type || "Primary";
|
options.type = options.type || "Primary";
|
||||||
|
|
||||||
if (options.type === 'Primary') {
|
if (options.type === 'Primary') {
|
||||||
|
@ -49,9 +48,7 @@ define(['playbackManager', 'nowPlayingHelper', 'events', 'connectionManager'], f
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function imageUrl(item, options) {
|
function imageUrl(item, options = {}) {
|
||||||
|
|
||||||
options = options || {};
|
|
||||||
options.type = options.type || "Primary";
|
options.type = options.type || "Primary";
|
||||||
|
|
||||||
if (item.ImageTags && item.ImageTags[options.type]) {
|
if (item.ImageTags && item.ImageTags[options.type]) {
|
||||||
|
@ -69,29 +66,26 @@ define(['playbackManager', 'nowPlayingHelper', 'events', 'connectionManager'], f
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pushImageUrl(item, imageOptions, list) {
|
function pushImageUrl(item, imageOptions = {}) {
|
||||||
var url = seriesImageUrl(item, imageOptions) || imageUrl(item, imageOptions);
|
var url = seriesImageUrl(item, imageOptions) || imageUrl(item, imageOptions);
|
||||||
|
|
||||||
if (url) {
|
if (url) {
|
||||||
var height = imageOptions.height || imageOptions.maxHeight;
|
var height = imageOptions.height || imageOptions.maxHeight;
|
||||||
|
|
||||||
list.push({
|
return {
|
||||||
src: url,
|
src: url,
|
||||||
sizes: height + 'x' + height
|
sizes: height + 'x' + height
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getImageUrls(item) {
|
function getImageUrls(item) {
|
||||||
|
|
||||||
var list = [];
|
var list = [];
|
||||||
|
const imageSizes = [96, 128, 192, 256, 384, 512];
|
||||||
|
|
||||||
pushImageUrl(item, {height: 96}, list);
|
imageSizes.forEach((size) => {
|
||||||
pushImageUrl(item, {height: 128}, list);
|
list.push(pushImageUrl(item, {height: size}));
|
||||||
pushImageUrl(item, {height: 192}, list);
|
});
|
||||||
pushImageUrl(item, {height: 256}, list);
|
|
||||||
pushImageUrl(item, {height: 384}, list);
|
|
||||||
pushImageUrl(item, {height: 512}, list);
|
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -127,11 +121,6 @@ define(['playbackManager', 'nowPlayingHelper', 'events', 'connectionManager'], f
|
||||||
var parts = nowPlayingHelper.getNowPlayingNames(item);
|
var parts = nowPlayingHelper.getNowPlayingNames(item);
|
||||||
var artist = parts[parts.length - 1].text;
|
var artist = parts[parts.length - 1].text;
|
||||||
var title = parts.length === 1 ? '' : parts[0].text;
|
var title = parts.length === 1 ? '' : parts[0].text;
|
||||||
var albumArtist;
|
|
||||||
|
|
||||||
if (item.AlbumArtists && item.AlbumArtists[0]) {
|
|
||||||
albumArtist = item.AlbumArtists[0].Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
var album = item.Album || '';
|
var album = item.Album || '';
|
||||||
var itemId = item.Id;
|
var itemId = item.Id;
|
||||||
|
@ -143,22 +132,16 @@ define(['playbackManager', 'nowPlayingHelper', 'events', 'connectionManager'], f
|
||||||
var isPaused = playState.IsPaused || false;
|
var isPaused = playState.IsPaused || false;
|
||||||
var canSeek = playState.CanSeek || false;
|
var canSeek = playState.CanSeek || false;
|
||||||
|
|
||||||
if (navigator.mediaSession) {
|
if ('mediaSession' in navigator) {
|
||||||
navigator.mediaSession.metadata = new MediaMetadata({
|
navigator.mediaSession.metadata = new MediaMetadata({
|
||||||
title: title,
|
title: title,
|
||||||
artist: artist,
|
artist: artist,
|
||||||
album: album,
|
album: album,
|
||||||
artwork: getImageUrls(item),
|
artwork: getImageUrls(item)
|
||||||
albumArtist: albumArtist,
|
|
||||||
currentTime: currentTime,
|
|
||||||
duration: duration,
|
|
||||||
paused: isPaused,
|
|
||||||
itemId: itemId,
|
|
||||||
mediaType: item.MediaType
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var imageUrl = [];
|
var imageUrl = [];
|
||||||
pushImageUrl(item, {maxHeight: 400}, imageUrl);
|
imageUrl.push(pushImageUrl(item));
|
||||||
|
|
||||||
if (imageUrl.length) {
|
if (imageUrl.length) {
|
||||||
imageUrl = imageUrl[0].src;
|
imageUrl = imageUrl[0].src;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue