Send events to HTML/JS-site

We have worked a little on videos playing within the 3D environment but feel it has a too big impact on performance. My thought was to display the video on a standard HTML modal but we want it to display on actions made within the 3D environment.

Is there a standard way of sending events/calling functions from within Needle?

Original Post on Discord

by user 1100349294130765885

Hey :wave:

We have a sample that shows our proposed way of communicating: https://engine.needle.tools/samples/javascript-communication/.

Regarding the performance, what is your target device and how demanding is the video being played?
The VideoPlayer component adds the video html element to the site and uses Three.js’s Video texture to display contents in the 3D environment.

There’s most likely some overhead, but i wonder if it is so significant.

More to the sample, you can open it like so

How could I have missed that :man_facepalming:

It might have been the fact that we were playing several videos at the same time on multiple “billboards”. I will do some tests and make a modal if I cant get it working.

by user 1100349294130765885

No worries :slight_smile: It was released quite recently :cactus:

Ah, makes sense. Playing multiple videos can be quite expensive. Let me know how it goes :+1:

Regarding multiple video playback - depending on what you want to do you can also have one video and different objects in the scene show parts of the video via UV.
That’s typically how e.g. „scifi city with 100 billboard ads“ is done