feat: cross-platform titlebar, video transfers and client cleanup
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
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
Adds frameless-window controls for Windows/Linux (native traffic lights on macOS), keeps transfers at the current position for video, lets the video player use the same sync/device controls as the media bar, and removes dead code plus assorted UI/perf issues.
This commit is contained in:
1 parent
4bdd0139bf
commit
6675a55957
26 files changed
+561
-316
No files matched your search
@@ -56,6 +56,8 @@ export interface PlaybackInfoOptions {
|
||||
currentEpisodeId?: string;
|
||||
playlistItem?: boolean;
|
||||
playlistItemId?: string;
|
||||
/** Start the stream at this position (used by transfers). */
|
||||
startPositionTicks?: number;
|
||||
}
|
||||
|
||||
export async function getPlaybackInfo(
|
||||
@@ -70,6 +72,7 @@ export async function getPlaybackInfo(
|
||||
currentEpisodeId,
|
||||
playlistItem,
|
||||
playlistItemId,
|
||||
startPositionTicks,
|
||||
} = options;
|
||||
|
||||
let result: any;
|
||||
@@ -223,7 +226,8 @@ export async function getPlaybackInfo(
|
||||
audioStreamIndex: Number(audioStreamIndex),
|
||||
subtitleStreamIndex: currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||
itemId: targetItem.Id,
|
||||
startTimeTicks: targetItem.UserData?.PlaybackPositionTicks,
|
||||
startTimeTicks:
|
||||
startPositionTicks ?? targetItem.UserData?.PlaybackPositionTicks,
|
||||
userId: userId,
|
||||
mediaSourceId: targetItem.MediaSources?.[0]?.Id,
|
||||
playbackInfoDto: {
|
||||
|
||||
@@ -191,7 +191,9 @@ export const transferSessionToLocal = async (
|
||||
enableUserData: true,
|
||||
})
|
||||
).data.Items?.[0] ?? item;
|
||||
const playback = await getPlaybackInfo(api, userId, fullItem);
|
||||
const playback = await getPlaybackInfo(api, userId, fullItem, {
|
||||
startPositionTicks: positionTicks,
|
||||
});
|
||||
const queueItems: BaseItemDto[] = playback.item?.Items?.length
|
||||
? playback.item.Items
|
||||
: queue;
|
||||
@@ -211,15 +213,28 @@ export const transferSessionToLocal = async (
|
||||
});
|
||||
}
|
||||
|
||||
// Transfer, not cast: the remote device should stop.
|
||||
try {
|
||||
await getSessionApi(api).sendPlaystateCommand({
|
||||
sessionId: session.Id,
|
||||
command: "Stop",
|
||||
controllingUserId: userId,
|
||||
});
|
||||
} catch (error) {
|
||||
console.warn("Could not stop the remote session", error);
|
||||
// Transfer, not cast: the remote device should stop. Some clients drop
|
||||
// Stop or ignore it while switching streams, so fall back to Pause and
|
||||
// verify that it actually stopped.
|
||||
for (const command of [PlaystateCommand.Stop, PlaystateCommand.Pause]) {
|
||||
try {
|
||||
await getSessionApi(api).sendPlaystateCommand({
|
||||
sessionId: session.Id,
|
||||
command,
|
||||
controllingUserId: userId,
|
||||
});
|
||||
} catch (error) {
|
||||
console.warn("Could not stop the remote session", error);
|
||||
}
|
||||
await sleep(400);
|
||||
try {
|
||||
const target = (await getSessionApi(api).getSessions()).data.find(
|
||||
(entry) => entry.Id === session.Id,
|
||||
);
|
||||
if (!target?.NowPlayingItem || target.PlayState?.IsPaused) return kind;
|
||||
} catch {
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
|
||||
return kind;
|
||||
|
||||
Reference in new issue
Block a user