react-native-davoice-tts 1.0.230 → 1.0.232
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.
package/TTSRNBridge.podspec
CHANGED
|
@@ -2,7 +2,7 @@ require 'json'
|
|
|
2
2
|
|
|
3
3
|
Pod::Spec.new do |s|
|
|
4
4
|
s.name = "TTSRNBridge"
|
|
5
|
-
s.version = "1.0.
|
|
5
|
+
s.version = "1.0.105" # Update to your package version
|
|
6
6
|
s.summary = "TTS for React Native."
|
|
7
7
|
s.description = <<-DESC
|
|
8
8
|
A React Native module for tts .
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
295541d656510dc5569d031d12f22e87 tts-1.0.0.aar
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
22e35a9d9aea91558703c48e454865d9401d8621 tts-1.0.0.aar
|
package/package.json
CHANGED
package/speech/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// speech/index.ts
|
|
2
2
|
import { NativeModules, NativeEventEmitter, DeviceEventEmitter, Platform } from 'react-native';
|
|
3
|
+
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
|
|
3
4
|
|
|
4
5
|
// If you use typed-array -> base64, Buffer is convenient (works in RN)
|
|
5
6
|
let toBase64: (u8: Uint8Array) => string;
|
|
@@ -406,18 +407,33 @@ private rewireListenersForMode() {
|
|
|
406
407
|
}
|
|
407
408
|
|
|
408
409
|
// --- NEW: TTS passthroughs for external audio ---
|
|
410
|
+
/** Queue a WAV file (local path, file:// URL, or require() asset). */
|
|
411
|
+
async playWav(pathOrURL: string | number, markAsLast = true) {
|
|
412
|
+
// NEW: resolve require() assets to actual file path/URI
|
|
413
|
+
const asset = resolveAssetSource(pathOrURL);
|
|
414
|
+
const realPath = asset?.uri ?? pathOrURL; // fallback keeps string path intact
|
|
409
415
|
|
|
410
|
-
/** Queue a WAV file (local path or file:// URL). Routed via AEC path, queued with speak(). */
|
|
411
|
-
async playWav(pathOrURL: string, markAsLast = true) {
|
|
412
416
|
// Prefer unified iOS bridge if present
|
|
413
417
|
if (Platform.OS === 'ios' && NativeSpeech?.playWav) {
|
|
414
|
-
return NativeSpeech.playWav(
|
|
418
|
+
return NativeSpeech.playWav(realPath, markAsLast);
|
|
415
419
|
}
|
|
420
|
+
|
|
416
421
|
// Fallback: direct TTS bridge (Android + iOS fallback)
|
|
417
422
|
if (!NativeTTS?.playWav) throw new Error('playWav not available on this platform.');
|
|
418
|
-
return NativeTTS.playWav(
|
|
423
|
+
return NativeTTS.playWav(realPath, markAsLast);
|
|
419
424
|
}
|
|
420
425
|
|
|
426
|
+
// /** Queue a WAV file (local path or file:// URL). Routed via AEC path, queued with speak(). */
|
|
427
|
+
// async playWav(pathOrURL: string, markAsLast = true) {
|
|
428
|
+
// // Prefer unified iOS bridge if present
|
|
429
|
+
// if (Platform.OS === 'ios' && NativeSpeech?.playWav) {
|
|
430
|
+
// return NativeSpeech.playWav(pathOrURL, markAsLast);
|
|
431
|
+
// }
|
|
432
|
+
// // Fallback: direct TTS bridge (Android + iOS fallback)
|
|
433
|
+
// if (!NativeTTS?.playWav) throw new Error('playWav not available on this platform.');
|
|
434
|
+
// return NativeTTS.playWav(pathOrURL, markAsLast);
|
|
435
|
+
// }
|
|
436
|
+
|
|
421
437
|
/**
|
|
422
438
|
* Convenience: queue a typed array (Int16Array | Float32Array | ArrayBuffer) as PCM.
|
|
423
439
|
* We’ll base64 it and pass through to native with the right metadata.
|