0

Is there some api or method to know if some video is playing on android platform?

I want to stop some background job when a video is playing at foreground.

The api or method had better comes from surfaceflinger, window manager service etc. framework modules.

Thanks.

Tony
  • 57
  • 1
  • 5

1 Answers1

1

The SurfaceFlinger process can know that it is receiving frames at a consistent rate, but it can't know if it's a video or just app animation.

The mediaserver process is responsible for managing the hardware video decoders. It can know if a video is being decoded, but it can't know if the video is being displayed. It won't be involved if the app is using a custom software-only decoder.

There isn't an unequivocal way to detect that a video is being played and presented on the display.

fadden
  • 51,356
  • 5
  • 116
  • 166