-
Notifications
You must be signed in to change notification settings - Fork 17
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
How to know whether its a audio or video call? #42
Comments
did you get an answer for this? we are currently using react native xmpp with ejabberd for chat and would like to use the same connection for call init and negotiations.. |
I had solved in a very much hacky way but I still hope that there having a better way: localMedia.start({
mirror: true,
audio: true,
video: true,
}, (err, stream) => {
session.addStream(localStream);
session.start();
if (!call.audio) {
localMedia.mute();
}
if (!call.video) {
localMedia.pauseVideo();
}
});
}, You can see that I am starting the call with both of audio and video media enabled and later after starting the session I am turning off Audio/Video. client.on('jingle:incoming', (session, arg1) => {
if (!session.isInitiator) {
localMedia.start({
mirror: true,
audio: true,
video: true,
});
}
}); And then the callee UI is getting the signal of Audio/Video off and turning off its Audio/Video accordingly for the very first time: const callerMediaChangeCount = {
audio: 0,
video: 0,
};
function needCalleePrecedingMediaAction(mediaType, session) {
return callerMediaChangeCount[mediaType] <= 1 && !session.isInitiator && session.connectionState === 'starting' && session.state === 'pending';
} client.on('jingle:mute', (session, arg1) => {
callerMediaChangeCount.audio += 1;
if (needCalleePrecedingMediaAction('audio', session)) {
session.mute();
}
});
client.on('jingle:unmute', (session, arg1) => {
callerMediaChangeCount.audio += 1;
if (needCalleePrecedingMediaAction('audio', session)) {
session.unmute();
}
});
client.on('jingle:hold', (session, arg1) => {
callerMediaChangeCount.video += 1;
if (needCalleePrecedingMediaAction('video', session)) {
session.hold();
}
});
client.on('jingle:resumed', (session, arg1) => {
callerMediaChangeCount.video += 1;
if (needCalleePrecedingMediaAction('video', session)) {
session.resume();
}
}); |
How to know whether the caller requested a video/audio call?
Or, How to know the remote media constraint?
The text was updated successfully, but these errors were encountered: