diff --git a/mobile/ios-app/App/HermesRepository.swift b/mobile/ios-app/App/HermesRepository.swift index 1a2192a..5fbe45a 100644 --- a/mobile/ios-app/App/HermesRepository.swift +++ b/mobile/ios-app/App/HermesRepository.swift @@ -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 + } } diff --git a/mobile/ios-app/Features/Round/RoundView.swift b/mobile/ios-app/Features/Round/RoundView.swift index 1273c2a..08a85da 100644 --- a/mobile/ios-app/Features/Round/RoundView.swift +++ b/mobile/ios-app/Features/Round/RoundView.swift @@ -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")