How to pause youtube video when click on power button

I’m trying to upload my app on google play but they always reject it.

When I asked them, the reason of rejection was pointed on “youtube videos not pause when the screen off”

I checked some solutions but its not supported on ionic… please try to help me to solve this issue

The screen can turn off more ways than just the power button. You can detect if the app gains or loses focus by listening for ‘pause’ and ‘resume’.

  document.addEventListener("pause", () => {

  }, false);

  document.addEventListener("resume", () => {

  }, false);

You can also subscribe to these events:

1 Like

Solution is work… :heart_eyes: