It seems that subscribing to these events don’t acknowledge on the initial load or render. We need a status for the player to know that it is loaded/rendered to run several different pieces of logic e.g. selecting our default configuration of a product. Is there a mechanism to allow understanding the status of the initial load/render?
The methods there will certainly acknowledge initial load and render.
Preloaded
Emitted when the scene and all assets necessary to render the scene have been loaded. Occurs before the ‘loaded’ event, and is an opportunity to modify the scene before it becomes visible.
Loaded
Emitted when the scene and all assets necessary to render the scene have been loaded.
Rendered
Emitted when the scene has been fully rendered.
The rendered event will fire when the visual is ready for interaction, and likely when you would want to add your default configuration. Can you share more about how you’re using the code? That might help me give some better guidance.
This screenshot is from our player embed example so your syntax might be different if you’re using Treble or async/await vs the promise. Your event listener should be after the player initialization begins:
Yes, we are using Treble. I’ve attempted to wait for the threekit
object to load and then use the player
object within to set the render
event on. Even though the player
object is available and I can see that the event is subbed to before the player finishes loading, the event does not trigger on the initial render. Is there a specific way to do this with Treble?
If you’re using Treble I’d suggest looking at the hooks available: Use Player Loading Status might be a good one to start with.
The usePlayerLoadingStatus hook returns a single boolean value indicating whether the Threekit Player has rendered out a product configuration or is in the process of applying and rendering a change/new product configuration.
The hook will return true if the Player has finished its render and false when the configuration is changed until that change has been rendered and visualized by the Player.
Let me know if this is helpful.