use local example clips for iOS demo flow

This commit is contained in:
2026-04-10 11:04:32 +02:00
parent 7b466f0a34
commit 42ea941686
2 changed files with 24 additions and 3 deletions
+19 -2
View File
@@ -173,8 +173,9 @@ final class HermesRepository: ObservableObject {
}
}
private enum MockHermesData {
enum MockHermesData {
static let roundCount = 3
private static let fallbackMediaURL = URL(string: "https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8")!
static func session(localeCode: String, appVersion: String) -> HermesSessionResponse {
HermesSessionResponse(
@@ -240,7 +241,7 @@ private enum MockHermesData {
) -> HermesRound {
let lockAt = now.addingTimeInterval(15)
let settleAt = lockAt.addingTimeInterval(6)
let mediaURL = URL(string: "https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8")!
let mediaURL = localMediaURL(named: "example-round.mov") ?? fallbackMediaURL
let event = HermesEvent(
id: UUID(uuidString: eventID) ?? UUID(),
@@ -319,4 +320,20 @@ private enum MockHermesData {
return HermesRound(event: event, media: media, market: market, oddsVersion: oddsVersion, settlement: settlement)
}
static func revealMediaURL() -> URL {
localMediaURL(named: "example-reveal.mov") ?? fallbackMediaURL
}
private static func localMediaURL(named fileName: String) -> URL? {
let sourceFileURL = URL(fileURLWithPath: #filePath)
let repoRoot = sourceFileURL
.deletingLastPathComponent()
.deletingLastPathComponent()
.deletingLastPathComponent()
.deletingLastPathComponent()
let candidate = repoRoot.appendingPathComponent(fileName)
return FileManager.default.fileExists(atPath: candidate.path) ? candidate : nil
}
}