Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem to re play a streaming audio #515

Open
CaleoSystems opened this issue Nov 29, 2023 Discussed in #514 · 4 comments
Open

Problem to re play a streaming audio #515

CaleoSystems opened this issue Nov 29, 2023 Discussed in #514 · 4 comments

Comments

@CaleoSystems
Copy link

Discussed in #514

Originally posted by CaleoSystems November 28, 2023
Hello,
I am using Peaks to play audios stored on a remote server served by a NodeJS based streaming server. Everything works fine before the audio ends, when the audio ends and I play it again I can't go forward or back since it always sends it to the beginning. This behavior only occurs with streaming and not with local audio.

Thanks for your help.

@chrisn
Copy link
Member

chrisn commented Nov 29, 2023

Which streaming server / library are you using?

Related: #189

@CaleoSystems
Copy link
Author

CaleoSystems commented Nov 29, 2023

Hi Chris,

I am using :
const http = require('http');
...
...
const src = fs.createReadStream(fileName);
res.writeHead(200, {'Content-Type':'audio/wav','Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'OPTIONS, POST, GET'});
src.pipe(res);

The waveform is generated using "audiowaveform".

Node v18.16.0

Thanks.

@chrisn
Copy link
Member

chrisn commented Nov 29, 2023

Thanks. Seeking probably isn't working because the browser isn't caching all the audio, and it can only seek within time regions it has cached. For that to work, you can serve the audio as a static file, so the browser can request the time regions it wants to play (see https://github.com/bbc/peaks.js/blob/master/doc/faq.md).

@CaleoSystems
Copy link
Author

Chris, I really appreciate your help.

This problem is not happening on Firefox, I will try some fix according to the reference you mentioned.

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants