Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
unDEFER
Level 7

Pause on playing cycle

Hello!

By some condition I need to pause playing video just after it starts playing. My code looks like this:

 

function onVideoStateChanged()
    print "VIDEO "; m.Video.state   
    if m.Video.state = "playing"
        if <some condition>
            print "Force pause"
            m.Video.control = "pause"
        end if
    end if
end function

But in the log I see:

 

VIDEO buffering
VIDEO playing
Force pause
VIDEO paused
VIDEO playing

 

And video anyway plays. (I don't remember any other my code which can unpause it by itself). How to get around it?

0 Kudos
2 REPLIES 2\
AbhiK
Level 8

Re: Pause on playing cycle

Can you share some information about the stream you are using?

that might help while identifying the issue.

0 Kudos
unDEFER
Level 7

Re: Pause on playing cycle

I did the trick by the next code:

function onVideoStateChanged()
    print "VIDEO "; m.Video.state   
    if m.Video.state = "playing"
if m.ISaidPause
m.Video.control = "pause"
m.ISaidPause = false
end if
if <some condition> print "Force pause" m.Video.control = "pause"
m.ISaidPause = true end if end if end function

Where m.ISaidPause just boolean flag initialized by false.

0 Kudos