← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #160889]: How to recognize if a video feed is frozen.

 

Question #160889 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/160889

    Status: Open => Answered

RaiMan proposed the following answer:
Interesting challenge.

--- Your idea taking screenshots and compare:
(made on a Mac, playing a video on my MobileMe gallery,
Webpage is opened and video ready to start)

switchApp("Safari")
vid = selectRegion() # select video region
switchApp("Safari")
type(" "); wait(1) # start video play
while True:
    vidImg1 = capture(vid) # capture 1
    wait(3) # waiting time between captures
    vidImg2 = capture(vid) # capture 2
    
    comp = Finder(vidImg1) # compare base
    comp.find(Pattern(vidImg2).similar(0.99)) # compare
    found = comp.hasNext()  
    comp.destroy()
    if not found: 
       print "running"
    else:
       print "frozen"
       break

this continually prints "running" as long as the video plays. When I hit
space bar to pause, script stops and prints frozen.

Now you have to adapt this to your situation and add the internet
application handling framework.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.