feat(casting): chapter list button in the cast player

This commit is contained in:
Uruk
2026-05-22 11:59:25 +02:00
parent 74315a8b94
commit 03d2917ca0
2 changed files with 37 additions and 1 deletions

View File

@@ -27,6 +27,10 @@ interface CastPlayerEpisodeControlsProps {
remoteMediaClient: RemoteMediaClient | null;
/** Open the episode list modal. */
onPressEpisodes: () => void;
/** Whether the current item exposes chapter markers. */
hasChapters: boolean;
/** Open the chapter list modal. */
onPressChapters: () => void;
/** Load a different episode on the Chromecast. */
loadEpisode: (episode: BaseItemDto) => Promise<void>;
/** Expo Router instance for navigation on stop. */
@@ -40,6 +44,8 @@ export function CastPlayerEpisodeControls({
nextEpisode,
remoteMediaClient,
onPressEpisodes,
hasChapters,
onPressChapters,
loadEpisode,
router,
}: CastPlayerEpisodeControlsProps) {
@@ -51,7 +57,11 @@ export function CastPlayerEpisodeControls({
// Count of buttons actually rendered (Stop is always rendered).
const buttonCount =
1 + (hasEpisodeList ? 1 : 0) + (hasPrevious ? 1 : 0) + (hasNext ? 1 : 0);
1 +
(hasEpisodeList ? 1 : 0) +
(hasChapters ? 1 : 0) +
(hasPrevious ? 1 : 0) +
(hasNext ? 1 : 0);
// When Stop is the only button (movies), render it full-width with a label.
const isLoneStop = buttonCount === 1;
@@ -89,6 +99,13 @@ export function CastPlayerEpisodeControls({
</Pressable>
)}
{/* Chapter list button - rendered for both episodes and movies when chapters exist */}
{hasChapters && (
<Pressable onPress={onPressChapters} style={buttonStyle}>
<Ionicons name='bookmarks' size={22} color='white' />
</Pressable>
)}
{/* Previous episode button - only rendered when a previous episode exists */}
{hasPrevious && (
<Pressable