This is all BrightScript, no SceneGraph. roVideoPlayer is the mechanism for playback.
I'm using RAF according to the docs. The content is HLS with ads stitched in.
The back button and UI works as expected when used outside of a RAF ad.
We import our ad beacons like this:
m.adIface = Roku_Ads()
m.adIface.setDebugOutput(true)
m.adIface.enableAdBufferMessaging(false,false)
m.adIface.setAdPrefs(false,0)
m.adIface.enableNielsenDAR(true)
m.adIface.stitchedAdsInit({a bunch of ad beacons})
The message loop looks something like this:
Function CustomVideoPlayer_ListenForEvents()
m.ShouldExit = false
while NOT m.shouldExit
msg = wait(100, m.messagePort)
If Type(msg) = "roImageCanvasEvent" Then
? "[APP VIDEO] roImageCanvasEvent index: "; msg.GetIndex()
If msg.isRemoteKeyPressed()
index = msg.GetIndex()
? "Remote button pressed: " + index.tostr()
If index = 0 OR index = 23
m.shouldExit = true
exit while
... snip ...
curAd = m.RAF.adIface.stitchedAdHandledEvent(msg, m.videoScreen)
if curAd <> invalid
? "RAF current ad event fired."
? curAd
? " ********* "
end if
...snip...
end while
if m.videoScreen <> invalid
m.videoScreen.close()
end if
if m.uiScreen <> invalid :m.uiScreen.close():end if
m.videoScreen = invalid
m.uiScreen = invalid
End Function
debug output when back button pressed:
RAF current ad event fired.
<Component: roAssociativeArray> =
{
adcompleted: false
adexited: false
adindex: 1
adpodindex: 1
evthandled: true
}
*********
[APP VIDEO] roImageCanvasEvent index: 0
Remote button pressed: 0