# Send events to HTML/JS-site

**URL:** <https://forum.needle.tools/t/send-events-to-html-js-site/500>\
**Category:** 🌵 Needle Engine\
**Tags:** question\
**Created:** [October 19, 2023, 12:00am UTC](https://forum.needle.tools/t/send-events-to-html-js-site/500 "2023-10-19T00:00:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![discord-import](https://forum.needle.tools/user_avatar/forum.needle.tools/discord-import/32/33_2.png) [@discord-import](https://forum.needle.tools/u/discord-import)\
**Post date:** [October 19, 2023, 12:00am UTC](https://forum.needle.tools/t/send-events-to-html-js-site/500/1 "2023-10-19T00:00:00Z")

</div>

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](https://discord.com/channels/717429793926283276/1164235114608328764)

_by user 1100349294130765885_

---

<div class="post-metadata">

**Author:** ![kipash](https://forum.needle.tools/user_avatar/forum.needle.tools/kipash/32/54_2.png) [@kipash](https://forum.needle.tools/u/kipash)\
**Post date:** [October 19, 2023, 12:00am UTC](https://forum.needle.tools/t/send-events-to-html-js-site/500/2 "2023-10-19T00:00:00Z")

</div>

Hey 👋

We have a sample that shows our proposed way of communicating: [https://engine.needle.tools/samples/javascript-communication/](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.

---

<div class="post-metadata">

**Author:** ![kipash](https://forum.needle.tools/user_avatar/forum.needle.tools/kipash/32/54_2.png) [@kipash](https://forum.needle.tools/u/kipash)\
**Post date:** [October 19, 2023, 12:00am UTC](https://forum.needle.tools/t/send-events-to-html-js-site/500/3 "2023-10-19T00:00:00Z")

</div>

## —

More to the sample, you can open it like so

 ![image.png](https://europe1.discourse-cdn.com/flex006/uploads/needle1/original/1X/5006c058e744d93f847014ab84a9963bd64b7adb.png)

---

<div class="post-metadata">

**Author:** ![discord-import](https://forum.needle.tools/user_avatar/forum.needle.tools/discord-import/32/33_2.png) [@discord-import](https://forum.needle.tools/u/discord-import)\
**Post date:** [October 19, 2023, 12:00am UTC](https://forum.needle.tools/t/send-events-to-html-js-site/500/4 "2023-10-19T00:00:00Z")

</div>

How could I have missed that 🤦‍♂️

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_

---

<div class="post-metadata">

**Author:** ![kipash](https://forum.needle.tools/user_avatar/forum.needle.tools/kipash/32/54_2.png) [@kipash](https://forum.needle.tools/u/kipash)\
**Post date:** [October 19, 2023, 12:00am UTC](https://forum.needle.tools/t/send-events-to-html-js-site/500/5 "2023-10-19T00:00:00Z")

</div>

No worries 🙂 It was released quite recently 🌵

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

---

<div class="post-metadata">

**Author:** ![hybridherbst](https://forum.needle.tools/user_avatar/forum.needle.tools/hybridherbst/32/3416_2.png) [@hybridherbst](https://forum.needle.tools/u/hybridherbst)\
**Post date:** [October 19, 2023, 12:00am UTC](https://forum.needle.tools/t/send-events-to-html-js-site/500/6 "2023-10-19T00:00:00Z")

</div>

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
