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

1 second pause when playing #21

Open
Aroxed opened this issue Sep 7, 2023 · 0 comments
Open

1 second pause when playing #21

Aroxed opened this issue Sep 7, 2023 · 0 comments

Comments

@Aroxed
Copy link

Aroxed commented Sep 7, 2023

Hi guys.
I'm trying to play PCM audio received via Web sockets.
Everything is cool except playing is occurring after a 1-second delay. Every time I speak at the server microphone, a 1-second delay occurs before the PCMPlayer plays it.
I tried to investigate the source code but didn't find a solution.
Also, I am convinced that the server side sends sound data accurately.
Could you help me to find a workaround?

Let me show you the code of my player class:
initPlayer() {
this.player = new PCMPlayer({
encoding: '16bitInt',
channels: 1,
sampleRate: 8000,
flushingTime: 100 // 1, 400, 1000 tested, no effect
});
}

play(data) { // data retrieved from WebSockets
    const dataArray = new Uint8Array(data);
    if (this.player) {
        this.player.feed(dataArray);

    }
}
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

1 participant