Repository navigation
paramountKit 4.0.9.149
·
508 commits
to main
since this release
paramountKit
Kotlin Multiplatform framework for the Maestro Paramount SDK — exposes Stats (live MMA/UFC data), Key Plays (Key Moments), and animated Overlays to tvOS and iOS apps via Swift Package Manager.
Installation
Add to your Package.swift:
dependencies: [
.package(url: "https://github.com/lessthan3/MaestroKit.android", from: "4.0.0")
]Platforms
- tvOS 16+
- iOS 16+
Quick Start
import paramountKit
// 1. Configure the SDK once per session.
let instance = ParamountMaestroSDK.shared.configure(
context: PlatformContext(),
delegate: MyParamountDelegate(),
params: ParamountSDKParameters(
siteId: "your-site-id",
pageId: nil,
metadataValue: "event-metadata-value",
appPackageVersion: "1.0.0",
isProduction: true,
userAgent: "ATV"
),
buildConfigInfo: ParamountBuildConfigInfo(
versionName: "1.0.0",
isDebug: false
)
)
// 2. Observe available panels (Stats, Key Plays, Builder) from the config.
Task {
for await panels in instance.repo.enabledPanels {
print("Panels: \((panels as? [SharedPanelData])?.map { $0.name } ?? [])")
}
}
// 3. Tell the SDK which panel is currently shown (for analytics + gating).
instance.didShowPanel(panelTypeId: ParamountPanelTypes.shared.STATS)
// 4. Detach when done.
instance.detach()Delegate
ParamountEventDelegate is how the SDK talks back to the host app:
class MyParamountDelegate: ParamountEventDelegate {
func shouldShowPanel() { /* host should surface the panel UI */ }
func shouldHidePanel() { /* host should hide it */ }
func trackAction(analytics: [String: String]) { /* forward to your analytics */ }
func trackImpression(analytics: [String: String]) { /* forward to your analytics */ }
func onKeyMomentSelected(contentId: String) { /* play the clip */ }
}Features
Stats panel (MMA/UFC)
Fetches live fight data from the Helios supergraph, polls every 10s, retries with backoff.
let stats = instance.createStatsPresenter()
stats.start()
Task {
for await state in stats.state {
switch onEnum(of: state) {
case .loading:
print("Loading fights…")
case .error(let e):
print("Error: \(e.message)")
case .success(let s):
let event = s.event
print("\(event.name) at \(event.venue)")
for fight in event.fights {
print(" \(fight.redFighter.lastName) vs \(fight.blueFighter.lastName)")
}
}
}
}
stats.destroy()Key Plays panel (Key Moments)
Host app pushes key-moment data into the SDK; the presenter handles sort order + playback progress.
let keyPlays = instance.createKeyPlaysPresenter()
keyPlays.start()
// Push moments from your backend.
instance.updateKeyMomentsData(data: [
ParamountKeyMoment(contentId: "clip-1", title: "Round 1 KO", ...)
])
// Update playback progress as the user watches.
instance.updateKeyMomentsProgress(contentId: "clip-1", progress: 0.42)
// Change sort order.
instance.setKeyMomentsSortOrder(sortOrder: KeyMomentsSortOrder.newestFirst)
Task {
for await state in keyPlays.state {
print("\(state.moments.count) moments, active=\(state.activeContentId ?? "none")")
}
}
keyPlays.destroy()Animated Overlays
Rive-based broadcast overlays driven by the SDK's overlay queue.
let overlays = instance.createOverlayPresenter()
overlays.start()
Task {
for await event in overlays.events {
// event carries the Rive file URL + duration.
}
}
overlays.destroy()Type mapping
| Kotlin | Swift |
|---|---|
StateFlow<T> |
AsyncSequence — consume with for await |
sealed interface / sealed class |
Use switch onEnum(of:) for exhaustive matching |
data object Foo |
FooType.shared singleton |
List<T> |
Array<T> |
Long |
Int64 |
Sealed state pattern
switch onEnum(of: state) {
case .loading:
ProgressView()
case .error(let e):
Text(e.message)
case .success(let s):
ContentView(event: s.event)
}Working example
A complete SwiftUI demo lives in demos/demo-tvos-paramount/ in this repo. It wires up Stats, Key Plays, Overlays, and the panel-visibility bridge.
License
Copyright (c) LessThan3
Installation
.binaryTarget(
name: "paramountKit",
url: "https://github.com/lessthan3/MaestroKit.android/releases/download/paramountKit-4.0.9.149/paramountKit-4.0.9.149.zip",
checksum: "69900b18a3ac205069ba7efd9b87f093267ca32cfaa8a68c55f4819271068de8"
)