Skip to content

Should calling XRSession.requestAnimationFrame in a Window.animationFrameCallback be banned? #736

@toji

Description

@toji

Brought up in discussion of #717, which outlines the danger of scheduling XRSession rAFs in Window.rAF callbacks.

Manish: Should we have a non-normative note suggesting browsers show a warning for session.rAF() called within window.rAF() or vice versa?

Nell: Heck, could we do something more drastic and reject session.rAF() if invoked from window.rAF()? If that's too much, maybe we reject it from there if it's never been hooked before?

Thinking about the consequences of such a choice... in the future, some layers won't ever require processing a rAF (for example a hardware-backed video projection layer).... so what would happen when the video ends and the developer wants to start rendering their own content with a traditional layer type... when would we expect them to hook the session.rAF()? I do worry they might try to use the window.rAF() if not prevented from doing so...

I feel as though there may be a legitimate reason to do so that we're overlooking, but it's worth considering the implications of doing so and/or if there's a better way to encourage ideal behavior by applications.

Metadata

Metadata

Assignees

Labels

help wantedThis is a good issue for anyone to pick up and work on filing a PR for.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions