feat: animate hovered chapter titles and active seek segments

This commit is contained in:
2026-10-25 03:09:34 +01:00
parent 119fe2e737
commit edb17f76e3
5 changed files with 198 additions and 12 deletions
+8
View File
@@ -35,6 +35,14 @@ struct YouTubeVideo: Sendable {
}
return boundaries.sorted()
}
func chapterTitle(at time: Double, duration: Double) -> String? {
guard duration.isFinite, duration > 0 else { return nil }
let title = chapters.first {
$0.start >= 0 && $0.end <= duration && $0.start <= time && time < $0.end
}?.title?.trimmingCharacters(in: .whitespacesAndNewlines)
return title?.isEmpty == false ? title : nil
}
}
private struct YouTubeResolutionError: LocalizedError {