Only start saving camera after scene is ready (#7120)
This commit is contained in:
@ -406,11 +406,17 @@ export const EngineStream = (props: {
|
||||
|
||||
// On various inputs save the camera state, in case we get disconnected.
|
||||
useEffect(() => {
|
||||
// Only start saving after we are playing the stream (which means
|
||||
// the scene is ready.)
|
||||
// Also prevents us from stepping on the toes of the camera restoration.
|
||||
if (engineStreamState.value !== EngineStreamState.Playing) return
|
||||
|
||||
const onInput = () => {
|
||||
// Save the remote camera state to restore on stream restore.
|
||||
// Fire-and-forget because we don't know when a camera movement is
|
||||
// completed on the engine side (there are no responses to data channel
|
||||
// mouse movements.)
|
||||
|
||||
sceneInfra.camControls.saveRemoteCameraState().catch(trap)
|
||||
}
|
||||
|
||||
@ -426,7 +432,7 @@ export const EngineStream = (props: {
|
||||
window.document.removeEventListener('scroll', onInput)
|
||||
window.document.removeEventListener('touchend', onInput)
|
||||
}
|
||||
}, [])
|
||||
}, [engineStreamState.value])
|
||||
|
||||
const isNetworkOkay =
|
||||
overallState === NetworkHealthState.Ok ||
|
||||
|
Reference in New Issue
Block a user