Comments (4)
I've been trying to reproduce it with VideoBlur's example with ref={ref => { if (ref) ref.currentTime = 10; }}
on the video element, and can't repro,
do you think it's specific to using 2 videos at the same time? specific to Firefox too?
Can you show me how you set the current position?
Also, just to confirm something: can you tell me if this error:
(1) crashes the whole gl-react component?
(2) crashes the entire app?
(3) is just getting logged in the console but rendering finally works after video load?
to me it looks like the error get thrown from inside a requestAnimationFrame, so I think the component should not break and eventually you should have your think rendered when video is ready. If it's not the case, i'm not sure where the bug is, i'm not even sure if this error is a webgl thing or a dom thing?
from gl-react.
It occurs only on firefox,
it doesn't crash the gl-react - only gets logged, shouldn't be specific for using 2 videos, mostly I'm setting time like this:
const vid = this.refs.video;
if (vid.readyState > 2){
vid.currentTime = x;
}
I've added the readystate check to the video and it fixed the issue on my side.
the thing in our app is, that we have basically 2inputs which can be video/canvas also those videos are changing in time based on global progress. So what can happen is that in the first RAF callback there are following inputs (uniforms):
A:<video src='a' .../>
B:<canvas>
and in second (consequential frame) there will be:
A:<video src='x' ../>
B:<video src='z' ../>
So the issue should be that on the second frame, we are setting current time to an element which doesn't have even metadata loaded.
Are you setting the current time directly somewhere in the lib (or it just renders it with the same ref)? Or how does this uniform gets rendered into the dom?
from gl-react.
no one should set the time of <video>
passed-in contents and gl-react-dom
is not even aware if your content is a <canvas>
/ <video>
/ whatever DOM element that can be drawn in webgl
but will delegate that work to a library called gl-texture2d, which itself is not doing much except using the WebGL API to upload the texture.
That said, if you move from <video src="a" />
to <video src="x" />
, there will be some React Reconciliation: the same video DOM element should get reused and only src attribute will get changed.
If you want to force the video to be recreated, you can use key
React props : <video src="a" key="a">
So I guess, if I identify the problem correctly, a minimal example that reproduce the bug is to change the video src. Will try this ASAP.
Also:
Your questions just made me think of a current limitation in gl-react (in some specific cases that maybe don't affect you): contents Reconciliation only works by content index at the moment (and you don't even control what that index will be.. except maybe because of the order of your uniforms).
In other words, at the moment, user can't define a "key" on a content to ensure it doesn't get re-created in case things moves / get reordered... basically that means if you swap 2 videos, I don't think the video refs will be preserved, but each one will get reloaded (src attribute will probably be swapped).
The technical reason is because we also needed to wrap the content in a container (for multiple reasons). But maybe we can fix this by just making the content container key inheriting the inner vdom key... that would make sure they get properly swapped by React reconciliation.
from gl-react.
This is now solved in gl-react v3 ! It's a complete rewrite.
- see release article: http://greweb.me/2016/12/gl-react-v3/
- see cookbook/api: https://gl-react-cookbook.surge.sh
- gl-react v3 is still in development. (hosted on: http://github.com/gre/gl-react )
- gl-react v2 is still the stable version (hosted on: https://github.com/ProjectSeptemberInc/gl-react )
Relevant example that show this issue is fixed: I don't have a precise example that show exactly this, but things don't get unmounted/remounted since we are more compliant with React reconciliation. Maybe the closest example is https://gl-react-cookbook.surge.sh/blurvideo and how changing the number of passes don't recreate the content.
from gl-react.
Related Issues (20)
- Possible Bug: Image data flipped when captured
- TypeError: undefined is not a function (near '...GL.createComponent...') HOT 1
- image disappeared after refocus the screen
- gl-react-native App crashed with Surface with style prop HOT 5
- Update Peer Dependency to gl-react-5?
- How to remove white Background from the image HOT 1
- GL is currently not available (have you enabled remote debbuging) shows up on Android HOT 1
- Camera preview dimensions ignored? - distorted on iOS HOT 2
- Question About Texts on Images in react-native HOT 1
- [iOS] app crash calling "capture": NSInvalidArgumentException HOT 2
- How to load spine animation json file in react-native HOT 1
- Specify texture format
- GL.Node does not support video surfaces HOT 2
- Failed to execute 'shaderSource' on 'WebGL2RenderingContext': parameter 1 is not of type 'WebGLShader' HOT 4
- Bad quality camera on Android devices HOT 5
- Image from local storage are not reading , surface view coming black.
- headless example HOT 1
- How to use gl-react with next.js ? Is there any documentation about this ? HOT 1
- Runtime error: `Unable to resolve module expo-modules-core`
- ReferenceError: Can't find variable: global HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gl-react.