Atom Electron: Render Canvas in Another Window

I have an Electron app with two BrowserWindows. The first manages multiple mediastreams which are rendered onto a canvas. When running the app in the browser I can access the canvas in a popup using the document reference provided by window.open(). Is something like this possible in Electron?

Is it possible to pass a CanvasRenderingContext2D using the ipcRenderer to the other window? Or via a global on the main process?

2
Leave a Reply

avatar
2 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Jason
Guest

ipcRenderer and ipcMain do not support complex things transfer like objects or functions. You need to send your instructions from your first BrowserWindow to your main process, then the main process should send an instruction (like a string) to your second window that should handle it.

If you want to transfer streams, you will have to create a localhost server and use a socket library (socket.io), coupled with the corresponding npm package, for example socket.io-stream

Jason
Guest

Maybe WebRTC could work for you, example: http://www.html5rocks.com/en/tutorials/webrtc/basics/