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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ struct RoundView: View {
|
||||
}
|
||||
|
||||
phase = .reveal
|
||||
playerCoordinator.play(url: round.media.hlsMasterUrl, startTimeMs: round.media.revealStartMs, rate: 1.0)
|
||||
playerCoordinator.play(url: revealMediaURL(for: round), startTimeMs: round.media.revealStartMs, rate: 1.0)
|
||||
analytics.track("reveal_started", attributes: roundAnalyticsAttributes(round).merging(baseSelectionAttributes(selectedOutcomeID)) { _, new in new })
|
||||
}
|
||||
} catch {
|
||||
@@ -426,6 +426,10 @@ struct RoundView: View {
|
||||
round.market.outcomes.sorted(by: { $0.sortOrder < $1.sortOrder })
|
||||
}
|
||||
|
||||
private func revealMediaURL(for round: HermesRound) -> URL {
|
||||
repository.currentSession?.deviceModel == "Demo Device" ? MockHermesData.revealMediaURL() : round.media.hlsMasterUrl
|
||||
}
|
||||
|
||||
private func promptTitle(for round: HermesRound?) -> String {
|
||||
guard let round else {
|
||||
return localization.string(for: "common.loading")
|
||||
|
||||
Reference in New Issue
Block a user