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

337
Vistas
react-native-sound force stopped after one minute played

i'm new in react native and have faced to one problem. i'm trying to make a time slider duration of an audio with setInterval(). and when the sound is playing, it will force stop after 1 minute playing the sound with no reason. Then i try to debug with console.log(), when the audio force stop, in the console.log() looks like this:

current time:  01:11
94 current time:  01:14

there is blue dot and it keep running when the audio force stopped

any idea to fix my problem?

this is my play sound function:

const playSound = () => {
    try {
        if (isPlaying === false) {
            sound.play();
            setButton(Pause);
            setIsPlaying(true);
            soundDuration();
        }
        else if (isPlaying === true) {
            sound.pause();
            setButton(Play)
            setIsPlaying(false)
        }
    } catch (e) {
        console.log('err', e)
    }
}

this is my get duration function:

const soundDuration = () => {
    setDuration(sound.getDuration())
}

and i use this function to handle the time slider:

useEffect(() => {
    var timerID = setInterval(() => loadCurrentTime(), 1000);
    return () => clearInterval(timerID);
});
const loadCurrentTime = useCallback(() => {
    if (isPlaying) {
        sound.getCurrentTime((seconds) => {
            console.log('current time: ', convertTime(seconds));
            setTimeSlider(seconds);
        });
    }
}, [sound, isPlaying]);

and this is the Slider:

<Slider
    style={{flex: 1, height: 40}}
    minimumValue={0}
    maximumValue={duration}
    minimumTrackTintColor="#FFFFFF"
    maximumTrackTintColor="#000000"
    thumbTintColor='#f6e3b0'
    value={timeSlider}
    step={1}
    // onValueChange={values => {
    //     // sound.setCurrentTime(values);
    //     setTimeSlider(values);
    // }}
/>
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