fix: play ringtone for incoming calls before trying to getUserMedia

This commit is contained in:
td 2022-12-30 20:33:04 +05:30
parent dd7cf5c1bf
commit bd352b60a6
No known key found for this signature in database
GPG Key ID: F6D9E9BF14C7D103
1 changed files with 11 additions and 4 deletions

View File

@ -229,6 +229,17 @@ class VoIP {
content['offer']['type'], content['offer']['type'],
); );
/// play ringtone. We decided to play the ringtone before adding the call to
/// the incoming call stream because getUserMedia from initWithInvite fails
/// on firefox unless the tab is in focus. We should atleast be able to notify
/// the user about an incoming call
///
/// Autoplay on firefox still needs interaction, without which all notifications
/// could be blocked.
if (confId == null) {
delegate.playRingtone();
}
await newCall.initWithInvite( await newCall.initWithInvite(
callType, offer, sdpStreamMetadata, lifetime, confId != null); callType, offer, sdpStreamMetadata, lifetime, confId != null);
@ -247,10 +258,6 @@ class VoIP {
///TODO: notify the callkeep that the call is incoming. ///TODO: notify the callkeep that the call is incoming.
} }
// Play ringtone
if (confId == null) {
delegate.playRingtone();
}
} }
Future<void> onCallAnswer( Future<void> onCallAnswer(