Skip to content

How to stream and play PCM data returned from the backend? #363

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

Open
418442040 opened this issue Mar 19, 2025 · 7 comments
Open

How to stream and play PCM data returned from the backend? #363

418442040 opened this issue Mar 19, 2025 · 7 comments
Labels
feature New feature

Comments

@418442040
Copy link

Feature Request

The backend streams a large number of PCM fragments. How can I use react-native-audio-api to stream and play these PCM fragments in real time while they are being received? Is this achievable? This is just a consultation question. Thank you!

@maciejmakowski2003
Copy link
Collaborator

maciejmakowski2003 commented Mar 20, 2025

Unfortunately is is not possible currently. Adding support for worklets, which is on our road map, will make it possible. We are planning to provide worklets support in 0.6.0.

@418442040
Copy link
Author

Unfortunately is is not possible currently. Adding support for worklets, which is on our road map, will make it possible. We are planning to provide worklets support in 0.6.0.

Thank you for your hard work

@Chr1st1anG
Copy link

@418442040 https://www.npmjs.com/package/pcm-player you can checkout this player, works for me

@zwily
Copy link

zwily commented Apr 10, 2025

@418442040 https://www.npmjs.com/package/pcm-player you can checkout this player, works for me

You mean you used pcm_player with react-native-audio-api together in a react-native app? Do you have any example code?

@maciejmakowski2003
Copy link
Collaborator

It is written only in js, so I am not sure if performance will be good enough

@Chr1st1anG
Copy link

@418442040 https://www.npmjs.com/package/pcm-player you can checkout this player, works for me

You mean you used pcm_player with react-native-audio-api together in a react-native app? Do you have any example code?

Yes, exactly. However, keep in mind that recording in parallel can get tricky and buggy (I am not a react native expert), so consider this a workaround until better solutions become available. You can use the code from pcm-player and import react-native-audio-api.

@linear linear bot added the feature New feature label Apr 24, 2025
@maciejmakowski2003
Copy link
Collaborator

maciejmakowski2003 commented Apr 28, 2025

We have added microphone support in the 0.6.0-rc.2. Our implementation has some kind of callback which streams data to js. We have provided example app which records and plays audio data. You can check it here, it could be helpful in your case.

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

No branches or pull requests

4 participants