• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Using Sikuli to check if a video has ended

Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is anyone here familiar with Sikuli?
I am using Sikuli to detect videos on a webpage, and to check if the video has ended.
I have tried 2 different ways of going about this.

The first method is using the event handler in Sikuli.
The event handler will detect for changes in a region (which is an area on the screen that I've declared). When there are changes on the screen (a minimum 50 pixels change), it will print 'Video playing'.
The thing is, if there aren't any changes, the event handler will not do anything. I want to be able to detect when there are no longer any changes on the region and be able to stop the observer.

The second method that I've tried is by comparing my region (which is my active web browser window) to a screen capture of the region I have taken while the video is playing.
If it doesn't match, that means the video is still playing and I will take a new screen capture, which will be run through the while loop again for comparison.
If it matches, it means the video has stopped and will exit the while loop.
It works when it first goes through the loop. The while loop returns null which means the video is playing. However, on the second time it loops, it will exit the while loop and tell me my video has stopped but it clearly hasn't.

Is my logic flawed?

A solution to either method is fine, the end goal is to be able to detect when a video has ended.
    Bookmark Topic Watch Topic
  • New Topic