This repository has been archived by the owner on Mar 22, 2022. It is now read-only.
Share MediaSender track between more than one Transceiver #336
Labels
breaking change
This change breaks the current API and requires migration
enhancement
New feature or request
Describe the problem
In a Unity project, I'm trying to create a multi-peer scenario using a Mesh architecture (at the moment, this is a project requirement), so I have a peer connection for each couple of users. I'm sure I will have very few users per "room", so this is not actually a problem.
The problem is that I need to use the same media source for more than one PeerConnection, but I noticed that a MediaSender (eg. WebcamSource and MicrophoneSource) cannot be shared between more than one Transceiver.
Describe the solution you'd like
I'd like to know how I can use the same media source for more than one PeerConnection.
I thought that using an extra layer between the media source and the Transceiver that "duplicates" the data to send, something as a "CloneVideoSender" or "CloneAudioSender", could be an idea, but maybe there are better solutions I haven't considered yet.
Another idea could be to split the device (webcam or mic) capture logic from the Track logic and use the device capture to populate a new custom media sender type so that more media senders can read the output data from the device.
Describe alternatives you've considered
About the webcam, in order to be shared with more than one other peer, I considered rendering the webcam image in a dedicated MediaPlayer (not visible from the local user's camera) and then create N SceneVideoSender objects (one per PeerConnection) with their own cameras to capture the webcam image on the media player and share it with the others.
Unfortunately, about the microphone, I don't have any idea about how to share it more than one time. This is a problem because the voice chat is a mandatory requirement of the application.
The very last chance is to move the voice chat to a different service instead of the WebRTC component, with the risk to lose the sync between the video shared with WebRTC and the audio.
I hope I have written in an understandable way and that I have not left out important things in my analysis before writing this message.
I thank you as always for your help and for your work, and I wish you a good day!
Riccardo
The text was updated successfully, but these errors were encountered: