Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
RokuNB
Roku Guru

RAF 2.0: Native integration of ads in RSG apps

A new version of RAF (Roku Ad Framework) - 2.0 - has been out for a month.
The major new feature is the library's native support of RSG,
more detail in this blog post https://blog.roku.com/developer/2017/03 ... g-raf-2-0/

A minimal sample demonstrating the new way of use can be found at https://github.com/rokudev/RAF4RSG-sample
See also the release notes

Your questions and comments are welcome - please post as reply below.
0 Kudos
14 REPLIES 14
renojim
Community Streaming Expert

Re: RAF 2.0: Native integration of ads in RSG apps

Welcome, RokuNB! 😉
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
tim_beynart
Channel Surfer

Re: RAF 2.0: Native integration of ads in RSG apps

I am integrating RAF for apps that use server side ad insertion. Once I provide the ad data structure to RAF using importAds(), am I then required to manually call fireTrackingEvents() for each beacon event? 
0 Kudos
RokuNB
Roku Guru

Re: RAF 2.0: Native integration of ads in RSG apps

"tim_beynart" wrote:
I am integrating RAF for apps that use server side ad insertion. Once I provide the ad data structure to RAF using importAds(), am I then required to manually call fireTrackingEvents() for each beacon event? 

No - see at the end of "Requirements for Server Side Ad Insertion" section in the documentation.

In short, you import them with `raf.stitchedAdsInit(adPods)` and then during play periodically call `raf.stitchedAdHandledEvent(msg, player)` with messages (e.g. position) from the player.

Umm, and if you are playing the stitched content in a Video node, then there is a caveat (the documentation needs update): When doing stitchedAdHandledEvent() for native RSG integration, the 2nd param `player` should be:
{ sgNode: video, port: port }

where sgNode is the Video (or subclass thereof) node that is playing the stitched content
and port is a roMessagePort observing the position and state attributes of said sgNode.
0 Kudos
malort
Visitor

Re: RAF 2.0: Native integration of ads in RSG apps

Is it possible to play the ads in a smaller window. e.g. we'd have a video node playing content while the user can browse the UI. This works, however once we plug RAF into the mix, it will play the add full screen. We tested using the sample you've provided and it functions the same way. You can set the the width and height in the Player.brs file to a smaller window, but the ads still play fullscreen.
0 Kudos
RokuNB
Roku Guru

Re: RAF 2.0: Native integration of ads in RSG apps

"malort" wrote:
Is it possible to play the ads in a smaller window. e.g. we'd have a video node playing content while the user can browse the UI. This works, however once we plug RAF into the mix, it will play the add full screen. We tested using the sample you've provided and it functions the same way. You can set the the width and height in the Player.brs file to a smaller window, but the ads still play fullscreen.

I assume you are calling `showAds()` with the 3rd parameter View. Is that "properly-sized" to the part of the screen you want? I believe it's geometry is used to trim the play, as viewport.
0 Kudos
malort
Visitor

Re: RAF 2.0: Native integration of ads in RSG apps

"RokuNB" wrote:
"malort" wrote:
Is it possible to play the ads in a smaller window. e.g. we'd have a video node playing content while the user can browse the UI. This works, however once we plug RAF into the mix, it will play the add full screen. We tested using the sample you've provided and it functions the same way. You can set the the width and height in the Player.brs file to a smaller window, but the ads still play fullscreen.

I assume you are calling `showAds()` with the 3rd parameter View. Is that "properly-sized" to the part of the screen you want? I believe it's geometry is used to trim the play, as viewport.

I just realized that the RAF integration (showAds) creates another player in the "view" (renderable node), it doesn't actually use the video node we have created. I'll look into resizing that renderable node and not the player itself. Thanks for the quick response!
0 Kudos
malort
Visitor

Re: RAF 2.0: Native integration of ads in RSG apps

diff --git a/components/Player.brs b/components/Player.brs
index e1eb65e..2a22701 100644
--- a/components/Player.brs
+++ b/components/Player.brs
@@ -9,7 +9,7 @@
 ' Player

 sub init()
-    m.video = m.top.CreateChild("Video")
+    m.video = m.top.findNode("VideoNode")
 end sub

 sub controlChanged()
diff --git a/components/Player.xml b/components/Player.xml
index 085c0fe..0efe222 100644
--- a/components/Player.xml
+++ b/components/Player.xml
@@ -13,5 +13,11 @@
         <field id="control" type="string" alwaysNotify="true" onChange="controlChanged"/>
     </interface>

+    <children>
+      <Rectangle id="VideoViewPort" width="480" height="270" translation="[100,100]" clippingRect="[0,0,480,270]">
+        <Video id="VideoNode" width="480" height="270"/>
+      </Rectangle>
+    </children>
+
     <script type="text/brightscript" uri="pkg:/components/Player.brs" />
 </component>

RokuNB, see the small diff above to make the videoNode a child of a rectangle. The ad will now play based on the translation, but it doesn't inherit the width/height. I added clippingRect after the fact just to see it sized properly, but that just clips it. I noticed that the boundingRect is still 1280x720. Is there a key to changing the bounding rect that's separate from setting the width/height? 
Here is a quick log from RAF renderer during playback, note the bounding rect.
rafrndr-renderTypeChanged() - client-inserted
added child: Rectangle id: 1 subtype: Rectangle
parent bounding rect: x:  100  y:  100  w:  1280  h:  721

Forgot to include the "view" boundingRect. This is the view being passed to showAds, and it indicates the width/height are set correctly.
?view.boundingrect()
<Component: roAssociativeArray> =
{
    height: 270
    width: 480
    x: 100
    y: 100
}
0 Kudos
tim_beynart
Channel Surfer

Re: RAF 2.0: Native integration of ads in RSG apps

Thanks for the response! However, I am stumped by Neilsen. In the documentation, I see this:
2. Nielsen Digital Ad Ratings Requirements

fireTrackingEvents()[/url:3vpg8rm1] in RAF and ensure that the Nielsen beacons are passed to RAF via that API. It is valid to pass all impression beacons to RAF via this API. For non-Nielsen beacons, RAF will be just a pass-through. [/color]

I am not sure what this means. I thought the Neislen-specific methods in RAF took care of all this? How specifically do I "ensure that the Nielsen beacons are passed to RAF"? Right now I see all the beacons from my ad server in Charles, but I don't see any calls to Neilsen. 
I implemented it this way (heavily edited):

ha ha never mind, I see the beacons in Charles. I was looking for the wrong domain, oops.
For anyone else trying to debug neilsen, the domain is imrworldwide
0 Kudos
Techie
Visitor

Re: RAF 2.0: Native integration of ads in RSG apps

Were you able to set the width and height of the raf ads?
0 Kudos