Is there a good React Native module for playing/streaming audios? - audio

I'm new to react native and building an audio streaming app. I found quite a few react native wrappers for native modules for playing audio files https://js.coach/react-native/react-native-ios-audio?search=audio
But none of them seem sufficient. I'm looking for a module that would
allow playing in the background and handle interruptions
have play-speed control
allow both streaming and local file playing
Does such a module exist? Any tips would be much appreciated. Thanks!

If your intention is to use the features you mentioned in a cross-platform (android/ios) app, then you do have some options, but there isn't a single module that will cover each of those bases.
Right now, I'm using a few different modules to accomplish similar functionality to what you're looking for:
react-native-audio-streaming to stream audio from a remote URL.
react-native-sound to play local audio files.
react-native-audio-streamer to stream audio from a remote URL on Android, since it uses ExoPlayer, instead of the AACDecoder used by react-native-audio-streaming.
Support for loading sound over the network was recently added to react-native-sound for iOS, and someone has mentioned the possibility of implementing it on Android as well. If this happens, then it may be the best choice for your use case.
I've included the current react-native-sound feature set below. Hope this helps!

Try Following Modules.
react-native-audio-streaming
react-native-audio-streamer

Related

Embed and play sound (via audio element) in electron app

The actual task is to play mp3 file that should be embedded with the electron app.
I placed the mp3 file near my electron app "main.js".
I wanted to play it using some "sound-play" (https://github.com/nomadhoc/sound-play) package using bridge api, but it didn't worked out, sound is not playing.
So I want to just play it using an audio element (which seems to be more universal), but I don't get what src url I should supply to it. And then I wonder how to correctly add an additional asset to the built version (I'm using electron-builder).
Working with extra/local resources in election apps is kind of obscure topic for me. Advice would be appreciated.

React JS app: How do I load new TTS voices?

I’m building an app with the React JS library, using Electron and Node JS to package it as a Windows .exe
I used the “speak-tts” module to integrate speech synthesis. Everything seems to be pretty straightforward, but I can’t figure out how to load additional voices. I can only get the default voice.
Has anyone else come across this issue? Your advice is much appreciated.
I'm the creator of the speak-tts module. As you can see in the documentation (https://www.npmjs.com/package/speak-tts) there is a setVoice() method that you can call on your instance to change the voice on the fly.
You can get the list of available voices in the browser from the onvoiceschanged listener. Also there might be specific issues with Electron and this package that I'm not aware of.
If so do not hesitate to create a github issue (https://github.com/tom-s/speak-tts/issues).
Easiest way to do is use plain JS methods
For reference.
https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis/cancel
It has all the required methods. cancel(), start(), pause() etc

Steps to use Nodejs modules like assert and paralleljs with Titanium appcelerator

I want to use the assert and paralleljs modules in mobile apps developed with Titanium Appcelerator. If anyone has used these modules or similar to this, please help me to use these too.
Thanks in advance.
That would be great! The problem I think is that javascript (at least at it's current version) isn't multi-threaded. it's built to be event driven - and if you use event driven well, you can get pretty good performance. What paralleljs does is using web-workers which are not available in Titanium.
What you might be able to to is write some kind of webview that will run the work inside it and report back to Titanium.
Take a look at the following:
How to create multithreading in mobile sdk
Titanium Worker Thread Module
You'll have to test it and see if it's memory/performance efficient.

Sharing code between node js project and a web site project

So I started coding a chess engine in typescript as a side project. I initially intended it to be a CLI like most other chess engines that interact through stdin and stdout. This so I could plug it to a GUI like Arena and test it against other engines. For that I decided to do it as a node project.
I set it across several files with 1 being the UCI (universal chess interface) implementation and the remaining ones chess logic and AI logic. After banging my head a few times trying to understand modules in typescript I finally got it to work.
Now I decided it would be interesting to write a simple GUI myself as a webpage with html+typescript+jquery. Now, I would like to use all the logic modules I wrote but I'm finding it impossible. From what I understand you can't use CommonJS in browsers so the only way I could get it to work was using instead internal modules for which I need to modify the .ts files to wrap the code in module X{ } blocks and recompile them just for the GUI every time I change something. This situation seems far from ideal and I was wondering if there is a way around it...
Use http://browserify.org/ to add CommonJS-like support on the front-end.
But also read this (slightly outdated) question and answer: How should I go about writing a node.js web application with both server and client side code?
Use external modules for both the server and the browser.
When compiling for the browser, use the switch to specify the AMD module pattern:
tsc --module amd app.ts
And use RequireJS to load modules for you.
<script src="require.js" data-main="app.js"></script>
You will need to compile for the different targets, but the source code in TypeScript can be identical.
I created a demo project to share code between the client and the server : https://github.com/basarat/demo-fullstack/blob/master/src/Gruntfile.js
It compiles the common files for both amd/commonjs and server files only as commonjs with the client only files as only amd. It uses grunt-ts to manage this : https://github.com/grunt-ts/grunt-ts

HaxeNME with smartfox server integration

I'm working on a multiplayer game that required the use of Smartfox server, surely I want to start creating the client side in HaxeNME to enable exportation to iphone / android / web at the same time. From my awareness, smartfox only support Flash (and others but not Haxe) client library. So, anyone already working on this can point me to the correct library or direction ? I really don't want to rewrite the client library for Haxe as it's time consuming ?
Or should I use other technology to develop this game ? I tended to fall back to Unity if there are no other way to get haxeNME works with smartfox ... Any idea, everyone ?
thanks for your answers !
I've ported AS3 smartfox to haxe/cpp.
All works quite fine except the BlueBox module because of nme.net.URLRequest that doesn't support POST method yet :/
But in the futur I'll use the SWC on flash target, Java and objectiveC for android and iOS with nme.JNI and nmex support...
If your target is CPP/NME, I'm afraid your only option is to port the SmartFox AS3 client code to Haxe.
There are some tools that can be helpful for the task. Look for as3hx.
If you mean using SWC files from smartfox, haXe does not currently support SWC linking, however you can use them. You'll first have to unzip the SWC to extract the library.swf and add it with --swf-lib library.swf to your compiler parameters.
More information on http://haxe.org/manual/swc

Resources