Fix UI freeze by using MediaStreamTrackProcessor for audio capture (restored PCM)
This commit is contained in:
parent
d1d3ed3e14
commit
ad37ce8296
5 changed files with 179 additions and 145 deletions
|
|
@ -1,8 +1,20 @@
|
|||
import { contextBridge, ipcRenderer } from 'electron'
|
||||
import { electronAPI } from '@electron-toolkit/preload'
|
||||
|
||||
// Custom APIs for renderer
|
||||
const api = {}
|
||||
// Custom APIs for renderer - extend with explicit audio/video IPC
|
||||
const api = {
|
||||
// Explicitly expose receive channels for media
|
||||
onAudioFragment: (callback: (payload: any) => void) => {
|
||||
const handler = (_: any, payload: any) => callback(payload);
|
||||
ipcRenderer.on('audio-fragment', handler);
|
||||
return () => ipcRenderer.removeListener('audio-fragment', handler);
|
||||
},
|
||||
onVideoChunk: (callback: (payload: any) => void) => {
|
||||
const handler = (_: any, payload: any) => callback(payload);
|
||||
ipcRenderer.on('video-chunk', handler);
|
||||
return () => ipcRenderer.removeListener('video-chunk', handler);
|
||||
}
|
||||
}
|
||||
|
||||
// Use `contextBridge` APIs to expose Electron APIs to
|
||||
// renderer only if context isolation is enabled, otherwise
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue