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.
|
// On various inputs save the camera state, in case we get disconnected.
|
||||||
useEffect(() => {
|
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 = () => {
|
const onInput = () => {
|
||||||
// Save the remote camera state to restore on stream restore.
|
// Save the remote camera state to restore on stream restore.
|
||||||
// Fire-and-forget because we don't know when a camera movement is
|
// 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
|
// completed on the engine side (there are no responses to data channel
|
||||||
// mouse movements.)
|
// mouse movements.)
|
||||||
|
|
||||||
sceneInfra.camControls.saveRemoteCameraState().catch(trap)
|
sceneInfra.camControls.saveRemoteCameraState().catch(trap)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,7 +432,7 @@ export const EngineStream = (props: {
|
|||||||
window.document.removeEventListener('scroll', onInput)
|
window.document.removeEventListener('scroll', onInput)
|
||||||
window.document.removeEventListener('touchend', onInput)
|
window.document.removeEventListener('touchend', onInput)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [engineStreamState.value])
|
||||||
|
|
||||||
const isNetworkOkay =
|
const isNetworkOkay =
|
||||||
overallState === NetworkHealthState.Ok ||
|
overallState === NetworkHealthState.Ok ||
|
||||||
|
Reference in New Issue
Block a user