Search code examples
javaandroidscreenshotandroid-mediaprojection

Media projection taking screenshots every second (or half a second)


Looking at this example of Media projection taking screenshots I have noticed that screenshoting is not regular. For example, for each screenshot in a row it took this many miliseconds:

174
155
149
1000
998
2014
415
1606
2859
...

My question is: can I force onImageAvailable to take screenshots every certain amount of time? I need to use media projection since I will screenshot outside of my app.


Solution

  • It is not regular because a screenshot is taken only if a new frame is available (something has changed on the screen). As far as I know it is not possible to take screenshots at regular intervals using Media Projection.