-
Notifications
You must be signed in to change notification settings - Fork 323
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
Support I-Frames through PostMessage #173
Comments
Are you suggesting to add a listener for these synthetic deviceorientation On Mon, Nov 14, 2016 at 5:24 PM Kevin Ngo notifications@github.com wrote:
|
@ngokevin can you share the code snippet that does this device orientation update via postMessage ? |
I don't have code snippets, but the pseudocode is:
window.addEventListener('devicemotion', function (evt) {
iframes.forEach(function (iframe) {
iframe.contentWindow.postMessage({name: 'devicemotionpolyfillupdate', acceleration: evt.acceleration, ...});
});
}); Polyfill / I-Frame content script: window.addEventListener('message', function (evt) {
if (evt.data.name !== 'devicemotionpolyfillupdate') { return; }
// Tell polyfill to update camera using device motion data.
}); |
Described how magic window and mirroring work with a canvas `outputContext`. Follows the proposal in #224.
Added an example usage of iframes in the cardboard-vr-display README, as well fixed the issue with working with cross-origin iframes |
Safari has a rule that disallows an I-Frame to access
deviceorientation
events to get rotation data. On aframe.io, we've had to limit the example scenes we show on mobile to scenes hosted on the same domain.We can work around this by using postMessage. The parent window has a small script that continuously emits a postMessage with device orientation data. Then we have webvr-polyfill listen to the postMessage and send that data through the polyfill to support the I-Frame use case.
The text was updated successfully, but these errors were encountered: