feat: animate hovered chapter titles and active seek segments
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user