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

Not working in iOS 13.4 #85

Closed
RyanSpahn opened this issue Mar 1, 2020 · 12 comments
Closed

Not working in iOS 13.4 #85

RyanSpahn opened this issue Mar 1, 2020 · 12 comments

Comments

@RyanSpahn
Copy link

Im running the 13.4 beta and since the 2nd and now 3rd beta for 13.4 Ive notice noSleep.js is no longer keeping my iPhone awake. Either in my own app or when I go to the test page.

I wonder if anyone else is experiencing this too?

@ludgerey
Copy link

Has anyone else confirmed this issue? As far as I know iOS 13.4 will be officially released in 2 days.

@demur
Copy link

demur commented Apr 3, 2020

Just updated to iOS 13.4
:-(
noSleep.js doesn't work for Safari or Chrome

@RaveKev
Copy link

RaveKev commented Apr 3, 2020

push

@RaveKev
Copy link

RaveKev commented Apr 3, 2020

I found out, that it is an iOS Problem, not a NoSleep.js problem:

https://discussions.apple.com/thread/251215369

iOS 13.4 has the problem, that videos are not shown - and that's how NoSleep.js works.

@ArtemisGraphic
Copy link

ArtemisGraphic commented Apr 12, 2020

Just updated to 13.4.1 and the problem persists on my iPhone 8

@YossiMH
Copy link

YossiMH commented Apr 13, 2020

This solution worked for me -- I haven't implemented it in the context of nosleep.js, but this is the technique, in case anyone would like to update the library to fix this problem:

Play a video that has an audio track. Make sure it's in the DOM and on-screen. (Covered by something else is fine.)

Set up a callback when the video is paused -- this will trigger when the video reaches its end. When it's triggered, set the time to 0 and call play() on the video again.

Where that went wrong -- after a few minutes, the playhead would stop advancing; it would just stay at 0. If you asked the video player what it was up to, it would say that it was playing, not paused, not completed, not seeking, no errors. But its current time was always 0. And then the phone would fall asleep.

So, every few moments (as long as "every few moments" is not an even multiple or divisor of the length of the video), check to see what the video's current time is, and store that time for the next check. If the video's current time is the same as what it was during the previous check, nudge the playhead forward slightly and call play() on the video again.

@z-x
Copy link

z-x commented May 13, 2020

I seem to have the same problem on iOS 13.4.1 on my iPhone X. Nor my implementation nor the demo works anymore.

@tdykstra
Copy link

Same problem on iPhone 8 Plus after upgrade to iOS 13.4.1. Nosleep was working in Chrome on 13.4.

@cvanduyne
Copy link

It was also failing for me on iOS 13.4.1 and 13.5.
I found that by modifying NoSleep.js to remove the line:
this.noSleepVideo.setAttribute('muted', '')
it worked again.
I don't know if there are other side effects of this change, but it works for my purposes.

@ludgerey
Copy link

It was also failing for me on iOS 13.4.1 and 13.5.
I found that by modifying NoSleep.js to remove the line:
this.noSleepVideo.setAttribute('muted', '')
it worked again.
I don't know if there are other side effects of this change, but it works for my purposes.

Probably causes other playbacks (e.g. music playing in different app) to pause and playback keyboard buttons will fire events on that "video". Disclaimer: Not tested, but I observed that behavior in another context before.

@tdykstra
Copy link

That solution doesn't work for me -- my site uses speechSynthesis, and when I try removing the video.setAttribute line, the audio quits.

@richtr
Copy link
Owner

richtr commented May 27, 2020

This issue has been fixed based on this discussion with the solution provided in #92.

NoSleep.js has now be updated to v0.10.0 which includes this update.

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

10 participants