diff --git a/android/src/main/java/net/no_mad/tts/TextToSpeechModule.java b/android/src/main/java/net/no_mad/tts/TextToSpeechModule.java index c01c7c1..6be44a4 100644 --- a/android/src/main/java/net/no_mad/tts/TextToSpeechModule.java +++ b/android/src/main/java/net/no_mad/tts/TextToSpeechModule.java @@ -89,6 +89,16 @@ public void onStop(String utteranceId, boolean interrupted) { } sendEvent("tts-cancel", utteranceId); } + + @Override + public void onRangeStart (String utteranceId, int start, int end, int frame) { + WritableMap params = Arguments.createMap(); + params.putString("utteranceId", utteranceId); + params.putInt("start", start); + params.putInt("end", end); + params.putInt("frame", frame); + sendEvent("tts-progress", params); + } }); } } @@ -507,6 +517,10 @@ private int speak(String utterance, String utteranceId, ReadableMap inputParams) private void sendEvent(String eventName, String utteranceId) { WritableMap params = Arguments.createMap(); params.putString("utteranceId", utteranceId); + sendEvent(eventName, params); + } + + private void sendEvent(String eventName, WritableMap params) { getReactApplicationContext() .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) .emit(eventName, params);