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

Seems to stop working when page is not foreground #22

Open
jeregrine opened this issue Feb 7, 2016 · 6 comments
Open

Seems to stop working when page is not foreground #22

jeregrine opened this issue Feb 7, 2016 · 6 comments

Comments

@jeregrine
Copy link

Seems to just stop emitting events if the page is in the background.

@latentflip
Copy link
Contributor

Browsers often suspend/slow down timeout/interval calls in background pages. It looks like chrome drops timer intervals to at most one per second, which will indeed break things.

http://stackoverflow.com/questions/6032429/chrome-timeouts-interval-suspended-in-background-tabs suggests a hack where you run the timer in a webworker and postmessage back, which looks like the only option, but I'm not sure how appropriate it is here.

@jeregrine
Copy link
Author

Well I've never done anything with webworkers before I guess... thanks for your help!

@xdumaine
Copy link
Contributor

xdumaine commented Feb 8, 2016

I think a better approach will be to use hark on the remote stream with new webaudio APIs as opposed to the local stream, and sending it to the other end. That way, when backgrounded, you don't need to animate anyway.

@jeregrine
Copy link
Author

Xander you cannot use hark with a remote media stream as said in the
README. The linked chrome issue says it landed in canary in December. Is it
in stable now?

On Sun, Feb 7, 2016 at 6:10 PM, Xander Dumaine [email protected]
wrote:

I think a better approach will be to use hark on the remote stream with
new webaudio APIs as opposed to the local stream, and sending it to the
other end. That way, when backgrounded, you don't need to animate anyway.


Reply to this email directly or view it on GitHub
#22 (comment).

@ibc
Copy link
Contributor

ibc commented Sep 8, 2016

Related: #24

@Superlukec
Copy link

If anyone still has this problem, use this library:
https://github.com/turuslan/HackTimer

It is mentioned at the stackoverflow thread, which latentflip posted.

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

5 participants