Timer to stop live feed

Hello,
I need some direction in how to stop play once started with the timer


       if msg.GetIndex() = 1
                    m.timer=createobject("roTimeSpan")
                    m.timer.mark()
                    while true
                        if m.timer.totalseconds < 20 then
                            PlayStart = 0
                        else
                            return showIndex
                        end if
                    end while  

I thought this would work … but it isn’t … any direction in this would be greatly appreciated

Thanks

You should add the timer handling code to the event loop which handles the video. Change the wait to a timed wait, if it isn’t already, and periodically check the elapsed time on the timer.

–Mark