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: 
JanS7
Reel Rookie

Roku RAF renderer non-fullscreen size

Hi... Is there a way of rendering ADs using RAF in different than fullscreen size? Having video node ex. 640x480, and a parent view of same size. Passing the parent view to 'showAds' as 3rd parameter doesn't respect the sizes as one would expect. thank you.

Roku_Ads Framework version 3.0711

3810 EU, 12.5.5. build.

0 Kudos
1 REPLY 1
PriApocalypse
Binge Watcher

Re: Roku RAF renderer non-fullscreen size

Hello @JanS7, I've spent a lot of time figuring out a way to handle the mini player with RAF. For the project I am working on, it's not viable to use the SGDEX framework due to the significant rework required for integration. SGDEX is an option, but I'll provide a solution using the regular RAF. I believe you are using the showAds() function from the RAF library. You need to create an overlay layer for your view and pass it for showAds(), the view usually is video.getParent(). By doing this, you ensure that the new overlay is on top of the video view. You can then resize it using the overlay scale. In this example, I am using 0.58 of the full 1080 size, but you can adapt it to your size. The translation 0,0 means it will be positioned at the same x and y coordinates as the parent. You can also choose different x and y coordinates if you want to move it, but I believe you want this on the same video player at a reduced size. Here is the example of what I said : 

 

m.overlayNode = createObject("roSGNode", "Group")
view = video.getParent()
if isFullScreen = false
    ' Create a new overlay node to display ads
    m.overlayNode.translation = [0, 0] ' Adjust as needed to position over the video
    m.overlayNode.scale = [0.58, 0.58] ' Adjust the scale as needed
    ' Add the overlay node to the top of the screen (or relevant parent)
    screen = view
    screen.appendChild(m.overlayNode)
end if

'Your Call for ads
video.control = "stop"
if m.top.isFullScreen = true
    keepPlaying = RAF.showAds(adPods, invalid, view)
else
    keepPlaying = RAF.showAds(adPods, invalid, m.overlayNode)
end if

 


I hope this helps you. You will probably face issues with RAF grabbing focus for the overlay but a workaround would be to create a custom ads callback and use RAF.SetTrackingCallback function to identify when the ad started for you to set Focus for your video root parent. It's tricky since RAF needs the focus to itself to handle a lot of internal important stuff.




0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.