voice-react-native-sdk 2.0.0-preview.fork.7 → 2.0.0-preview.fork.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -35,7 +35,11 @@ class MediaPlayerManager {
|
|
|
35
35
|
soundMap.put(SoundTable.RINGTONE, soundPool.load(context, R.raw.ringtone, 1));
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
public void play(final SoundTable sound) {
|
|
38
|
+
public synchronized void play(final SoundTable sound) {
|
|
39
|
+
if (activeStream != 0) {
|
|
40
|
+
soundPool.stop(activeStream);
|
|
41
|
+
activeStream = 0;
|
|
42
|
+
}
|
|
39
43
|
activeStream = soundPool.play(
|
|
40
44
|
soundMap.get(sound),
|
|
41
45
|
1.f,
|
|
@@ -45,7 +49,7 @@ class MediaPlayerManager {
|
|
|
45
49
|
1.f);
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
public void stop() {
|
|
52
|
+
public synchronized void stop() {
|
|
49
53
|
soundPool.stop(activeStream);
|
|
50
54
|
activeStream = 0;
|
|
51
55
|
}
|
|
@@ -28,6 +28,14 @@ public class VoiceFirebaseMessagingService extends FirebaseMessagingService {
|
|
|
28
28
|
public void onCallInvite(@NonNull CallInvite callInvite) {
|
|
29
29
|
logger.log(String.format("onCallInvite %s", callInvite.getCallSid()));
|
|
30
30
|
|
|
31
|
+
// FCM is at-least-once; drop duplicate deliveries for the same callSid so we
|
|
32
|
+
// don't spawn a second notification/ringer that can orphan a looping sound stream.
|
|
33
|
+
if (null != getCallRecordDatabase().get(new CallRecord(callInvite.getCallSid()))) {
|
|
34
|
+
logger.warning(String.format(
|
|
35
|
+
"Duplicate call invite ignored for callSid %s", callInvite.getCallSid()));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
31
39
|
final CallRecord callRecord = new CallRecord(UUID.randomUUID(), callInvite);
|
|
32
40
|
|
|
33
41
|
getCallRecordDatabase().add(callRecord);
|