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
+4
View File
@@ -163,6 +163,10 @@ struct ResolvedPlaybackCheck {
!model.isBusy && model.state.status == PLAYER_PLAYING && model.state.position > 0.2
}
requireYouTubeChapters(model, expected, "direct openStream")
require(model.sliderSegmentTitle(at: 0.5) == (url == chaptered ? "Opening" : nil) &&
model.sliderSegmentTitle(at: 1.25) == (url == chaptered ? "Ending" : nil) &&
model.sliderSegmentTitle(at: 2.5) == nil,
"hover names match the chapter under the pointer, with no invented gap names")
require(model.state.duration < 500, "native duration rejects chapter edges beyond measured media")
require(model.setPlayback(playing: false), "pause before saving chapter playback")
try await until("chapter playback paused", model: model) { model.state.status == PLAYER_PAUSED }
+9
View File
@@ -193,6 +193,15 @@ struct YouTubeResolverChecks {
"missing, null and malformed optional titles do not discard chapters")
try require(decoded.chapterBoundaries(duration: 12) == [2.25, 8.75],
"chapter edges are sorted, deduplicated and strictly interior")
try require(decoded.chapterTitle(at: 0, duration: 12) == "Opening" &&
decoded.chapterTitle(at: 2.249, duration: 12) == "Opening" &&
decoded.chapterTitle(at: 2.25, duration: 12) == nil &&
decoded.chapterTitle(at: 12, duration: 12) == nil,
"hover titles include chapter start, exclude its end and never invent missing titles")
for duration in [0, -1, 1, Double.nan, .infinity] {
try require(decoded.chapterTitle(at: 0.5, duration: duration) == nil,
"unknown durations and chapters extending beyond media have no hover title")
}
object["duration"] = 0
object["chapters"] = [["start_time": 0, "end_time": 2.25],