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

Play audio bytes #154

Open
FlawaCLV opened this issue Sep 16, 2019 · 5 comments
Open

Play audio bytes #154

FlawaCLV opened this issue Sep 16, 2019 · 5 comments
Labels

Comments

@FlawaCLV
Copy link

I've created an audio live stream with my previous mobile app (Cordova). I send audio bytes using socket.io, buffer for a few seconds and play the array of bytes.

Is there a way to play audio bytes using your plugin? Or maybe you are familiar with a plugin that can convert my bytes first?

I was thinking, creating a file with the received audio bytes, then play it with player. playFromFile(), but I guess this isn't optimal. Any idea ?

@bradmartin
Copy link
Collaborator

Honestly, not sure myself. Never had to do that.

On Android the MediaPlayer is calling setDataSource https://developer.android.com/reference/android/media/MediaPlayer.html#setDataSource(java.io.FileDescriptor) - there are a few overrides accepting different types for the source. Just at quick glance it looks like you'll need to create a file first and then play it, but maybe I'm overlooking one of the methods that will accept bytes as the input.

Hope that helps. I haven't looked at iOS to see if the player there accepts bytes as the audio source.

@zangarmarsh
Copy link

@FlawaCLV @bradmartin Have you found a real solution to this by the chance?

@FlawaCLV
Copy link
Author

@zangarmarsh I didn't use this plugin, I used AudioContext instead.

@zangarmarsh
Copy link

Thank you for your feedback @FlawaCLV . Do you mean JavaScript AudioContext? If so, do you already know if it supports background playback and playing speed variations?

@FlawaCLV
Copy link
Author

FlawaCLV commented Apr 27, 2021 via email

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

No branches or pull requests

3 participants