How to detect inactivity, so videostreaming stops.

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: How to detect inactivity, so videostreaming stops.

Post by [-hh] » Thu Feb 08, 2018 10:32 pm

Android:
I wonder why this method works for some others (as reported on stackoverflow, but they are using Chrome or Firefox).

I also tested here a LC timer together with a javaScript callback. That relies upon that the power button would disable javaScript. This is most probable different between Android versions. So no help here.

I looked also into the YouTube API but that requires info about ActivityState from the browser. There is a solution and I overlooked that it is for Apache cordova (see link below)
** So there arises a feature request for LC to get the ActivityState for Android.

Working with the video element of HTML5 relies also on a combination of visibility, focus and blur, which all are not affected by a screen-off (power button).

In sum: Sorry, can't give more help. This is too much hardware related.

IDE:
My script above works on Mac, indeed sadly not on Windows. But for a desktop version there are more methods available, you know.

____

p.s. The things you mention in your last post relate exactly to **
Apache cordova fires a "pause" event when the power button is pressed and you can use that.

https://stackoverflow.com/questions/368 ... -is-presse

So it's a feature request (**) for LC rather than a bug, not only related to the browser widget.
shiftLock happens

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: How to detect inactivity, so videostreaming stops.

Post by sphere » Fri Feb 09, 2018 8:57 am

Great that you found that link on stackoverflow which exactly matches although that dev uses phonegap.
The other link on that article mentions ?enablejsapi=1 after the youtube link which i tried also, to see if the Javascript and your script would then start work correctly, but it also did not help.

When playing a youtube video in Chrome browser on Android then it stops correctly when pushing the Power button.

So i guess i'll create a feature request (there is already another for the Home button) and see what the LC-devs reply will be.
http://quality.livecode.com/show_bug.cgi?id=20965

Thanks a lot Hermann for your BIG help!

Post Reply

Return to “Android Deployment”