No, not directly, because a MediaStreamTrack
is not transferable. It's tied to the document it's created in.
A workaround would be to establish an RTCPeerConnection
between the two tabs and transmit the screen-capture track from the tab that has it to the tab that doesn't. This should be relatively performant since the bits never leave your network card.
You can use a BroadcastChannel
for the necessary signaling to establish such a connection, or do tricks with localStorage
to do the signaling like I do here using a camera, but it works with any source (open in two tabs first, then click the Call
button in one).
A limitation of this workaround is that if you close the original tab then you lose both tracks.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…