-
Notifications
You must be signed in to change notification settings - Fork 16
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
Difficulty Specifying Media Types and Streaming in Rust MediaRecorder Implementation #506
Comments
Hey @Psionyc, great to hear you are trying things out! Regarding the mime-type, we only support WAV at the moment. I realize this may not be very clear because it is written in the fine print of https://docs.rs/web-audio-api/latest/web_audio_api/media_recorder/struct.MediaRecorder.html#method.new . We don't prioritize adding new mime types at the moment but we will get to that at a later stage. I'm open for PRs though. Regaring your 2nd question, your code looks reasonable - provided that |
Also, you will likely run into the following bug: #404 - have a look because a workaround is provided. |
@orottier, I appreciate your feedback. For my tests, I used the webm format because it's commonly used in web environments. I'm exploring a streaming service that sends data via web sockets. Unfortunately, I encountered a #404 error, resulting in an infinite recording with poor audio quality. Based on your suggestions, I'll make adjustments and report back with the results and my code. Thank you! |
Below is the code in it's entirety if you want to go through it 🤔
|
The code looks fine and if it works, it works! I hope you can get away with the WAV samples for now. I will write an issue to support MediaRecorder options (mime, codec, etc) from https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/MediaRecorder#options |
Hello,
I'm transitioning from JavaScript to Rust for handling media streams and I'm facing some challenges particularly with the
MediaRecorder
implementation.Background
In JavaScript, I was able to specify the codec and media type directly in the
MediaRecorder
constructor like this:This made it clear what type of data was being sent out.
Issue in Rust
In Rust, however, the API does not seem to offer a way to specify the mime type directly when initializing the
MediaRecorder
. Here's how I'm currently setting it up:I find it difficult to know what type of data is being sent out due to the lack of this specification capability.
Attempt at Streaming Audio Data to a Frontend
To handle streaming, I replicated the setup I had in JavaScript, but I'm unsure if I'm handling the stream data correctly in Rust. Here is the Rust code snippet for streaming:
For comparison, this is the JavaScript implementation that worked:
Questions
MediaRecorder
in Rust similar to how it's done in JavaScript?Any guidance or suggestions on how to handle these issues would be greatly appreciated!
Thank you.
The text was updated successfully, but these errors were encountered: