I’m building an extension that one part of it’s functionality is recording the screen.
after enabling record in the popup interface the background.js creates a mediaStream object successfully.
I’m doing in the background script because the background eventually will have to handle the save of this video (send it to a server).

But I also want to have a player to show that video before saving (to confirm or discard it), but when passing a message from the background script to the pop script the media object arrives empty;

this is what the background sends:

isRecording: true
stream: MediaStream
  active: true
  id: "zS8d6Jc7FzJQ5gWXWy9fyHiWquGaOW626FhV"
  onactive: null
  onaddtrack: null
  oninactive: null
  onremovetrack: null
  __proto__: MediaStream
__proto__: Object

and this is what arrives to the popup script:

isRecording: true
 stream: {}
 __proto__: Object
__proto__: Object

To my best understanding it happens because of JSON serialization…
How can I overcome it?