immersive-web / webvr-polyfill

Use WebVR today, without requiring a special browser build.
http://immersive-web.github.io/webvr-polyfill/examples/
Apache License 2.0
1.4k stars 325 forks source link

Nosleep stopped working on iOS 10.3.1 #217

Closed HalfdanJ closed 6 years ago

HalfdanJ commented 7 years ago

New version of iOS has broken the no sleep functionality in polyfill.

jsantell commented 7 years ago

Looks like others reporting the same with NoSleep.js, urg.

customlogic commented 7 years ago

This has been fixed in NoSleep: https://github.com/richtr/NoSleep.js/issues/29

jsantell commented 7 years ago

Just tried the latest nosleep and didn't seem to work for iOS11 :\

jeppester commented 6 years ago

I experience the same problem on iOS 11.1.2.

I took the time to run some tests with nosleep and webvr-polyfills wakelock.

webvr-polyfill's built-in wakelock (using location hack) doesn't have any effect - the screen goes to sleep after 40 seconds, every time.

With the latest nosleep.js, which uses a video that's seeked randomly after 0.5 seconds, the results get really interesting. I get between ~40 and ~80 seconds before the screen goes to sleep. Because of the variance in the number of seconds I tested a LOT of times. It almost seems like some randomness was added intentionally. Here are my numbers: 60, 79, 70, 40, 42, 46, 82, 50

I'll try out various solutions, to see if I can come up with something the works, here are my current ideas:

jeppester commented 6 years ago

Update: Using a longer video works. Maybe there is a way to programatically loop parts of the base64 string to increase the length of the video.

cvan commented 6 years ago

great idea! looks like we can do https://github.com/richtr/NoSleep.js/blob/master/src/index.js#L20-L24 (fixed in richtr/NoSleep.js#33)

I can take this on, unless someone beats me to it

jeppester commented 6 years ago

The fix you are referring to is included in the latest NoSleep.js-version, which is the one I was testing. It does work to some extend, but it seems like it doesn't fool safari for very long.

My idea was to programmatically repeat parts of the base64 string to make the video's duration longer. I'm not entirely sure if it's a good idea though, it will take up some extra memory to store a very long data URI.

jsantell commented 6 years ago

Looks like there's an issue open for iOS11 not working, but possibly fixed in 11.1? Can anyone else confirm? https://github.com/richtr/NoSleep.js/issues/41

jsantell commented 6 years ago

Fix for iOS 10 ready (https://github.com/googlevr/cardboard-vr-display/pull/1), will open a new ticket for iOS 11 issues

jsantell commented 6 years ago

Fixed for iOS 10 in https://github.com/googlevr/webvr-polyfill/commit/71eb2151e75e0ce056dd7b69f43b6a0299df9507, 0.10.1