imasdk = {} imasdk.CreateAdBreakInfo = function() as object adBreakInfo = createobject("roAssociativeArray") adBreakInfo.duration = -1 adBreakInfo.adPosition = -1 adBreakInfo.totalAds = -1 adBreakInfo.podIndex = -1 adBreakInfo.timeOffset = -1 return adBreakInfo end function imasdk.CreateAdInfo = function() as object adInfo = createobject("roAssociativeArray") adInfo.adid = "" adInfo.duration = -1 adInfo.adtitle = "" adInfo.adDescription = "" adInfo.adSystem = "" adInfo.universalAdIDValue = "" adInfo.universalAdIDRegistry = "" adInfo.advertiserName = "" adInfo.companions = [] adInfo.adBreakInfo = m.CreateAdBreakInfo() adInfo.wrappers = [] adInfo.currentTime = -1 return adInfo end function imasdk.CreateCompanion = function() as object companion = createobject("roAssociativeArray") companion.url = "" companion.apiFramework = invalid companion.width = 0 companion.height = 0 companion.trackingEvents = {} companion.creativeType = "" return companion end function imasdk.ErrorEvent = { ERROR : "0", COULD_NOT_LOAD_STREAM: "1000", STREAM_API_KEY_NOT_VALID: "1002", BAD_STREAM_REQUEST: "1003" INVALID_RESPONSE: "1004" } imasdk.AdEvent = { START: "start", CREATIVE_VIEW: "creativeView", FIRST_QUARTILE: "firstQuartile", IMPRESSION: "impression", MIDPOINT: "midpoint", THIRD_QUARTILE: "thirdQuartile", COMPLETE: "complete", ERROR: "error", PROGRESS: "progress", AD_PERIOD_STARTED: "adPeriodStarted", AD_PERIOD_ENDED: "adPeriodEnded" } imasdk.StreamType = { LIVE: 1, VOD: 2 } imasdk.CreateCuePoint = function() as object cuepoint = {} cuepoint.START = -1 cuepoint.end = -1 cuepoint.hasPlayed = false return cuepoint end function imasdk.CreateError = function() as object ERROR = createobject("roAssociativeArray") ERROR.id = "" ERROR.info = "" ERROR.type = "error" return ERROR end function imasdk.createPlayer = function() as object player = {} player.loadUrl = function(streamInfo as object) as Void end function player.adBreakStarted = function(adBreakInfo as object) as Void end function player.adBreakEnded = function(adBreakInfo as object) as Void end function player.allVideoComplete = function() as Void end function return player end function imasdk.initSdk = function() as Void if m.sdkSingleton = invalid m.sdkSingleton = m.CreateSdkImpl() end if end function imasdk.disableLogging = function() as Void m.enableLogging = false end function imasdk.requestStream = function(streamRequest as object) as object return m.sdkSingleton.requestStream(streamRequest) end function imasdk.getStreamManager = function() as object return m.sdkSingleton.getStreamManager() end function imasdk.setCertificate = function(certificateRef as string) as Void m.certificate = certificateRef end function imasdk.getCertificate = function() as string if m.certificate = invalid return "common:/certs/ca-bundle.crt" end if return m.certificate end function imasdk.enableLogging = true m.sdkSingleton = invalid imasdk.CreateStreamInfo = function() as object streamInfo = {} streamInfo.manifest = "" streamInfo.subtitles = invalid streamInfo.streamId = "" streamInfo.StreamType = -1 streamInfo.format = "hls" return streamInfo end function imasdk.CreateStreamManager = function(streamRequest as object, streamInitResponse as object) as object obj = m.createIMAObject("streamManager") obj.impl = obj.sdk.createStreamManagerImpl(streamRequest, streamInitResponse) return obj end function StreamManager = {} StreamManager.addEventListener = function(event as string, callback as function) as Void m.impl.addEventListener(event, callback) end function StreamManager.onMessage = function(msg as object) as Void m.impl.onMessage(msg) end function StreamManager.START = function() as Void m.impl.START() end function StreamManager.getStreamTime = function(contentTime as integer) as integer return m.impl.getStreamTime(contentTime) end function StreamManager.getContentTime = function(streamTime as integer) as integer return m.impl.getContentTime(streamTime) end function StreamManager.getPreviousCuePoint = function(time as integer) as object return m.impl.getPreviousCuePoint(time) end function StreamManager.getCuePoints = function() as object return m.impl.getCuePoints() end function StreamManager.enableInteractiveAds = function(videoPlayer as object) as object return m.impl.enableInteractiveAds(videoPlayer) end function imasdk.StreamManager = StreamManager imasdk.CreateStreamRequest = function() as object obj = m.createIMAObject("adsRequest") obj.player = invalid obj.assetKey = "" obj.apiKey = "" obj.contentSourceId = "" obj.videoId = "" obj.adTagParameters = "" obj.ppid = "" obj.authToken = "" obj.streamActivityMonitorId = "" obj.format = "hls" obj.testStreamUrl = "" return obj end function imasdk.CreateWrapperInfo = function() as object wrapperInfo = createobject("roAssociativeArray") wrapperInfo.adSystem = "" wrapperInfo.adid = "" wrapperInfo.creativeid = "" wrapperInfo.creativeAdId = "" wrapperInfo.dealId = "" return wrapperInfo end function imasdk.a = function() as object obj = m.createIMAObject("Ad") obj.b = [] obj.c = [] obj.d = [] obj.id = "-1" return obj end function e = {} e.f = function(creativeid as string) as object for each g in m.b if g.id = creativeid then return g end if end for return invalid end function e.h = function() as object return m.b end function e.push = function(g as object) as Void m.b.push(g) end function imasdk["ad"] = e imasdk.i = function(j as object) as object obj = m.createIMAObject("adDataLoader") obj.k = {} obj.l = createobject("roMessagePort") obj.n = invalid obj.j = j obj.o = createobject("roTimespan") obj.p = 10 return obj end function q = {} q.r = function() as boolean s = m.t() m.n = m.sdk.u() l = m.l m.n.setmessageport(l) m.n.seturl(s) m.n.addheader("Accept", "application/json") m.n.asyncgettostring() m.o.mark() if not m.j.v() return m.w() end if return true end function q.w = function() as boolean x = m.l.waitmessage(5000) if m.y(x) z = x.getstring() m.k = parsejson(z) if m.k = invalid m.k = {} end if else return false end if ab = m.bb() ab.sortby("start") return true end function q.t = function() as string if m.j.v() return m.j.cb() end if return m.j.db() end function q.eb = function() as Void if m.o.totalseconds() > m.p m.r() end if x = m.l.getmessage() if m.y(x) z = x.getstring() m.k = parsejson(z) if m.k = invalid m.k = {} end if end if end function q.y = function(x as object) as boolean if x = invalid or type(x) <> "roUrlEvent" return false end if if x.getstring() = "" return false end if return true end function q.fb = function(p as integer) as Void m.p = p end function q.gb = function(hb as string) as string if not m.ib(hb) return "" end if jb = m.k["tags"] kb = jb[hb] return kb["ad"] end function q.lb = function(hb as string) as string if not m.ib(hb) return "" end if jb = m.k["tags"] kb = jb[hb] return kb["type"] end function q.mb = function(nb as string) as object ads = m.k["ads"] if ads = invalid return invalid end if return ads[nb] end function q.ob = function(nb as string) as object e = m.mb(nb) if e = invalid return invalid end if if e["vast"] = invalid return invalid end if pb = m.sdk.qb() rb = pb.parse(e["vast"]) sb = rb.tb() if sb = invalid or sb.b.count() = 0 return invalid end if return sb end function q.ub = function(nb as string, sb as object, adInfo as object) as Void adInfo.adBreakInfo.adPosition = m.vb(nb) adInfo.adBreakInfo.duration = m.wb(nb) adInfo.adBreakInfo.totalAds = m.xb(nb) adInfo.adDescription = sb.yb adInfo.adid = sb.id adInfo.adSystem = sb.zb adInfo.adtitle = sb.ac adInfo.advertiserName = sb.advertiserName adInfo.duration = m.bc(nb) adInfo.wrappers = m.cc(nb) if sb.b.count() > 0 g = sb.b[0] adInfo.universalAdIDValue = g.dc adInfo.universalAdIDRegistry = g.universalAdIDRegistry end if adInfo.companions = [] for each ec in sb.h() for each companion in ec.companions adInfo.companions.push(companion) end for end for end function q.fc = function(sb as object) as object if sb = invalid return invalid end if g = sb.b[0] gc = g.trackingEvents if sb.c <> invalid gc["impression"] = sb.c end if return gc end function q.hc = function() as string return m.adtitle end function q.ic = function() as string return m.adDescription end function q.ib = function(hb as string) as boolean jb = m.k["tags"] if jb = invalid return false end if if jb[hb] = invalid return false end if return true end function q.bc = function(nb as string) as integer e = m.mb(nb) return m.jc(e, "duration") end function q.kc = function(nb as string) as object e = m.mb(nb) if e = invalid return invalid end if lc = e["break"] if lc = invalid return invalid end if mc = m.k["breaks"] if mc = invalid return invalid end if return mc[lc] end function q.wb = function(nb as string) as integer nc = m.kc(nb) return m.jc(nc, "duration") end function q.oc = function(nb as string) as integer pc = m.k["ads"] if pc = invalid return 0 end if adInfo = pc[nb] if adInfo = invalid return 0 end if adPosition = adInfo["position"] lc = adInfo["break"] qc = 0 for each rc in pc sc = pc[rc] tc = sc["break"] uc = sc["position"] vc = sc["duration"] if tc = lc and uc < adPosition qc = qc + vc end if end for return qc end function q.vb = function(nb as string) as integer e = m.mb(nb) return m.jc(e, "position") end function q.xb = function(nb as string) as integer nc = m.kc(nb) return m.jc(nc, "ads") end function q.cc = function(nb as string) as object nc = m.mb(nb) if nc["wrappers"] = invalid or type(nc["wrappers"]) <> "roArray" return [] end if wrappers = [] for each wc in nc["wrappers"] xc = m.sdk.CreateWrapperInfo() xc["system"] = m.yc(wc, "system") xc["adId"] = m.yc(wc, "ad_id") xc["creativeId"] = m.yc(wc, "creative_id") xc["creativeAdId"] = m.yc(wc, "creative_ad_id") xc["dealId"] = m.yc(wc, "deal_id") wrappers.push(xc) end for return wrappers end function q.yc = function(obj as object, zc as string) as string if obj = invalid or obj[zc] = invalid return "" end if return obj[zc] end function q.jc = function(obj as object, zc as string) as integer if obj = invalid or obj[zc] = invalid return -1 end if return obj[zc] end function q.bb = function() as object if m.k["cuepoints"] = invalid return [] end if return m.k["cuepoints"] end function q.bd = function() as object if m.k["times"] = invalid return createobject("roArray", 0, false) end if return m.k["times"] end function q.cd = function(time as integer) as object if m.k["times"] = invalid return createobject("roArray", 0, false) end if dd = time.tostr() ed = m.k["times"] if ed[dd] = invalid return createobject("roArray", 0, false) end if return ed[dd] end function q.fd = function() as boolean jb = m.k["tags"] if jb = invalid return false end if for each zc in jb gd = jb[zc] if gd["type"] <> invalid and gd["type"] = m.sdk.hd.PROGRESS return true end if end for return false end function imasdk["AdDataLoader"] = q imasdk.jd = function() as object obj = m.createIMAObject("Ads") obj.ads = [] return obj end function ads= {} ads.mb = function(adid as string) as object for each e in m.ads if e.id = adid then return e end if end for return invalid end function ads.kd = function() as object return m.ads end function ads.tb = function() as object if m.ads.count() <0 return invalid end if return m.ads[0] end function ads.push = function(e as object) as Void m.ads.push(e) end function imasdk["ads"] = ads imasdk.ld = function() as object obj = {} obj.md = true obj.duration = -1 obj.id = "-1" obj.apiFramework = "" obj.mimetype = "" obj.trackingEvents = {} obj.nd = [] obj.companions = [] obj.dc = "" obj.universalAdIDRegistry = "" return obj end function imasdk.od = function() as object obj = m.createIMAObject("eventCallbacks") obj.pd = {} obj.pd[obj.sdk.AdEvent.START] = [] obj.pd[obj.sdk.AdEvent.FIRST_QUARTILE] = [] obj.pd[obj.sdk.AdEvent.MIDPOINT] = [] obj.pd[obj.sdk.AdEvent.THIRD_QUARTILE] = [] obj.pd[obj.sdk.AdEvent.COMPLETE] = [] obj.pd[obj.sdk.AdEvent.ERROR] = [] obj.pd[obj.sdk.AdEvent.PROGRESS] = [] obj.pd[obj.sdk.AdEvent.AD_PERIOD_STARTED] = [] obj.pd[obj.sdk.AdEvent.AD_PERIOD_ENDED] = [] return obj end function qd = {} qd.addEventListener = function(event as string, callback as function) if m.pd[event] <> invalid m.pd[event].push(callback) end if end function qd.rd = function(event as string, adInfo as object) for each callback in m.pd[event] sd = getglobalaa()["callFunctionInGlobalNamespace"] m.td(adInfo) sd(callback, m.td(adInfo)) end for end function qd.ud = function(vd as integer, wd as string) ERROR = m.sdk.CreateError() ERROR.id = vd ERROR.info = wd sd = getglobalaa()["callFunctionInGlobalNamespace"] sd(m.sdk.AdEvent.ERROR, ERROR) end function qd.td = function(adInfo as object) as object return parsejson(formatjson(adInfo)) end function imasdk["EventCallbacks"] = qd imasdk.hd = { START: "START", FIRST_QUARTILE: "FIRSTQUARTILE", MIDPOINT: "MIDPOINT", THIRD_QUARTILE: "THIRDQUARTILE", COMPLETE: "COMPLETE", PROGRESS: "PROGRESS" } imasdk.xd = { LIVE : "live", yd: "on_demand" } imasdk.zd = { ae: 10 } imasdk.be = { ce: "https://pubads.g.doubleclick.net/ssai/event/", de: "https://pubads.g.doubleclick.net/ondemand/hls/content/" ee: "https://pubads.g.doubleclick.net/ondemand/dash/content/" } imasdk.fe = { ge: 0, he: 1, ie: 2, je: 3 } imasdk.ke = { le: "r.3.33.0" me: "0" } imasdk.ne = { oe: "rdid", pe: "idtype", qe: "msid", re: "an", se: "correlator", te: "frm", ue: "is_lat", ve: "ppid", we: "submodel", xe: "dai-sam-id", ye: "sdki", ze: "sdkv" } imasdk.af = { ge: -1, bf: 0, cf: 1 } imasdk.CreateSdkImpl = function() as object obj = m.createIMAObject("sdkImpl") obj.df = invalid obj.streamInitResponse = invalid obj.streamRequest = invalid return obj end function ef = {} ef.requestStream = function(streamRequest as object) as object m.streamRequest = streamRequest m.df = invalid m.streamInitResponse = m.sdk.ff() return m.streamInitResponse.gf(streamRequest) end function ef.getStreamManager = function() as object if m.df <> invalid return m.df end if hf = m.streamInitResponse.jf() if hf = invalid return invalid end if if hf["type"] = "error" return hf end if m.df = m.sdk.CreateStreamManager(m.streamRequest, m.streamInitResponse) return m.df end function imasdk["SdkImpl"] = ef imasdk.ff = function() as object obj = m.createIMAObject("streamInitResponse") obj.k = invalid obj.n = invalid return obj end function streamInitResponse = {} streamInitResponse.gf = function(streamRequest as object) as object ERROR = m.kf(streamRequest) if ERROR <> invalid return ERROR end if lf = m.mf(streamRequest) m.n = m.sdk.u() l = createobject("roMessagePort") m.n.setmessageport(l) m.n.seturl(lf) if streamRequest.authToken <> "" nf = "DCLKDAI token=" + chr(34) + streamRequest.authToken + chr(34) of = "Authorization" m.n.addheader(of, nf) else if streamRequest.apiKey <> "" nf = "DCLKDAI key=" + chr(34) + streamRequest.apiKey + chr(34) of = "Authorization" m.n.addheader(of, nf) end if pf = m.qf(streamRequest) m.n.asyncpostfromstring(pf) return invalid end function streamInitResponse.kf = function(streamRequest as object) as object rf = m.sf(streamRequest.contentSourceId) tf = m.sf(streamRequest.assetKey) uf = m.sf(streamRequest.videoId) vf = m.sf(streamRequest.testStreamUrl) if vf else if not tf and not rf ERROR = m.sdk.CreateError() ERROR.id = m.sdk.ErrorEvent.BAD_STREAM_REQUEST ERROR.info = "Stream request must contain an assetKey for live or conentSourceId for VOD." return ERROR else if tf and rf ERROR = m.sdk.CreateError() ERROR.id = m.sdk.ErrorEvent.BAD_STREAM_REQUEST ERROR.info = "Cannot determine stream type. Specify only assetKey or contentSourceId." return ERROR else if rf and not uf ERROR = m.sdk.CreateError() ERROR.id = m.sdk.ErrorEvent.BAD_STREAM_REQUEST ERROR.info = "Missing videoId in VOD stream request." return ERROR else if type(streamRequest.apiKey) <> "roString" ERROR = m.sdk.CreateError() ERROR.id = m.sdk.ErrorEvent.BAD_STREAM_REQUEST ERROR.info = "ApiKey must be a string." return ERROR else if type(streamRequest.authToken) <> "roString" ERROR = m.sdk.CreateError() ERROR.id = m.sdk.ErrorEvent.BAD_STREAM_REQUEST ERROR.info = "authToken must be a string." return ERROR else if type(streamRequest.streamActivityMonitorId) <> "roString" ERROR = m.sdk.CreateError() ERROR.id = m.sdk.ErrorEvent.BAD_STREAM_REQUEST ERROR.info = "streamActivityMonitorId must be a string." return ERROR end if return invalid end function streamInitResponse.sf = function(wf as dynamic) as boolean xf = type(wf) if xf = "roString" or xf = "String" return len(wf) > 0 end if return false end function streamInitResponse.jf = function() as object if m.k <> invalid return {type: "ready"} end if l = m.n.getmessageport() x = l.getmessage() if x = invalid return invalid end if if m.yf(x) if x.getresponsecode() = 404 ERROR = m.sdk.CreateError() ERROR.id = m.sdk.ErrorEvent.COULD_NOT_LOAD_STREAM ERROR.info = "The stream could not be loaded." return ERROR else if x.getresponsecode() = 403 ERROR = m.sdk.CreateError() ERROR.id = m.sdk.ErrorEvent.STREAM_API_KEY_NOT_VALID ERROR.info = "The API key was not valid." return ERROR else if x.getresponsecode() = 401 ERROR = m.sdk.CreateError() ERROR.id = m.sdk.ErrorEvent.STREAM_API_KEY_NOT_VALID ERROR.info = "Expected API key was not set." return ERROR end if end if m.k = parsejson(x) if not m.isvalid() ERROR = m.sdk.CreateError() ERROR.id = m.sdk.ErrorEvent.INVALID_RESPONSE ERROR.info = "The servers response was not valid." return ERROR end if return {type: "ready"} end function streamInitResponse.yf = function(x as dynamic) as boolean return type(x) = "roUrlEvent" end function streamInitResponse.mf = function(streamRequest as object) as string url = "" if m.sf(streamRequest.testStreamUrl) url = streamRequest.testStreamUrl else if m.sf(streamRequest.assetKey) url = m.zf(streamRequest) else if m.sf(streamRequest.contentSourceId) url = m.ag(streamRequest) else m.sdk.log("generateStreamRequestUrl: Invalid state reached.") end if return url end function streamInitResponse.qf = function(streamRequest as object) as string bg = {} m.cg(streamRequest, bg) m.dg(bg) return m.eg(bg) end function streamInitResponse.cg = function(streamRequest as object, bg as object) as Void fg = createobject("roRegex", "&", "") gg = fg.split(streamRequest.adTagParameters) hg = createobject("roRegex", "=", "") for each ig in gg jg = hg.split(ig) if jg.count() = 2 zc = jg.getentry(0) gd = jg.getentry(1) if gd <> "" bg[zc] = gd end if end if end for if streamRequest.streamActivityMonitorId <> "" bg[m.sdk.ne.xe] = streamRequest.streamActivityMonitorId end if if streamRequest.ppid <> "" kg = createobject("roRegex", "ppid=", "") if kg.ismatch(streamRequest.adTagParameters) else bg[m.sdk.ne.ve] = streamRequest.ppid end if end if end function streamInitResponse.dg = function(bg as object) as Void lg = m.mg() bg[m.sdk.ne.oe] = lg.getadvertisingid() bg[m.sdk.ne.pe] = "rida" bg[m.sdk.ne.ue] = "0" if lg.isridadisabled() bg[m.sdk.ne.ue] = "1" end if bg[m.sdk.ne.we] = lg.getmodel() bg[m.sdk.ne.ze] = m.sdk.ke.le bg[m.sdk.ne.ye] = m.sdk.ke.me ng = m.og() ac = ng.gettitle() if ac <> invalid and ac <> "" n = createobject("roUrlTransfer") pg = n.escape(ac) bg[m.sdk.ne.re] = pg end if qg = ng.getid() if qg <> invalid and qg <> "" bg[m.sdk.ne.qe] = qg end if bg[m.sdk.ne.te] = "0" bg[m.sdk.ne.se] = m.rg() end function streamInitResponse.eg = function(bg as object) as string sg = "" for each zc in bg.keys() if sg <> "" sg = sg + "&" end if gd = bg[zc] if gd <> "" sg = sg + zc + "=" + gd end if end for return sg end function streamInitResponse.rg = function() as string tg = rnd(32767) ug = rnd(32767) vg = tg.tostr() + ug.tostr() return vg end function streamInitResponse.zf = function(streamRequest as object) as string return m.sdk.be.ce + streamRequest.assetKey + "/streams" end function streamInitResponse.ag = function(streamRequest as object) as string if streamRequest.format = "dash" return m.sdk.be.ee + streamRequest.contentSourceId + "/vid/" + streamRequest.videoId + "/streams" end if return m.sdk.be.de + streamRequest.contentSourceId + "/vid/" + streamRequest.videoId + "/streams" end function streamInitResponse.mg = function() as object return createobject("roDeviceInfo") end function streamInitResponse.og = function() as object return createobject("roAppInfo") end function streamInitResponse.isvalid = function() as boolean if m.k = invalid return false end if StreamType = m.k.lookup("stream_type") if not m.wg("stream_id") m.sdk.log("Internal Error: stream_id missing.") end if if StreamType = m.sdk.xd.LIVE if not m.wg("id3_events_url") m.sdk.log("Internal Error: No tracking pings.") end if else if StreamType = m.sdk.xd.yd if not m.wg("time_events_url") m.sdk.log("Internal Error: No tracking pings.") end if else m.sdk.log("Internal Error: Streamtype invalid.") end if return m.wg("stream_manifest") end function streamInitResponse.v = function() as boolean return m.k["stream_type"] = m.sdk.xd.LIVE end function streamInitResponse.wg = function(zc as string) as boolean gd = m.k.lookup(zc) return gd <> invalid and gd <> "" end function streamInitResponse.xg = function() as string if m.k = invalid or m.k["stream_id"] = invalid return "" end if return m.k["stream_id"] end function streamInitResponse.yg = function() as string return m.k["stream_type"] end function streamInitResponse.zg = function() as string return m.k["stream_manifest"] end function streamInitResponse.ah = function() as string if m.k = invalid or m.k["manifest_format"] = invalid return "" end if return m.k["manifest_format"] end function streamInitResponse.bh = function() as integer ch = m.k["polling_frequency"] if ch = invalid ch = m.sdk.zd.ae end if return ch end function streamInitResponse.dh = function() as object subtitles = m.k["subtitles"] if subtitles <> invalid and type(subtitles) = "roArray" return m.k["subtitles"] end if return [] end function streamInitResponse.cb = function() as string return m.k["id3_events_url"] end function streamInitResponse.db = function() as string return m.k["time_events_url"] end function imasdk["StreamInitResponse"] = streamInitResponse imasdk.createStreamManagerImpl = function(streamRequest as object, streamInitResponse as object) as object obj = m.createIMAObject("streamManagerImpl") obj.player = streamRequest.player obj.eh = createobject("roAssociativeArray") obj.adInfo = obj.sdk.CreateAdInfo() obj.nb = "" obj.trackingEvents = invalid obj.qd = obj.sdk.od() obj.streamInitResponse = streamInitResponse obj.q = obj.sdk.i(streamInitResponse) obj.fh = -1 obj.gh = -1 obj.hh = false obj.ih = false obj.jh = -1 obj.kh = obj.sdk.af.ge obj.lh = {} obj.lh[obj.sdk.hd.START] = 1 obj.lh[obj.sdk.hd.FIRST_QUARTILE] = 1 obj.lh[obj.sdk.hd.MIDPOINT] = 1 obj.lh[obj.sdk.hd.THIRD_QUARTILE] = 1 obj.lh[obj.sdk.hd.PROGRESS] = 1 obj.mh = 0 obj.nh = 0 obj.currentTime = 0 obj.oh = invalid obj.ph = createobject("roMessagePort") return obj end function qh = {} qh.START = function() as Void m.q.fb(m.streamInitResponse.bh()) m.q.r() info = m.sdk.CreateStreamInfo() info.manifest = m.streamInitResponse.zg() info.subtitles = m.streamInitResponse.dh() info.streamId = m.streamInitResponse.xg() info.format = m.streamInitResponse.ah() if m.streamInitResponse.v() info.StreamType = m.sdk.StreamType.LIVE else info.StreamType = m.sdk.StreamType.VOD end if m.player.loadUrl(info) end function qh.onMessage = function(msg as object) as Void fe = m.rh(msg) if fe = m.sdk.fe.je m.sdk.log("All video is completed - full result") m.player.allVideoComplete() else if fe = m.sdk.fe.he m.sh(msg) end if if m.streamInitResponse.v() m.th(msg) else m.uh(msg) end if end function qh.rh = function(msg as object) as integer if m.vh(msg) if msg.isplaybackposition() return m.sdk.fe.he else if msg.istimedmetadata() return m.sdk.fe.ie else if msg.isfullresult() return m.sdk.fe.je end if else if m.wh(msg) xh = msg.getfield() if xh = "position" return m.sdk.fe.he else if xh = "timedMetaData" return m.sdk.fe.ie else if xh = "state" if msg.getdata() = "finished" return m.sdk.fe.je end if end if end if return m.sdk.fe.ge end function qh.yh = function(msg as object) as integer if m.vh(msg) return msg.getindex() else if m.wh(msg) return msg.getdata() end if end function qh.th = function(msg as object) as Void m.q.eb() fe = m.rh(msg) if fe <> m.sdk.fe.ie return end if if m.vh(msg) zh = msg.getinfo() for each zc in zh ai = zh[zc] m.bi(ai) end for else if m.wh(msg) ai = msg.getdata()["TXXX"] m.bi(ai) end if end function qh.sh = function(msg as object) as Void m.currentTime = m.yh(msg) m.ci() if not m.hh return end if if m.adInfo.adBreakInfo.duration <> invalid and m.adInfo.adBreakInfo.duration > 0 if m.currentTime > m.nh + m.adInfo.adBreakInfo.duration + 3 m.ei() return end if end if if m.nb <> "" and m.adInfo.duration <> invalid and m.adInfo.duration > 0 if m.currentTime > m.mh + m.adInfo.duration + 3 m.ei() return end if end if m.adInfo.currentTime = m.currentTime - m.mh m.qd.rd(m.sdk.AdEvent.PROGRESS, m.adInfo) end function qh.fi = function(msg as object) as Void if m.oh <> invalid gi = m.sdk.hi() gi.stitchedadhandledevent(msg, m.oh) end if end function qh.uh = function(msg as object) as Void m.fi(msg) fe = m.rh(msg) if fe <> m.sdk.fe.he return end if currentTime = m.yh(msg) if currentTime = m.fh or currentTime = m.gh return end if m.gh = m.fh m.fh = currentTime if m.fh <> m.gh + 1 m.ii(currentTime - 1) end if m.ii(currentTime) end function qh.ii = function(time as integer) as Void ji = m.q.cd(time) for each event in ji nb = event["ad"] ki = event["type"] if ki <> invalid and nb <> invalid m.li(nb, ki, time) end if end for end function qh.wh = function(msg as object) as boolean return type(msg) = "roSGNodeEvent" end function qh.vh = function(msg as object) as boolean return type(msg) = "roVideoScreenEvent" or type(msg) = "roVideoPlayerEvent" end function qh.mi = function(msg as object) as boolean return msg.isstatusmessage() and msg.getmessage() = "startup progress" end function qh.ni = function(nb as string) as boolean return m.eh[nb] <> invalid end function qh.oi = function(nb as string, time as integer) as Void if m.ni(nb) m.nb = "" return end if m.eh[nb] = true m.nb = nb sb = m.q.ob(nb) if sb = invalid m.adInfo.adtitle = "" m.adInfo.adDescription = "" else m.q.ub(nb, sb, m.adInfo) end if m.trackingEvents = m.q.fc(sb) adBreakInfo = m.adInfo.adBreakInfo if (adBreakInfo.adPosition = 1) adBreakInfo.timeOffset = time adBreakInfo.podIndex = m.pi(time) m.player.adBreakStarted(adBreakInfo) m.hh = true m.nh = time end if m.mh = time m.qi(m.sdk.AdEvent.START) m.ri(m.sdk.AdEvent.IMPRESSION) m.ri(m.sdk.AdEvent.CREATIVE_VIEW) end function qh.si = function(nb as string, time as integer, event as string) as Void m.nb = nb sb = m.q.ob(nb) if sb = invalid m.trackingEvents = invalid m.adInfo.adtitle = "" m.adInfo.adDescription = "" else m.q.ub(nb, sb, m.adInfo) end if adBreakInfo = m.adInfo.adBreakInfo ti = time - m.ui(event) vi = ti - m.q.oc(nb) m.mh = ti m.nh = vi adBreakInfo.timeOffset = vi m.player.adBreakStarted(adBreakInfo) m.hh = true end function qh.wi = function() as Void m.qi(m.sdk.AdEvent.COMPLETE) m.nb = "" m.trackingEvents = invalid adBreakInfo = m.adInfo.adBreakInfo if (adBreakInfo.adPosition = adBreakInfo.totalAds) m.ei() end if end function qh.ei = function() as Void adBreakInfo = m.adInfo.adBreakInfo m.player.adBreakEnded(adBreakInfo) m.hh = false m.nb = "" end function qh.bi = function(xi as dynamic) as Void yi = type(xi) if yi <> "roString" and yi <> "String" return end if event = m.q.lb(xi) nb = m.q.gb(xi) if event <> "" and nb <> "" m.li(nb, event, m.currentTime) end if end function qh.li = function(nb as string, event as string, time as integer) as Void event = ucase(event) m.zi(event) if event = m.sdk.hd.START m.oi(nb, time) return end if if m.nb <> nb if m.aj(nb, event) m.si(nb, time, event) else m.nb = "" return end if end if if event = m.sdk.hd.FIRST_QUARTILE m.qi(m.sdk.AdEvent.FIRST_QUARTILE) else if event = m.sdk.hd.MIDPOINT m.qi(m.sdk.AdEvent.MIDPOINT) else if event = m.sdk.hd.THIRD_QUARTILE m.qi(m.sdk.AdEvent.THIRD_QUARTILE) else if event = m.sdk.hd.COMPLETE m.wi() else if event = m.sdk.hd.PROGRESS else m.sdk.log("handleEvent:Unexpected event type " + event) end if end function qh.qi = function(ki as string) as Void m.qd.rd(ki, m.adInfo) m.ri(ki) end function qh.ri = function(ki as string) as Void if m.trackingEvents <> invalid and m.trackingEvents[ki] <> invalid m.sdk.bj(m.trackingEvents[ki], ki) end if end function qh.dh = function() as object return m.streamInitResponse.dh() end function qh.addEventListener = function(event as string, callback as function) as Void m.qd.addEventListener(event, callback) end function qh.getStreamTime = function(contentTime as integer) as integer ab = m.q.bb() if m.streamInitResponse.v() or type(ab) <> "roArray" return contentTime end if cj = 0 dj = contentTime for each cuepoint in ab ej = (cuepoint["start"] * 1000) - cj if ej >= dj return cj + dj else dj = dj - ej end if cj = cuepoint["end"] * 1000 end for return cj + dj end function qh.getContentTime = function(streamTime as integer) as integer ab = m.q.bb() if streamTime < 0 streamTime = m.currentTime * 1000 end if if m.streamInitResponse.v() or type(ab) <> "roArray" return streamTime end if cj = 0 contentTime = 0 for each cuepoint in ab ej = (cuepoint["start"] * 1000) - cj if streamTime <= (cuepoint["start"] * 1000) return contentTime + (streamTime - cj) else if streamTime <= cuepoint["end"] * 1000 return contentTime + ej else contentTime = contentTime + ej end if cj = cuepoint["end"] * 1000 end for return contentTime + (streamTime - cj) end function qh.fj = function(gj as object) as object hasPlayed = false ji = m.q.cd(gj.START) for each event in ji nb = event["ad"] ki = ucase(event["type"]) if nb <> invalid and ki = m.sdk.hd.START and m.ni(nb) hasPlayed = true exit for end if end for hj = m.sdk.CreateCuePoint() hj["start"] = gj["start"] hj["end"] = gj["end"] hj["hasPlayed"] = hasPlayed return hj end function qh.getCuePoints = function() as object ab = m.q.bb() ij = [] for each cuepoint in ab jj = m.fj(cuepoint) ij.push(jj) end for return ij end function qh.getPreviousCuePoint = function(time as integer) as object ab = m.q.bb() kj = invalid for each cuepoint in ab if time >= cuepoint.START kj = cuepoint else exit for end if end for if kj = invalid return invalid end if return m.fj(kj) end function qh.pi = function(time as integer) as integer ab = m.q.bb() lj = 0 for each cuepoint in ab if time = cuepoint.START return lj end if lj = lj + 1 end for return -1 end function qh.enableInteractiveAds = function(videoPlayer as object) as Void m.sdk.log("Deprecated: enableInteractiveAds is deprecated.") m.sdk.log("Instead use companion data to activate interactive ads.") if m.streamInitResponse.v() or videoPlayer = invalid return end if mj = false if type(videoPlayer) = "roVideoPlayer" mj = true m.oh = m.nj(videoPlayer) else if type(videoPlayer) = "roAssociativeArray" if videoPlayer.doesexist("port") and videoPlayer.doesexist("sgnode") mj = true end if m.oh = videoPlayer end if if not mj m.sdk.log("Warning: Invalid object for interactive ads.") return end if m.oj() end function qh.oj = function() as Void pb = m.sdk.qb() pj = m.sdk.qj() adpods = [] ed = m.q.bd() for each time in ed for each event in ed[time] if ucase(event["type"]) = m.sdk.hd.START e = m.q.mb(event["ad"]) if e <> invalid ads = pb.parse(e["vast"]) sb = ads.tb() if pj.rj(sb) sj = pj.tj(sb, val(time, 10)) adpods.push(sj) end if end if end if end for end for uj = m.sdk.hi() uj.stitchedadsinit(adpods) end function qh.nj = function(vj as object) as object xc = {} xc["GetMessagePort"] = function() as object return m.player.getmessageport() end function xc["Pause"] = function() as boolean return m.player.pause() end function xc["Resume"] = function() as boolean return m.player.resume() end function xc["Seek"] = function(wj as integer) as boolean return m.player.seek(wj) end function xc["Play"] = function() as boolean return m.player.play() end function xc["Stop"] = function() as boolean return m.player.stop() end function xc.player = vj return xc end function qh.ui = function(event as string) as integer xj = 0 if event = m.sdk.hd.FIRST_QUARTILE xj = 0.25 * m.adInfo.duration else if event = m.sdk.hd.MIDPOINT xj = 0.50 * m.adInfo.duration else if event = m.sdk.hd.THIRD_QUARTILE xj = 0.75 * m.adInfo.duration else if event = m.sdk.hd.COMPLETE xj = 1 * m.adInfo.duration end if return int(xj) end function qh.aj = function (nb as string, event as string) as boolean if not m.streamInitResponse.v() return false end if if m.hh or m.ni(nb) return false end if yj = m.sdk.hd return event = yj.FIRST_QUARTILE or event = yj.MIDPOINT or event = yj.THIRD_QUARTILE end function qh.zi = function(event as string) as Void if not m.lh.doesexist(event) return end if if event = m.sdk.hd.PROGRESS m.kh = m.sdk.af.cf end if if m.kh = m.sdk.af.ge if m.q.fd() m.kh = m.sdk.hd.cf else m.kh = m.sdk.hd.bf end if end if if m.kh = m.sdk.af.bf return end if m.jh = m.currentTime if not m.ih m.qd.rd(m.sdk.AdEvent.AD_PERIOD_STARTED, m.adInfo) m.ih = true end if end function qh.ci = function() as Void if not m.streamInitResponse.v() return end if if not m.ih return end if zj = abs(m.currentTime - m.jh) if zj > 2.5 m.jh = -1 m.ih = false m.qd.rd(m.sdk.AdEvent.AD_PERIOD_ENDED, m.adInfo) end if end function imasdk["StreamManagerImpl"] = qh imasdk.ak = createobject("roRegex", "\[[A-Za-z0-9\-\_]*\]", "") imasdk.bk = createobject("roRegex", ".*(doubleclick\.net|googleadservices\.com)", "") imasdk.ck = createobject("roRegex", "\/(pagead\/conversion)", "") imasdk.dk = createobject("roRegex", "(?=.*\bai\=\b)(?=.*\bsigh\=\b)", "") imasdk.ek = createobject("roRegex", "\/pcs\/view", "") imasdk.fk = createobject("roRegex", "(?=.*\bxai\=\b)(?=.*\bsig\=\b)", "") imasdk.gk = createobject("roRegex", "imrworldwide\.com", "") imasdk.hk = createobject("roRegex", "scorecardresearch", "") imasdk.loadUrl = function(url as string) as string l = m.ik() n = m.u() n.seturl(url) n.setport(l) n.asyncgettostring() jk = 4000 event = l.waitmessage(jk) if event = invalid m.log("Event is invalid. Possible timeout on loading URL") return "" else if m.yf(event) kk = event.getresponsecode() if kk < 0 m.log("Transfer failed reason: " + event.getfailurereason()) return "" else if kk <> 200 m.log("Transfer failed, got code " + lk(kk)) return "" end if mk = event.getstring() return mk else m.log("Unknown Ad Request Event: " + type(event)) end if return "" end function imasdk.yf = function(object) as boolean return type(event) = "roUrlEvent" end function imasdk.nk = function(ok as string) as object pk = createobject("roXmlElement") if ok = invalid or not pk.parse(ok) then return invalid end if return pk end function imasdk.hi = function() as object return roku_ads() end function imasdk.qk = function(rk as string) as boolean return m.gk.ismatch(rk) or m.hk.ismatch(rk) end function imasdk.sk = function(rk as string) as boolean if not m.bk.ismatch(rk) return false end if if m.ck.ismatch(rk) and m.dk.ismatch(rk) return true else if m.ek.ismatch(rk) and m.fk.ismatch(rk) return true end if return false end function imasdk.tk = function(rk as string) as string uk = m.ak.replaceall(rk, "") if m.sk(uk) uk = uk + "&ssss=gima&sdkv=" + m.ke.le end if return uk end function imasdk.bj = function(be as object, vk as string) as Void wk = createobject("roArray", 5, true) for each rk in be if m.qk(rk) m.xk(rk, vk) else yk = {} yk.l = m.ik() yk.n = m.u() rk = m.tk(rk) yk.n.seturl(rk) yk.n.setport(yk.l) yk.n.asyncgettostring() wk.push(yk) end if end for zk = createobject("roTimespan") zk.mark() al = 0 while not wk.isempty() and zk.totalmilliseconds() < 5000 yk = wk.getentry(al) x = yk.l.waitmessage(10) if x <> invalid wk.delete(al) end if al = al + 1 if al >= wk.count() al = 0 end if end while end function imasdk.xk = function(rk as string, vk as string) as Void bl = {} bl["event"] = vk bl["url"] = rk bl["triggered"] = false cl = [bl] dl = {} dl["tracking"] = cl dl["adServer"] = invalid el = {} el["type"] = vk uj = m.hi() if m.getCertificate() <> "common:/certs/ca-bundle.crt" uj.setcertificatesfile(m.getCertificate()) end if hf = uj.firetrackingevents(dl, el) end function imasdk.ik = function() as object return createobject("roMessagePort") end function imasdk.createIMAObject = function(fl as string) as object obj = { sdk: m } if type(m[fl]) = "roAssociativeArray" then obj.append(m[fl]) end if return obj end function imasdk.log = function(x) as Void if m.enableLogging gl = createobject("roDateTime") hl = "IMA (" + gl.gethours().tostr() + ":" + gl.getminutes().tostr() + ":" + gl.getseconds().tostr() + "): " print hl; x end if end function imasdk.il = function(time as string) as integer jl = box(time).tokenize(":") kl = jl[0].toint() * 3600 kl = kl + jl[1].toint() * 60 kl = kl + jl[2].toint() return kl end function imasdk.u = function() as object m.n = createobject("roUrlTransfer") m.n.setcertificatesfile(m.getCertificate()) m.n.addheader("X-Roku-Reserved-Dev-Id", "") m.n.initclientcertificates() if m.getCertificate() <> "common:/certs/ca-bundle.crt" m.n.enablehostverification(false) m.n.enablepeerverification(false) end if return m.n end function getglobalaa()["callFunctionInGlobalNamespace"] = function(sd as function, wf as object) as Void sd(wf) end function imasdk.ll = function() as object obj = m.createIMAObject("vastAd") obj.b = [] obj.c = [] obj.d = [] obj.id = "-1" obj.ac = "" obj.yb = "" obj.zb = "" obj.advertiserName = "" return obj end function sb = {} sb.f = function(creativeid as string) as object for each g in m.b if g.id = creativeid then return g end if end for return invalid end function sb.h = function() as object return m.b end function sb.push = function(g as object) as Void m.b.push(g) end function imasdk["vastAd"] = sb imasdk.qb = function() as object obj = m.createIMAObject("VastParser") return obj end function pb = {} pb.parse = function(ok as object) as object ads = m.sdk.jd() ml = m.sdk.nk(ok) if ml = invalid return ads end if if ml.getnamedelementsci("ad") <> invalid then for each nl in ml.getnamedelementsci("ad") e = m.ol(nl) ads.push(e) end for end if return ads end function pb.ol = function(ml as object) as object e = m.sdk.ll() if ml.hasattribute("id") then e.id = ml.getattributes().id end if for each nl in ml.getnamedelementsci("inline") m.pl(nl, e) end for return e end function pb.pl = function(ml as object, e as object) as Void m.ql(ml, e, "ad") end function pb.rl = function(ml as object, e as object) as Void e.c.push(m.sl(ml)) end function pb.tl = function(ml as object, e as object) as Void e.ac = m.sl(ml) end function pb.ul = function(ml as object, e as object) as Void e.yb = m.sl(ml) end function pb.vl = function(ml as object, e as object) as Void e.zb = m.sl(ml) end function pb.wl = function(ml as object, e as object) as Void e.advertiserName = m.sl(ml) end function pb.xl = function(ml as object, e as object) as Void e.d.push(m.sl(ml)) end function pb.yl = function(ml as object, e as object) as Void for each nl in ml.getnamedelementsci("creative") m.zl(nl, e) end for end function pb.zl = function(ml as object, e as object) as Void g = m.sdk.ld() if ml.hasattribute("id") g.id = ml.getattributes().id end if if ml.hasattribute("apiFramework") g.apiFramework = ml.getattributes()["apiFramework"] end if e.b.push(g) for each nl in ml.getnamedelementsci("linear") m.am(nl, g) end for for each nl in ml.getnamedelementsci("companionads") m.bm(nl, g) end for end function pb.bm = function(ml as object, g as object) as Void g.md = false for each nl in ml.getnamedelementsci("companion") m.cm(nl, g) end for end function pb.am = function(ml as object, g as object) as Void g.md = true m.ql(ml, g, "creative") end function pb.dm = function(ml as object, g as object) as Void g.duration = m.sdk.il(m.sl(ml)) end function pb.em = function(ml as object, fm as object) as Void if not ml.hasattribute("event") return end if event = ml.getattributes()["event"] if event = invalid m.sdk.log("Tracking element without event id.") return end if if fm.trackingEvents[event] = invalid fm.trackingEvents[event] = [] end if fm.trackingEvents[event].push(m.sl(ml)) end function pb.gm = function(ml as object, obj as object) as Void for each nl in ml.getnamedelementsci("tracking") m.em(nl, obj) end for end function pb.hm = function(ml as object, g as object) as Void for each nl in ml.getnamedelementsci("mediafile") m.im(nl, g) end for end function pb.jm = function(ml as object, g as object) as Void g.dc = m.sl(ml) if g.dc = "" and ml.hasattribute("idValue") g.dc = ml.getattributes()["idValue"] end if if ml.hasattribute("idRegistry") g.universalAdIDRegistry = ml.getattributes()["idRegistry"] end if end function pb.im = function(ml as object, g as object) as Void km = {} km.append(ml.getattributes()) km.url = m.sl(ml) g.nd.push(km) end function pb.cm = function(ml as object, g as object) as Void companion = m.sdk.CreateCompanion() if ml.hasattribute("width") width = strtoi(ml.getattributes()["width"]) if width <> invalid companion.width = width end if end if if ml.hasattribute("height") height = strtoi(ml.getattributes()["height"]) if height <> invalid companion.height = height end if end if if ml.hasattribute("apiFramework") companion.apiFramework = ml.getattributes()["apiFramework"] end if m.ql(ml, companion, "companion") g.companions.push(companion) end function pb.lm = function(ml as object, obj as object) as Void if ml.hasattribute("creativeType") obj.creativeType = ml.getattributes()["creativeType"] end if obj.url = m.sl(ml) end function pb.ql = function(ml as object, fm as object, mm as string) as Void if ml.getchildelements() = invalid then return end if for each nl in ml.getchildelements() nm = lcase(nl.getname()) if lcase(mm) = "ad" if nm = "impression" m.rl(nl, fm) else if nm = "error" m.xl(nl, fm) else if nm = "creatives" m.yl(nl, fm) else if nm = "adtitle" m.tl(nl, fm) else if nm = "description" m.ul(nl, fm) else if nm = "adsystem" m.vl(nl, fm) else if nm = "advertiser" m.wl(nl, fm) end if else if lcase(mm) = "creative" if nm = "duration" m.dm(nl, fm) else if nm = "trackingevents" m.gm(nl, fm) else if nm = "mediafiles" m.hm(nl, fm) else if nm = "universaladid" m.jm(nl, fm) end if else if lcase(mm) = "companion" if nm = "staticresource" m.lm(nl, fm) else if nm = "trackingevents" m.gm(nl, fm) end if end if end for end function pb.sl = function(ml as object) if ml = invalid return "" end if if ml.gettext() = invalid return "" end if return ml.gettext().trim() end function imasdk["vastParser"] = pb imasdk.qj = function() as object obj = m.createIMAObject("vastToRafConverter") return obj end function om = {} om.rj = function(sb as object) as boolean if sb.b.count() < 2 return false end if pm = m.pm(sb) qm = m.qm(sb) if pm = invalid or qm = invalid return false end if return true end function om.rm = function(sb as object, currentTime as integer) as object adpods = [] sm = m.tj(sb, currentTime) adpods.push(sm) return adpods end function om.pm = function(sb as object) as object for each g in sb.b if g.companions.count() = 0 return g end if end for return invalid end function om.qm = function(sb as object) as object for each g in sb.b. if g.apiFramework <> invalid and g.apiFramework <> "" return g end if for each companion in g.companions if companion.apiFramework <> invalid and companion.apiFramework <> "" return g end if end for end for return invalid end function om.tj = function(sb as object, currentTime as integer) as object sm = {} if sb.b.count() = 0 return sm end if pm = m.pm(sb) sm["viewed"] = false sm["renderSequence"] = "midroll" sm["duration"] = pm.duration sm["renderTime"] = currentTime sm["backfilled"] = false sm["ads"] = [] sm["ads"].push(m.tm(sb)) return sm end function om.tm = function(sb as object) as object e = {} pm = m.pm(sb) qm = m.qm(sb) um = {} um["url"] = "" um["mimetype"] = "application/json" e["duration"] = pm.duration e["streamFormat"] = m.vm(qm) e["adServer"] = sb.zb e["adId"] = sb.id e["adTitle"] = sb.ac e["creativeId"] = pm.id e["streams"] = [] e["streams"].push(um) e["tracking"] = [] e["companionAds"] = m.wm(qm) return e end function om.vm = function(g as object) as string if g.apiFramework <> invalid and g.apiFramework <> "" return g.apiFramework end if for each companion in g.companions if companion.apiFramework <> invalid and companion.apiFramework <> "" return companion.apiFramework end if end for return "" end function om.wm = function(qm as object) as object companions = [] for each xm in qm.companions if xm.creativeType = "application/json" companion = {} companion["url"] = xm.url companion["width"] = xm.width companion["height"] = xm.height companion["mimeType"] = xm.creativeType companion["tracking"] = m.ym(xm.trackingEvents) companion["provider"] = xm.apiFramework companions.push(companion) end if end for return companions end function om.ym = function(trackingEvents as object) as object ji = [] for each zc in trackingEvents for each url in trackingEvents[zc] event = {} event["event"] = zc event["url"] = url event["triggered"] = false ji.push(event) end for end for return ji end function imasdk["vastToRafConverter"] = om