Browse Source

Change jellyfin audio endpoint

- Remove universal
- Force direct play
master
jeffvli 3 years ago
committed by Jeff
parent
commit
d8e5c92a7b
  1. 22
      src/api/jellyfinApi.ts

22
src/api/jellyfinApi.ts

@ -55,17 +55,16 @@ axiosRetry(jellyfinApi, {
},
});
const getStreamUrl = (id: string) => {
const getStreamUrl = (id: string, container: string, mediaSourceId: string, eTag: string) => {
return (
`${API_BASE_URL}/Audio` +
`/${id}` +
`/universal` +
`?UserId=${auth.username}` +
`&DeviceId=${auth.deviceId}` +
`&AudioCodec=aac` +
`&api_key=${auth.token}` +
`&PlaySessionId=${auth.deviceId}` +
`&Container=['opus','mp3','aac','m4a','m4b','flac','wav','ogg']`
`/stream${container ? `.${container}` : ''}` +
`?static=true` +
`&deviceId=${auth.deviceId}` +
`&mediaSourceId=${mediaSourceId}` +
`&tag=${eTag}` +
`&api_key=${auth.token}`
);
};
@ -119,7 +118,12 @@ const normalizeSong = (item: any) => {
playCount: item.UserData && item.UserData.PlayCount,
discNumber: undefined,
created: item.DateCreated,
streamUrl: getStreamUrl(item.Id),
streamUrl: getStreamUrl(
item.MediaSources[0]?.Id,
item.MediaSources[0]?.Container,
item.MediaSources[0]?.Id,
item.MediaSources[0]?.ETag
),
image: getCoverArtUrl(item, 150),
starred: item.UserData && item.UserData.IsFavorite ? 'true' : undefined,
type: Item.Music,

Loading…
Cancel
Save