feat: instant mix, remote control and stable music library
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped

- Instant Mix button on albums, artists, the audio player and full-screen player
- Remote control dialog (cast icon in app bar/header/item/player): lists other
  sessions, play/pause/next/prev/seek/stop, and Play-on-device for an item
- Music library: repair persisted view types (CollectionFolder/undefined) and
  fall back to Songs when a music library has no album grouping
- Music jitter: remove full-screen backdrop-filters (audio bar and player page)
  and the body ResizeObserver in the virtualized grid
This commit is contained in:
1xDed committed 2026-11-27 13:18:09 +03:00
1 parent cc1391bb7d
commit a98663691d
18 files changed
+681 -22

No files matched your search

+90
View File
@@ -0,0 +1,90 @@
import type { Api } from "@jellyfin/sdk";
import {
type BaseItemDto,
BaseItemKind,
ItemFields,
} from "@jellyfin/sdk/lib/generated-client";
import { getInstantMixApi } from "@jellyfin/sdk/lib/utils/api/instant-mix-api";
import { playItemFromQueue } from "@/utils/store/playback";
import { setQueue } from "@/utils/store/queue";
export type InstantMixResult = {
count: number;
};
/**
* Start a Jellyfin "Instant Mix" (radio) from any music item: track, album,
* artist, playlist or genre. Fetches the mix, replaces the queue and plays it.
*/
export const startInstantMix = async (
api: Api | undefined,
userId: string | undefined,
item: BaseItemDto | undefined | null,
): Promise<InstantMixResult> => {
if (!api) throw new Error("API is not available");
if (!userId) throw new Error("User is not available");
if (!item?.Id) throw new Error("Item is not available");
const params = {
userId,
limit: 50,
fields: [ItemFields.MediaSources],
enableImages: true,
enableUserData: true,
};
const mixApi = getInstantMixApi(api);
let response;
switch (item.Type) {
case BaseItemKind.MusicAlbum:
response = await mixApi.getInstantMixFromAlbum({
itemId: item.Id,
...params,
});
break;
case BaseItemKind.MusicArtist:
response = await mixApi.getInstantMixFromArtists({
itemId: item.Id,
...params,
});
break;
case BaseItemKind.Audio:
case BaseItemKind.AudioBook:
response = await mixApi.getInstantMixFromSong({
itemId: item.Id,
...params,
});
break;
case BaseItemKind.Playlist:
response = await mixApi.getInstantMixFromPlaylist({
itemId: item.Id,
...params,
});
break;
case BaseItemKind.MusicGenre:
case BaseItemKind.Genre:
response = await mixApi.getInstantMixFromMusicGenreById({
id: item.Id,
...params,
});
break;
default:
response = await mixApi.getInstantMixFromItem({
itemId: item.Id,
...params,
});
break;
}
const tracks = (response.data.Items ?? []).filter(
(track) => track.Id && track.Type !== BaseItemKind.Folder,
);
if (tracks.length === 0) {
return { count: 0 };
}
setQueue(tracks, 0);
await playItemFromQueue(0, userId, api);
return { count: tracks.length };
};