Show and Hide VideoPlayer


#1

Hi,

So i’m trying to make a newspaper sort of… I trained and image with an page and i’m trying to add for each heading where i have a person that talks about himself a video with that person talking live(streaming). My question is if i don’t want to make a zapcode for each person so i wouldn’t be needed to re-scan each time… can i add all the videos in that page and only show the videoplayer when i’m focusing the camera over that picture… like a trigger or something… That will be helpful because i would have to load just once the scene… and then the videoplayers appear when i’m focusing(zooming) onto that picture and when i move the camera on other picture to disappear, something like the script with seen/notseen on the tracking image…

Thank you,
Daniel


#2

Hi @daniel.alexandru.mur,

Sorry for the late reply, this question seemed to dip under the radar and wasn’t spotted by anyone.

What you have explained is indeed possible and I have created a simple experience to show how it can be done. The example uses the video player subsymbol, along with a raycaster, to play videos when a plane (section of the target) is looked at. You can scan the target below to see it in action or download the ZPP here - Video Look at and Play.zip (14.1 MB)

To summarise, the scene was set up with 3 main components - the video players, the hotspot planes and the raycaster.

  • The video players are set to not visible and the planes are positioned.

  • The raycaster is then added to the hierarchy but instead of being tracked to the target, it is set to be relative to the screen (always pointing directly along the Z axis). The raycaster then has a trigger tag named ‘Overlap’ which is important when setting up an intersect event.

  • The planes also have this tag assigned which allows an intersect event to be called when the user looks at each of the planes. Furthermore, both planes have scripts added to them (right click on the node in the hierarchy and add intersect enter event) where the desired video player is set to become visible and start.

Hopefully this explains how raycasters can be used to start videos only when they are looked at.

If you have any questions regarding this or would like me to explain the development process in more detail, please let me know! :slight_smile:

George


#4

This worked perfect… thank you very much. I was having a hard time trying this up but eventually worked very well and exactly what i needed. One more question about this if it’s possible. Can it be added some sort of maximize button/controller to toggle the video fullscreen? Like a normal video player. I found that the Z.device.playFullscreenVideo(“http://…”) is making a video fullscreen but immediately after loading. I’m trying to get a button on the videoplayer that can toggle the fullscreen in and out like in you**** player.

Thank you. Daniel