Error on calling enterVR() on a-scene (chromium and nightly desktop) - aframe

I have been having issues when trying to call enterVR() on my a-scene element from within my JS code. Whether I wait for the scene to have loaded or bind enterVR() to a vive controller input, I get the following error:
Error: Failed to enter VR mode ('requestPresent'): API can only be initiated by a user gesture.
I have been using the latest chromium experimental build as well as Mozilla Nightly and the following Aframe version(master) :0.5.0 (Date 22-03-2017, Commit #bc6be7c).
Ultimately, my only goal is to begin presenting content to the headset as soon as the scene has loaded.

As the error message says, you need a user gesture like a click to enter VR. If you do it within a 'window.addEventListener('click', ...)', it should work

Related

Selenium (RSelenium) giving StaleElementReference clicking an element just recently searched

I'm trying to get some Selenium tests against Shiny app that has some notifications. I have a following function I would call to close all notifications that are there, and the reference to the element is fetched just before the click is called.
close_notifications <- function() {
buttons <- remDr$findElements(using = "xpath", "//[#id='shiny-notification-panel']///div[contains(text(),'×')]")
close_function <- function(btn) {
btn$clickElement()
}
lapply(buttons, close_function)
}
However when there is a notifcation visible in the app and I try to call it, I'll get the following error regarding it.
Error: Test failed:
* Summary: StaleElementReference
Detail: An element command failed because the referenced element is no longer attached to the DOM.
class: org.openqa.selenium.StaleElementReferenceException
What might be the reason I'm getting this error, even when the reference is fetched just before trying to click the button? Notification duration itself is quite long so it doesn't disappear in the UI even when I get the StaleElementReference. I'm not sure if Shiny changes something under the hood so that it's not the same DOM element, however, I guess that shouldn't be the case when I'm trying to press the button just after looking it up with the Selenium driver.

Desktop version getting error while moving mouse (cursor.js)

I'm taking a version of our VR experience (repo here: https://github.com/EFForg/spot_the_surveillance) and making a purely desktop version for demonstration purposes.
I've added cursor="rayOrigin: mouse" to and some changed some mouseenter events to click events. Everything is mostly working except that as I mouse over the scene, I repeatedly getting this error: "Uncaught TypeError: t is null", which refers to the following code in cursor.js.
// Ignore events further away than active intersection.
if (this.intersectedEl) {
currentIntersection = this.el.components.raycaster.getIntersection(this.intersectedEl);
if (currentIntersection.distance <= intersection.distance) { return; }
}
How do I resolve this error? It causes a significant lag time in the experience.
Thank you!
Looking at the Mouse Click Example linked from this page was a good place to start: https://aframe.io/docs/1.0.0/components/cursor.html#intersection-data
Unfortunately the example is using aframe 0.7.0, so I had to read through the animations documention for 1.0.4 and adapt accordingly: https://aframe.io/docs/1.0.0/components/animation.html
I also had to update the version of aframe-event-set-component.js I was using.
Between those two sources of information and the version updates, I was able to get things working.

can't get 'click' event listener to register as user initiated action on Android Chrome in a-frame (to play media)

I understand that to start a video in Chrome from within A-frame on Android a user initiated event is needed, but I cannot work out how to get Chrome to accept a click event listener triggered via a fused cursor as a user event.
the following code is in the init of a component attached to a cube.
this.el.addEventListener('click',function(evt){
console.log("clicked");
var els = document.querySelector('#video');
els.components.material.material.map.image.play();
});
there is a video sphere in the html as follows
<a-videosphere id="video" src="#avideo" rotation="0 180 0" ></a-videosphere>
and the follow within the assets tags.
<video id="avideo" src="video/lowaudio.mp4"></video>
When I debug, Chrome returns the following, even though it appears to me that the user is initiating the click even via a cursor fuse.
videoClick.js:22 Failed to execute 'play' on 'HTMLMediaElement': API can only be initiated by a user gesture. # videoClick.js:22
Uncaught (in promise) DOMException: play() can only be initiated by a user gesture.
Any suggestions would be greatly appreciated. Cheers
It has to be an actual physical click of the screen, not a synthetic one.
document.querySelector('.a-enter-vr-button').addEventListener('click', function () {
document.querySelector('video').play();
});

QtWebEngineView error at show()

I have recently started using QWebEngineView class from qt5.7 and i am getting these errors every time i show my webview for the first time:
QSGContext::initialize: depth buffer support missing, expect rendering errors
QSGContext::initialize: stencil buffer support missing, expect rendering errors.
QOpenGLFramebufferObject: Framebuffer incomplete attachment.
QOpenGLFramebufferObject: Framebuffer incomplete attachment.
[opengl\qopenglframebufferobject.cpp line 736] OpenGL Error: 1280`
I build it like this:
QWebEngineView* webview = new QWebEngineView(&parentWidget);
webview->setGeometry(QRect(0,0,Constants::NOTIFICATION_WIDTH, Constants::NOTIFICATION_HEIGHT));
And I show it like this:
webview->setHtml(html, baseurl);
QObject::connect(webview, SIGNAL(loadFinished(bool)), &parentWidget, SLOT(show()));
The webview appears to load the html correctly but once i display it, the html appears after a delay. I think this delay happens due to the OpenGL errors i mentioned earlier because the second time i show() the webview it appears instantly, without any errors.
I am working on a Citrix Windows 8 machine and i have a Citrix display driver.
How can i fix these errors, or how can i make it the webview display instantly the first time i show() it?

How to display the custom message in SDL Tridion Message bar?

I want to display my custom message (Say for Ex: some message needs to display when Page is save event is triggered) in SDL Tridion CME Message bar. How to do this?
From an event system you can only display ERROR messages.
If your Event code throws an error the "Message" will be displayed in the Message bar.
For other type of messages you need to use Javascript/CM Extensions. You can find an example of an event system that shows a message here.
Nuno covered your options pretty well.
If you want to show a message from your JavaScript code, this is usually my starting point:
$messages.registerNotification("Hello world");
If you put this in your JavaScript code (or just paste it into a JavaScript console), it will show a blue bar with "Hello World" in it.
There are many types of messages, each of which shows up slightly differently. What I usually do if I need more than a notification is:
type $messages. in a JavaScript console in a browser where the web GUI is loaded
go through the list of relevant methods to see what looks most promising (they all start with register)
perform a text search on the source code for the method that I am looking for
This leads me to an example of how that method is used in the GUI already and is a great starting point for my own code.
Update
Alexander Klock recently wrote a thorough explanation of the message types available on his blog.

Resources