feat: add editable playback queue
This commit is contained in:
@@ -791,6 +791,36 @@ struct CastSessionCheck {
|
||||
require(peer.relayVerified, "Receiver fetches real relay HLS and media bytes")
|
||||
}
|
||||
|
||||
static func queuedPlayback(identity: SecIdentity, executable: String, file: String) async throws {
|
||||
let peer = try Receiver(identity: identity)
|
||||
peer.verifyRelay = true
|
||||
try await peer.start()
|
||||
defer { peer.stop() }
|
||||
let gates = FileManager.default.temporaryDirectory.appendingPathComponent("terebi-cast-queue-" + UUID().uuidString)
|
||||
try FileManager.default.createDirectory(at: gates, withIntermediateDirectories: true)
|
||||
defer { try? FileManager.default.removeItem(at: gates) }
|
||||
let process = Process()
|
||||
process.executableURL = URL(fileURLWithPath: executable)
|
||||
process.arguments = [file, String(peer.port), "queue", gates.path]
|
||||
try process.run()
|
||||
defer { if process.isRunning { process.terminate() } }
|
||||
for stage in ["next", "advanced"] {
|
||||
try await until("queue consumer reaches \(stage)", attempts: 18000) {
|
||||
FileManager.default.fileExists(atPath: gates.appendingPathComponent(stage).path) ||
|
||||
!process.isRunning || peer.failure != nil
|
||||
}
|
||||
require(peer.failure == nil && process.isRunning, peer.failure ?? "queue consumer remains active")
|
||||
require(FileManager.default.fileExists(atPath: gates.appendingPathComponent(stage).path),
|
||||
"queue consumer acknowledges \(stage)")
|
||||
try peer.status(state: "IDLE", idle: "FINISHED")
|
||||
}
|
||||
try await until("queue consumer completes", attempts: 18000) { !process.isRunning || peer.failure != nil }
|
||||
require(peer.failure == nil && !process.isRunning && process.terminationStatus == 0,
|
||||
peer.failure ?? "queue navigation and EOF retain receiver")
|
||||
require(peer.commands.filter { $0.0 == "LOAD" }.count == 3 && peer.relayVerified,
|
||||
"initial, manual-next and automatic-next LOADs fetch real relay media")
|
||||
}
|
||||
|
||||
static func interruptedPlayback(identity: SecIdentity, executable: String, file: String) async throws {
|
||||
for scenario in ["cancel-connect", "cancel-load", "reject-load", "replace-load", "close-load",
|
||||
"replace-active", "close-active", "shutdown-load", "shutdown-active", "disconnect-active"] {
|
||||
@@ -913,6 +943,8 @@ struct CastSessionCheck {
|
||||
print("PASS: native TLS receiver fetches relay and acknowledges PlayerModel handoff/control/disconnect")
|
||||
try await interruptedPlayback(identity: identity, executable: CommandLine.arguments[2], file: CommandLine.arguments[3])
|
||||
print("PASS: interrupted Cast connect/LOAD, rejection, replacement/close, latest intent and acknowledged-position recovery")
|
||||
try await queuedPlayback(identity: identity, executable: CommandLine.arguments[2], file: CommandLine.arguments[3])
|
||||
print("PASS: Cast queue next, automatic advance, final EOF and local restoration")
|
||||
} else {
|
||||
try await behavior(identity: identity)
|
||||
try await seekCoalescing(identity: identity)
|
||||
|
||||
Reference in New Issue
Block a user