react-native-audio-streaming icon indicating copy to clipboard operation
react-native-audio-streaming copied to clipboard

Stream from node server

Open raouldandresy opened this issue 6 years ago • 3 comments

Hi, this is a very powerful module, great work! But i'm a little question, i'm trying to stream from node server and when i give the url at player, the serve r get the request and pipe the mp3. The problem is if i open the url in the browser it works but not the player. Any advice?

raouldandresy avatar Mar 29 '18 12:03 raouldandresy

probably the setup is done incorrect. Could you please share the stacktrace or any further information on how to reproduce the problem ?

itsmeWaqar avatar Jun 25 '18 06:06 itsmeWaqar

Hi,

i am also facing similar issue in playing audio from node js http stream response in react-native ios application .

here is node server code 👍 exports.tts = async function tts(req, res) { // get from client tts_key = req.headers.tts_key; tts_text = req.body.tts_text; tts_voice = req.body.tts_voice;

// IBM authentication
var TTS = new TTS_IBM({
    authenticator: new IamAuthenticator({ apikey: tts_key }),
    url: 'https://stream.watsonplatform.net/text-to-speech/api/',
});

// convert text to speech
const { result } = await TTS.synthesize({
    text: tts_text,
    voice: tts_voice,
    accept: 'audio/wav',
});

// stream
result.on('response', (response) => {
    response.headers['content-disposition'] = 'attachment; filename=audio.wav';
    res.writeHead(200, {
        'Content-Type': 'audio/wav',
        'Content-Length': transcript.size,
    });
});
result.pipe(res);

};

react-native code 👍

let response = await fetch(dialogflowConfig.tts_end_point, { method: 'POST', headers: { Accept: '/', 'Content-Type': 'application/json', tts_key: << key>> }, body: JSON.stringify({ tts_text: tts_text, tts_voice: tts_voice, }) });

soundplayer.play(response);

bsdoma avatar Nov 24 '19 03:11 bsdoma

when i started used react-native-audio-streaming library ..getting below error in build .

node_modules/react-native/React/Base/RCTBridgeModule.h:10:9: fatal error: 'React/RCTDefines.h' file not found #import <React/RCTDefines.h> ^~~~~~~~~~~~~~~~~~~~

1 error generated.

** BUILD FAILED **

The following build commands failed:

CompileC 

ios/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNAudioStreaming.build/Objects-normal/x86_64/ReactNativeAudioStreaming.o node_modules/react-native-audio-streaming/ios/ReactNativeAudioStreaming.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure)

Installing build/Build/Products/Debug-iphonesimulator/PhoenixiOSTest.app An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2): Failed to install the requested application An application bundle was not found at the provided path. Provide a valid path to the desired application bundle. Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/PhoenixiOSTest.app/Info.plist Print: Entry, ":CFBundleIdentifier", Does Not Exist

Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/PhoenixiOSTest.app/Info.plist Print: Entry, ":CFBundleIdentifier", Does Not Exist

at checkExecSyncError (child_process.js:603:11)
at Object.execFileSync (child_process.js:621:15)
at node_modules/react-native/local-cli/runIOS/runIOS.js:208:5

error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

bsdoma avatar Nov 24 '19 04:11 bsdoma