Skip to content

Commit a701858

Browse files
author
thegamerhat
committed
add fallback audio
1 parent 702fe85 commit a701858

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

public/error_audio.mp3

279 KB
Binary file not shown.

src/lib/client-utils.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import {z} from 'remotion';
22
import {mySchema} from '../HelloWorld';
3-
import {
4-
FALLBACK_RANDOM_AUDIO,
5-
SERVER_URL,
6-
} from '../server/TextToSpeech/constants';
3+
import {FALLBACK_AUDIO_URL, SERVER_URL} from '../server/TextToSpeech/constants';
74
import {RequestMetadata, ServerResponse} from './interfaces';
85

96
export const getTTSFromServer = async (
@@ -21,6 +18,6 @@ export const getTTSFromServer = async (
2118
return result.url;
2219
} catch (err) {
2320
console.error(err);
24-
return FALLBACK_RANDOM_AUDIO;
21+
return FALLBACK_AUDIO_URL;
2522
}
2623
};

src/server/TextToSpeech/constants.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import {staticFile} from 'remotion';
2+
13
export const FIREBASE_BUCKET_NAME = process.env.FIREBASE_BUCKET_NAME || '';
24

35
export const SERVER_URL = `http://localhost:${process.env.SERVER_PORT || 5050}`;
46
export const audioDirectoryInBucket = 'remotion-gtts';
57

6-
export const FALLBACK_RANDOM_AUDIO =
7-
// Anything random for now
8-
'https://firebasestorage.googleapis.com/v0/b/tts-testing-prod/o/bvgpt%2FMarks-%26-Logos-cb739e1ee69b%2Fen-IN-Wavenet-A-21ebb464c234d185293f3300ef09ec18.mp3?alt=media&token=0635adee-e71a-4c20-a820-e27274e3941e';
8+
export const FALLBACK_AUDIO_URL = staticFile('error_audio.mp3');
99

1010
export const voices = {
1111
'Man 1 (US)': {name: 'en-US-Neural2-D', languageCode: 'en-US'},

src/server/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import express from 'express';
77
import {createTextToSpeechAudio} from './TextToSpeech';
88
import cors from 'cors';
99
import dotenv from 'dotenv';
10-
import {FALLBACK_RANDOM_AUDIO} from './TextToSpeech/constants';
10+
import {FALLBACK_AUDIO_URL} from './TextToSpeech/constants';
1111
import {RequestMetadata, ServerResponse} from '../lib/interfaces';
1212

1313
dotenv.config();
@@ -27,7 +27,7 @@ app.post(`/getdata`, async (req, res) => {
2727
return res.json({url: audioURL} as ServerResponse).end();
2828
} catch (err) {
2929
console.error(err);
30-
return res.json({url: FALLBACK_RANDOM_AUDIO} as ServerResponse).end();
30+
return res.json({url: FALLBACK_AUDIO_URL} as ServerResponse).end();
3131
}
3232
});
3333

0 commit comments

Comments
 (0)