Pause stream when exiting sketch or extruding (#2900)

* Pause when exiting sketch or extruding

* tsc
This commit is contained in:
49fl
2024-07-04 01:55:06 -04:00
committed by GitHub
parent fb3e922180
commit 6370d45f94
3 changed files with 16 additions and 3 deletions

View File

@ -128,7 +128,7 @@ export const ModelingMachineProvider = ({
'enable copilot': () => {
editorManager.setCopilotEnabled(true)
},
'sketch exit execute': () => {
'sketch exit execute': ({ store }) => {
;(async () => {
await sceneInfra.camControls.snapToPerspectiveBeforeHandingBackControlToEngine()
@ -162,7 +162,10 @@ export const ModelingMachineProvider = ({
})
}
kclManager.executeCode(true)
store.videoElement?.pause()
kclManager.executeCode(true).then(() => {
store.videoElement?.play()
})
})()
},
'Set mouse state': assign({

View File

@ -68,6 +68,13 @@ export const Stream = () => {
if (!videoRef.current) return
if (!context.store?.mediaStream) return
videoRef.current.srcObject = context.store.mediaStream
send({
type: 'Set context',
data: {
videoElement: videoRef.current,
},
})
}, [context.store?.mediaStream])
const handleMouseDown: MouseEventHandler<HTMLDivElement> = (e) => {