feat: open streaming URLs without changing resolved handoffs

This commit is contained in:
2026-10-19 19:32:26 +02:00
parent d068c52e04
commit 9f1dca3081
17 changed files with 553 additions and 103 deletions
+7 -7
View File
@@ -59,9 +59,9 @@ struct AutomaticQualityPlaybackChecks {
let normalFrame = window.frame
let compactKey = try! KeyChord("p")
mark("gate-open")
model.openYouTube("https://www.youtube.com/watch?v=aqz-KE-bpKQ")
model.openStream("https://www.youtube.com/watch?v=aqz-KE-bpKQ")
until(model, "initial YouTube resolution reaches the controlled extraction gate") {
model.resolvingYouTube && marked("entered-open")
model.resolvingStream && marked("entered-open")
}
model.handleKey(compactKey)
require(model.isCompact, "compact shortcut enters while the YouTube URL is unresolved")
@@ -74,7 +74,7 @@ struct AutomaticQualityPlaybackChecks {
until(model, "compact shortcut restores while YouTube resolution is still pending") {
!model.isCompact && !model.compactWindow.isTransitioning
}
require(window.frame == normalFrame && model.resolvingYouTube,
require(window.frame == normalFrame && model.resolvingStream,
"resolution continues while restoring the original normal window")
require(model.perform(.enterCompact), "compact control action is available during resolution")
mark("release-open")
@@ -98,7 +98,7 @@ struct AutomaticQualityPlaybackChecks {
}
clock.now = 2000
polled(model)
require(model.youtubeHeight == 1080 && !model.resolvingYouTube,
require(model.youtubeHeight == 1080 && !model.resolvingStream,
"disabled automatic quality leaves a stalled manual/default stream alone")
model.setAutomaticYouTubeQuality(true)
polled(model)
@@ -146,12 +146,12 @@ struct AutomaticQualityPlaybackChecks {
}
clock.now = 3060
until(model, "automatic upshift reaches the selected extraction gate") {
marked("entered-1080") && model.resolvingYouTube
marked("entered-1080") && model.resolvingStream
}
require(model.setPlayback(playing: false), "pause is accepted during automatic extraction")
mark("release-1080")
until(model, "cancelled extraction finishes and native pause is acknowledged") {
marked("finished-1080") && !model.resolvingYouTube && model.canTogglePlayback &&
marked("finished-1080") && !model.resolvingStream && model.canTogglePlayback &&
model.state.status == PLAYER_PAUSED && !model.state.seek_pending
}
let cancelledPosition = model.state.position
@@ -179,7 +179,7 @@ struct AutomaticQualityPlaybackChecks {
let originalPosition = model.state.position
model.setYouTubeQuality(1080)
until(model, "failed manual quality switch restores the original native playback state") {
model.errorText != nil && !model.resolvingYouTube && model.canTogglePlayback &&
model.errorText != nil && !model.resolvingStream && model.canTogglePlayback &&
model.state.status == (playing ? PLAYER_PLAYING : PLAYER_PAUSED) &&
(!playing || model.state.position > originalPosition + 0.1)
}