Giter VIP home page Giter VIP logo

Comments (5)

andrewimm avatar andrewimm commented on September 20, 2024 3

A recent release introduced the <Video> tag, which allows you to do all of the things requested above.

https://facebook.github.io/react-vr/docs/video.html

from react-360.

amberroy avatar amberroy commented on September 20, 2024

Yes you would need to do it on the native side, either in client.js or in a Native Module. Both audio and 2D video support are highly requested features that are in active development.

from react-360.

dukuo avatar dukuo commented on September 20, 2024

Thanks @amberroy ! Right now I successfully created a HTML5 video, then applied to a THREE.VideoTexture and added to the scene in client.js and managed to created a very simple VideoModule boilerplate to handle play(), pause() and so on. The thing is that while it works fine and web and I could reuse the mesh when playing a new video in the scene (supposing i'm only playing one video at any given moment) it doesn't work properly on mobile because the VRButton's onClick who is issuing the play() and pause() methods is not bubbling correctly to the VideoModule, giving me the following DOMException: Uncaught (in promise) DOMException: play() can only be initiated by a user gesture.

To clarify, i'm initializing VideoModule this way: VideoModule.init(video, mesh), video being the HTML5 and the THREE mesh, and the VideoModule.play() just does video.play(), same thing with pause(). So my current workflow for playing a video is:

client.js: Creates HTML5 video, a VideoTexture and the mesh, both added to scene and then initialized in VideoModule.init(video, mesh)

index.vr.js: VRButton.onClick => _handleVideo() => VideoModule.play()

Any ideas on why this might happen? Thank you!

from react-360.

Ninerian avatar Ninerian commented on September 20, 2024

The problem is the limitation of the browsers. As the message states, it needs a user gesture to start a video. It is the same problem as with enabling fullscreen.

In VR the click handling is purely handled by javascript and so the browser can't root the event to a user gesture and fails to play the video.

One solution would be to catch the event which triggers the vr mode and use this to play all videos in the scene and pause them instantly. The resume of the video shouldn't be bound to a user gesture.

Unfortunately it would be not possible to add videos later. So for a more complex scene this use case it not suited.

from react-360.

dukuo avatar dukuo commented on September 20, 2024

@Ninerian you mean the "View in VR" button? That's a good suggestion, i'm going to try it right now. I'll post the result here. Thanks

from react-360.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.