Skip to content

Commit

Permalink
Add UplynkAdBreak and UplynkAd as a customData in SSAI
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegRyz committed Sep 2, 2024
1 parent 462af8b commit a892195
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@ class AdHandler(private val controller: ServerSideAdIntegrationController) {
private val scheduledAds = WeakHashMap<UplynkAd, Ad>()

fun createAdBreak(adBreak: UplynkAdBreak) {
val adBreakInit = AdBreakInit(adBreak.timeOffset.secToMs, adBreak.duration.secToMs)
val adBreakInit = AdBreakInit(
timeOffset = adBreak.timeOffset.secToMs,
maxDuration = adBreak.duration.secToMs,
customData = adBreak
)
val currentAdBreak = controller.createAdBreak(adBreakInit)
adBreak.ads.forEach {
val adInit = AdInit(type = adBreak.type, duration = it.duration.secToMs)
val adInit = AdInit(
type = adBreak.type,
duration = it.duration.secToMs,
customData = it
)
scheduledAds[it] = controller.createAd(adInit, currentAdBreak)
}
}
Expand Down

0 comments on commit a892195

Please sign in to comment.