Skip to content
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

Possibility of Video or I-Frame embed in React XR #214

Open
iamkkt opened this issue Nov 15, 2022 · 6 comments
Open

Possibility of Video or I-Frame embed in React XR #214

iamkkt opened this issue Nov 15, 2022 · 6 comments
Labels
enhancement New feature or request question A general question or query about WebXR or react-xr

Comments

@iamkkt
Copy link

iamkkt commented Nov 15, 2022

As per my understanding, Drei Html component wont render in react XR and Drei Image component wont support video. Is there is any work around for I- Frame or Video embeed in react XR.

@CodyJasonBennett CodyJasonBennett added enhancement New feature or request question A general question or query about WebXR or react-xr labels Nov 15, 2022
@CodyJasonBennett
Copy link
Member

CodyJasonBennett commented Nov 15, 2022

I'd look into projecting a VideoTexture onto a plane or adding support for that in https://github.com/pmndrs/drei/blob/master/src/core/Image.tsx if it doesn't already. It should be fine as long as it doesn't rely on window.requestAnimationFrame -- this does not with in an immersive session.

From a quick glance, you should be able to pass any sort of texture and it work without issue.

@iamkkt
Copy link
Author

iamkkt commented Nov 15, 2022

Thank you for replies. I have tried with video texture and works fine for video. As the size of the video increases, it might create a problem for as it cant stream. Is there any work around for this, where i can able to stream like youtube or any possibility of YouTube embed in react XR like drei html ?

@iamkkt
Copy link
Author

iamkkt commented Nov 15, 2022

My requirement is to stream either a video of length 30 min or a YouTube video.

@rgsaura
Copy link

rgsaura commented Nov 24, 2022

Hello! Exited to explore this field. What about inserting an Iframe, any idea?

@rekliner
Copy link
Contributor

rekliner commented Nov 30, 2022

This issue is not related to react-XR.
https://github.com/pmndrs/drei#usevideotexture is your answer for displaying video from a file or stream on a surface.

@iamkkt To get video content from a service like youtube or vimeo means reverse engineering their player, something they explicitly make difficult. By design you can't directly access their video content, and you will not find an out of box solution. Any method that is popularized is quickly obfuscated in response by those companies and their methods are proprietary. Not to say its impossible but it will likely always be a very technical hurdle and not the realm of a simple material import.

Regardless, it would happen outside of the realm of react-xr, drei, and three.js. Nothing can be done here to help you, but I don't mean that to be unhelpful. There are other ways to host and stream video and you can certainly show a video stream on a surface. Start learning with the basic R3F video texture example here: https://codesandbox.io/s/39hg8 ... Lean about video streams with this sandbox: https://codesandbox.io/s/threejs-video-cube-nmjch8

Once you have the video stream available useVideoTexture() is your resource in the 3d scene. By here I mean drei, not react-xr. Your second step is to attach that video to an object, likely a plane but it can be anything, as demonstrated in the examples above.

@netgfx
Copy link

netgfx commented Mar 19, 2023

On a similar note a simple mp4 video is playing fine, until entering the AR mode a second time then the video stops, and any subsequent try to enter AR the video stops immediately. Is there a limitation or something that needs to be enabled in order for the video to work every time someone enters AR mode?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question A general question or query about WebXR or react-xr
Projects
None yet
Development

No branches or pull requests

5 participants