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

Issue: Delay in Loading 3D Objects with Viro3DObject Component #311

Open
3 tasks done
purevsurena opened this issue Oct 25, 2024 · 0 comments
Open
3 tasks done

Issue: Delay in Loading 3D Objects with Viro3DObject Component #311

purevsurena opened this issue Oct 25, 2024 · 0 comments

Comments

@purevsurena
Copy link

Issue: Delay in Loading 3D Objects with Viro3DObject Component

Requirements Checklist

Environment

  • Development OS: Mac
  • Device OS & Version: iOS 17.6.1
  • Viro and React Native Versions:
  • React Native: 0.70.6
  • Viro: @reactvision/react-viro 2.41.6
  • Device(s): iPhone 14 Pro

Description
When using the Viro3DObject component to render GLB files, I’m encountering significant delays in loading times. For instance, loading a small GLB file (e.g., 2MB) sometimes takes over 10 seconds, particularly when switching to the next object.

Upon investigation:

The onLoadStart event fires immediately, indicating the loading process initiates without delay.
However, the onLoadEnd event sometimes takes a long time to trigger, leading to an extended wait before the object displays.
This issue impacts the user experience, as it interrupts responsiveness and creates noticeable delays.

<Viro3DObject
    key={objectKey}
    ref={viro3DObjectRef}
    animation={{ name: 'rotate', loop: true, run: true }}
    source={{
        uri: getS3Url(three_d_url),
    }}
    highAccuracyEvents
    position={[position.positionX, position.positionY, position.positionZ]}
    scale={scale}
    type="GLB"
    onLoadStart={handleLoadStart}
    onLoadEnd={handleLoadEnd}
    onError={handleLoadError}
    visible={!isLoading && !glbLoaded}
    onDrag={handleOnDrag}
    onPinch={handleOnPinch}
    dragType="FixedToWorld"
/>

const handleLoadStart = useCallback(() => {
    setIsLoading(true);
    setGlbLoaded(false);
}, []);

const handleLoadEnd = useCallback(() => {
    setIsLoading(false);
    setGlbLoaded(true);
}, []);

Reproducible Demo

Steps to reproduce the issue:

  1. Load a GLB file using the code provided in the Viro3DObject component.
  2. Observe the delay between onLoadStart and onLoadEnd events, particularly when switching between objects.
  3. Delays are inconsistent but often significant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant