Merge branch 'td/ringtone' into 'main'

fix: play ringtone for incoming calls before trying to getUserMedia

Closes famedly-web#656

See merge request famedly/company/frontend/famedlysdk!1204
This commit is contained in:
Nicolas Werner 2023-01-03 22:56:51 +00:00
commit 4ff07b58f4
1 changed files with 11 additions and 4 deletions

View File

@ -229,6 +229,17 @@ class VoIP {
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(
callType, offer, sdpStreamMetadata, lifetime, confId != null);
@ -247,10 +258,6 @@ class VoIP {
///TODO: notify the callkeep that the call is incoming.
}
// Play ringtone
if (confId == null) {
delegate.playRingtone();
}
}
Future<void> onCallAnswer(