mediaStream (#3013)

* mediaStream

* make vitest happy

* fmt
This commit is contained in:
Kurt Hutten
2024-07-12 10:57:27 +10:00
committed by GitHub
parent 9dbe74e008
commit 999f72bccf
5 changed files with 61 additions and 35 deletions

View File

@ -4,7 +4,7 @@ import { deferExecution } from 'lib/utils'
import { Themes } from 'lib/theme'
import { makeDefaultPlanes, modifyGrid } from 'lang/wasm'
import { useModelingContext } from './useModelingContext'
import { useAppState } from 'AppState'
import { useAppState, useAppStream } from 'AppState'
export function useSetupEngineManager(
streamRef: React.RefObject<HTMLDivElement>,
@ -28,6 +28,7 @@ export function useSetupEngineManager(
}
) {
const { setAppState } = useAppState()
const { setMediaStream } = useAppStream()
const streamWidth = streamRef?.current?.offsetWidth
const streamHeight = streamRef?.current?.offsetHeight
@ -54,13 +55,7 @@ export function useSetupEngineManager(
settings.modelingSend
) {
engineCommandManager.start({
setMediaStream: (mediaStream) => {
settings.modelingSend({
type: 'Set context',
data: { mediaStream },
})
;(window as any).mediaStream = mediaStream
},
setMediaStream: setMediaStream,
setIsStreamReady: (isStreamReady) => setAppState({ isStreamReady }),
width: quadWidth,
height: quadHeight,