How to handle partial data loading. #2891
-
I am having an issue where it appears only part of the audio data is loading for my audio elements. I call In order to determine whether or not wavesurfer was the issue, I replaced my wavesurfer code with just bare html audio elements, and the same issue would occur intermittently. The value for the duration of the track just wouldn't be visible sometimes, yet the audio would continue to play, or would fail to play past a certain point and would be unable to seek. When these issues happened with both the wavesurfer and implementations, I would see this error in the console: It seems like the browser only loads partial data for the file and is unable to fetch the remaining data. Does anyone know why this might be happening and is there anything I can do on the server or client to fix this? And if there is nothing I can do to reliably make this issue go away, is there something like an event I can listen to to determine that the content was not fully loaded, so I can show a proper indication in my UI, rather than an incorrect duration value? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
You should check the events the audio element has: https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement/Audio
I can’t say much about http servers in this regard. Perhaps try different ones? I would expect mainstream solutions like S3/CloudFront to work well out of the box. |
Beta Was this translation helpful? Give feedback.
Are you using v7 btw? The duration is guaranteed to be there in v7 because it falls back to the decoded data duration if the media element doesn't have one.