How to pause youtube video, when user lock phone?

How to pause youtube video, when user lock phone? Please help, I’m using floating view extension to create pup-up youtube player. But when user lock the device youtube video is continue playing, which is a violation ot YouTube terms.

stop the video when app pause or stop.

use these events - image

1 Like

It’s not solved my problem, I want to know that the user device lock or not. is there any way to know user device lock or not?

Have you tried this?

Dear, i tried this blocks, it’s not solved my problem. any way to know user device lock or not ?

you can
go here - Check if the device is in idle / sleep mode (screen off) - Extensions - MIT App Inventor Community

Yes, i tried. But it’s not work for me. Coz I’m using floating extension for float YouTube component. after float the component when app lock YouTube video play in background.

try what i mentioned

for aia file go here - Check if the device is in idle / sleep mode (screen off) - #5 by Anke - Extensions - Niotron Community