feat(player): add chapter navigation support with visual markers

This commit is contained in:
Fredrik Burmester
2026-01-30 18:02:32 +01:00
parent 3814237ac6
commit 28e3060ace
8 changed files with 426 additions and 29 deletions

View File

@@ -18,6 +18,12 @@ interface CenterControlsProps {
togglePlay: () => void;
handleSkipBackward: () => void;
handleSkipForward: () => void;
// Chapter navigation props
hasChapters?: boolean;
hasPreviousChapter?: boolean;
hasNextChapter?: boolean;
goToPreviousChapter?: () => void;
goToNextChapter?: () => void;
}
export const CenterControls: FC<CenterControlsProps> = ({
@@ -29,6 +35,11 @@ export const CenterControls: FC<CenterControlsProps> = ({
togglePlay,
handleSkipBackward,
handleSkipForward,
hasChapters = false,
hasPreviousChapter = false,
hasNextChapter = false,
goToPreviousChapter,
goToNextChapter,
}) => {
const { settings } = useSettings();
const insets = useSafeAreaInsets();
@@ -94,6 +105,20 @@ export const CenterControls: FC<CenterControlsProps> = ({
</TouchableOpacity>
)}
{!Platform.isTV && hasChapters && (
<TouchableOpacity
onPress={goToPreviousChapter}
disabled={!hasPreviousChapter}
style={{ opacity: hasPreviousChapter ? 1 : 0.3 }}
>
<Ionicons
name='play-back'
size={ICON_SIZES.CENTER - 10}
color='white'
/>
</TouchableOpacity>
)}
<View style={Platform.isTV ? { flex: 1, alignItems: "center" } : {}}>
<TouchableOpacity onPress={togglePlay}>
{!isBuffering ? (
@@ -108,6 +133,20 @@ export const CenterControls: FC<CenterControlsProps> = ({
</TouchableOpacity>
</View>
{!Platform.isTV && hasChapters && (
<TouchableOpacity
onPress={goToNextChapter}
disabled={!hasNextChapter}
style={{ opacity: hasNextChapter ? 1 : 0.3 }}
>
<Ionicons
name='play-forward'
size={ICON_SIZES.CENTER - 10}
color='white'
/>
</TouchableOpacity>
)}
{!Platform.isTV && (
<TouchableOpacity onPress={handleSkipForward}>
<View