-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch Stream (Video + Screen), best pratice #652
Comments
Did you check this demo? I'm using To support parallel video-tracks, we can either clone camera-track for a secondary stream or use |
If someone need replace tracks like Obviously need have a screenshare handler for known when screen track change state to setTrack(track, type) {
return new Promise((resolve, reject) => {
// Check track and type are valid
if (!track || !type) reject(new Error('You don\'t set track or type track.'));
// Check that track is not ended
if (track.readyState === 'ended') reject(new Error('You don\'t can\'t replace with an "ended" track.'));
// Each all participants for send screen track
const foo = this.connection.getAllParticipants().forEach((pid) => {
// Get peer connection of every participant
const { peer } = this.connection.peers[pid];
// Check that peer have senders or next peer
if (!peer.getSenders) return;
// Get all
peer.getSenders().forEach((sender) => {
// Check the sender of peer and track, or next sender
if (!sender || !sender.track) return;
// Get the track type and replace track with the new stream if match
if (sender.track.kind === type && track) sender.replaceTrack(track);
});
});
// Wait for replace to all peers and ready
Promise.all(foo).then(() => resolve()).catch(() => reject());
});
} |
The method I making a function switch microphone. Can you help me how can make it ?! Thanks |
hi i m using RTCMULTICONECCTION but const stream = await navigator.mediaDevices.getUserMedia(constraints); it does not work connection.sdpConstraints.mandatory = { }; I don't know how to default the rear camera |
@AdamWarlock001 you need check the default deviceId of mobile. I mean, knowing the ID of front camera you can request A not precise example is: const devices = await navigator.mediaDevices.enumerateDevices(); After this you need filter by kind of device like |
Is this works?? |
Hello, first of all congratulations for the excellent work that you have been doing Muaz.
I wanted to get a doubt about the stream switch between video and screen.
Because we have problems when we share two video / screen sources from Google Chrome for Mozilla Firefox.
Would you like to know the best way to switch from video to screen, or do we have some way of transmitting the two at the same time from the same source?
When i use:
after
works normal when they are between the same browsers, however when it is two different browsers it triggers an error
DOMException: "Found multiple different webrtc track ids in m-section 1. The behavior here is undefined."
and does not load the additional stream, just keeps the existing one.
Thank you very much for your attention.
The text was updated successfully, but these errors were encountered: