react-native-deepgram
Version:
React Native SDK for Deepgram's AI-powered speech-to-text, real-time transcription, and text intelligence APIs. Supports live audio streaming, file transcription, sentiment analysis, and topic detection for iOS and Android.
30 lines (29 loc) • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const config_plugins_1 = require("@expo/config-plugins");
const withAndroidDeepgram = (config) => {
return (0, config_plugins_1.withAndroidManifest)(config, (cfg) => {
const recordPermission = 'android.permission.RECORD_AUDIO';
const { manifest } = cfg.modResults;
const permissions = manifest['uses-permission'] ?? [];
if (!permissions.some((p) => p.$?.['android:name'] === recordPermission)) {
permissions.push({ $: { 'android:name': recordPermission } });
manifest['uses-permission'] = permissions;
}
return cfg;
});
};
const withIosDeepgram = (config, options = {}) => {
const message = options.microphonePermission ??
'Allow $(PRODUCT_NAME) to access the microphone';
return (0, config_plugins_1.withInfoPlist)(config, (cfg) => {
cfg.modResults.NSMicrophoneUsageDescription =
cfg.modResults.NSMicrophoneUsageDescription || message;
return cfg;
});
};
const withDeepgram = (config, options) => (0, config_plugins_1.withPlugins)(config, [
[withAndroidDeepgram, options],
[withIosDeepgram, options],
]);
exports.default = withDeepgram;