use local example clips for iOS demo flow
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user