Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot enable noSleep programatically on Android #10

Closed
nilnullzip opened this issue Dec 14, 2015 · 1 comment
Closed

Cannot enable noSleep programatically on Android #10

nilnullzip opened this issue Dec 14, 2015 · 1 comment

Comments

@nilnullzip
Copy link

Thanks for this project! However, I have encountered this issue.

The demo page works fine on Android. And porting the code into my app with the button to enable noSleep also works. However, enabling noSleep via Javascript code that does not originate from a button click does not work. In my case I want the page to start with noSleep enabled.

I went so far as to include the button and use $('#toggle').click() to click it programatically seconds after the page was loaded. But still doesn't work. I printed noSleep.noSleepVideo.paused and found that the video was remaining paused despite the play() execution. I have come to the conclusion that Android inhibits the playing of video without user interaction. I suspect it is related to the same reason that autoplay is disabled:

https://www.aerserv.com/why-does-video-autoplay-on-mobile-devices-not-work/

@iambumblehead
Copy link

@nilnullzip https://code.google.com/p/chromium/issues/detail?id=178297

Android chrome's media.play must originate from a user gesture to succeed. Methods to initiate 'fullscreen' browser mode are restricted in this way as well.

Mobile Safari has user-restricted calls but media.play is not one of them

https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/ControllingMediaWithJavaScript/ControllingMediaWithJavaScript.html#//apple_ref/doc/uid/TP40009523-CH3-SW13

@nilnullzip nilnullzip changed the title Cannot to enable noSleep programatically on Android Cannot enable noSleep programatically on Android Jan 6, 2016
@richtr richtr closed this as completed Jul 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants