React Native Expo - Play audio directly from websocket - react-native

I'm using react native expo and have a websocket server from which I get live audio Data in mulaw format. I'm trying to convert these data into a wav file and then play it through Expo Audio.
I use the WaveFile Package to convert the File and would like to store it in Cache so Expo Audio can play it. (Audio can't be played from Buffer directly, right?)
Problem: Expo FileSystem only allow me to write String Files and I can't create a wav file out of the given buffer from WaveFile Package. Any Ideas what I could do here?

var fileUri = `${FileSystem.documentDirectory}/test.wav`;
await FileSystem.writeAsStringAsync(fileUri, "UklGRsBCDQBXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAATElTVBoAAABJTkZPSVNGVA4AAABMYXZmNTguNDUuMTAwAGRhdGF6Qg0AAAAAAP//AAAAAAEAAgACAAIAAgAEAAMAAwAFAAYAB",

Related

React native m3u radio player

I am trying to make a radio streaming app using react native but it doesn't work.
I tried expo-av with Expo CLI, and react-native-radio-player, react-native-video from react native CLI
all of them work well with mp3 and mp4 extensions but don't work with m3u extension..
RadioPlayer.radioURL('https://radio.therockeg.com/clv_64.m3u');
I use https://icecast.org/ for the radio streaming, any help?
m3u is just a text format with a list of sources inside, you can read this data on your app side, extract sources and play it with any player you prefer.

Download dash and hls in react native

is there a way to download hls and dash videos in react native so that they can be played offline ? I am trying to use react-native-fetch-blob it successfully downloads mp4 files but unable to download dash and hls. Also is there a way to hide the video files or encrypt them so that only the player can read them ?

How to handle API which return file like (image,pdf etc) in react native?

When I am hitting an API it returns file like an image or PDF in react native so is there any package of Expo which provide the ability to download these files into local storage, kindly give an idea about any Expo Package to handle this.
This is the data I've got in the console.
data: "%PDF-1.5\r\n%����\r\n19 0 obj\r\n<<\r\n/Type /Cat..."
The answer you are looking for is expo-file-system

Expo Camera on Android doesn't work well as on Web

I'm developing a React Native app. I'm using Camera-Expo.
When I test it and take a photo on Web, it is saved as 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUg....' and it can be saved on cloudinary.com
Though when I test it on my phone using Expo, the photo is saved as 'file:///data/user/0/host.exp.exponent/cache/Experie.....' and it is not saved on cloudinary.com
How can I save the photos I make by phone on cloudinary?
Use ImageManipulator from Expo to change the captured file to base64 and then you can upload it on cloudinary

Download a pdf and save to device (ios and android) in react-native

I am pretty new to react-native (app development as such).
I want to download and save a pdf file in user's device in react-native? react-native-fs and rn-fetch-blob showed up as popular options.
I am using redux-saga in my project and axios to fetch json data.
I am able to get a blob object of the pdf file using axios.
So, how can i achieve this downloading and saving the file in the device? Can i use axios plus some library to get the file from blob object or should i be using either react-native-fs or rn-fetch-blob?
Any suggestions would help!