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: 
jaxim
Visitor

How to stop a RAF video?

Is there a way to tell the RAF programmatically to stop the video?

The problem is that the user can back out of the video player before the ad info has had time to load. By the time the back button is communicated to the main thread, the ad info has loaded and the ads start playing. In this use case, I would like to manually stop the raf from playing any videos. 


Specifically, the call to raf.getAds() causes a delay, but registering a back button in the screens can register after getAds() is called but before the ad info is gathered. I tried to communicate to the main thread that the back button has been pressed so I can stop the ads from ever being loaded once the getAds() method returns with the proper info, but the main thread gets word of the back button thru the port AFTER the ad loads.

Is there a method to manually stop the RAF from loading or playing videos?
0 Kudos
2 REPLIES 2
RokuNB
Roku Guru

Re: How to stop a RAF video?

This contraption sounds more complicated than it has to be. Passing Back from here to there... why bother?

If for some reason calling getAds() and showAds() sequentially and cannot check for Back between them - that's fine, don't process Back key from before showAds(). showAds() will have the input focus and Back pressed then will exit the ad. Worst case scenario - viewer has to press Back 2nd time; and so they will.

Btw, this issue with being unable to hear a button - that's not RAF issue but sounds rather like code organization item. If wanting to pursue further, post simplified code here to see why that can be
0 Kudos
jaxim
Visitor

Re: How to stop a RAF video?

so in your proposed solution, the user will not be allowed to back out of the screen until the ad info has been gathered and the ad is starting to load/play. 
Ideally from the user's point of view, the user should be able to back out of the video player/RAF screen at any time.

However, you are probably right. This is a bit of an inconvenience to the user but probably not a major issue. 
0 Kudos