Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

280
Vistas
How to play/listen buffer chunks in react native?

I am trying to create an app in react native to speak in microphone and listen at the same time. I tried the react-native-live-audio-stream package which streams the microphone. Here is the sample code:

import React, { Component } from 'react';
import { View, SafeAreaView } from 'react-native';
import { NativeBaseProvider, Button} from 'native-base';
import LiveAudioStream from 'react-native-live-audio-stream';
import { Buffer } from 'buffer';

export default class TestMic extends Component {

    startListenToMic(){
        LiveAudioStream.init({
            sampleRate: 32000,  
            channels: 1,       
            bitsPerSample: 16, 
            audioSource: 6,   
            bufferSize: 4096    
        });

        LiveAudioStream.on('data', data => {
            let chunk = Buffer.from(data, 'base64');  // => What I am supposed to do with this data to listen them?
            console.log(chunk) 
        })

        LiveAudioStream.start();
    }

    stopListenToMic(){
        LiveAudioStream.stop();
    }

    render(){
        return(
            <NativeBaseProvider>
                <SafeAreaView style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
                    <View style={{flexDirection: 'row'}}>
                        <Button
                            onPress={ () => this.startListenToMic() }
                            mr={3}
                        >Start</Button>
                        <Button
                            onPress={ () => this.stopListenToMic() }
                            ml={3}
                        >Stop</Button>
                    </View>
                </SafeAreaView>
            </NativeBaseProvider>
        )
    }
}

and this is the data log in console: Console Log

What is the best way to convert data to audio and listen ?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda