Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[useAudio] state.duration is always 0 when preload audio in nextjs

Abierto
#2,642 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
42/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
next.js, react, typescript
Área
frontend

Línea de trabajo

Start with the linked CodeSandbox and trace the useAudio entry point used with preload: 'metadata' in Next.js. Reproduce the zero-duration state, then inspect when the audio duration event is registered relative to loading. Done means state.duration is populated in this scenario; no source file or test is named in the issue.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

What is the current behavior?

Steps to reproduce it and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have extra dependencies other than react-use. Paste the link to your JSFiddle or CodeSandbox example below:

In nextjs, i used this hook useAudio with props preload: 'metadata', the strange thing is that the state.duration is always 0.
You can see details in the following sandbox.
https://codesandbox.io/p/devbox/react-use-audio-j7fwpm
What is the expected behavior?
make state.duration normal, it seems that the onDurationChange event is not trigger because the audio is loaded at early moment which the onDurationChange event is not added.

A little about versions:

  • OS:
  • Browser (vendor and version):
  • React:
  • react-use:
  • Did this worked in the previous package version?
Lenguaje dominante
TypeScript
Estrellas
44k
Forks
3.3k
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de streamich/react-use

Todos los issues de streamich/react-use

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.