diff --git a/lib/src/voip/voip.dart b/lib/src/voip/voip.dart index 47d0db78..8e48f6b6 100644 --- a/lib/src/voip/voip.dart +++ b/lib/src/voip/voip.dart @@ -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 onCallAnswer(