Open westlinkin opened 9 months ago
Does the await complete once you start listening to the stream?
Does the await complete once you start listening to the stream?
I get the sampleRate after creating the stream. I was not tested after listening.
But I have to get the sample rate beforehand, to connect wss server (as a parameter). I read somewhere in the document, even if i set the sample rate, the iOS platform may not obey the configuration i set, so i have to get it after creating the stream and before listening.
I will try it later though, and get back to you.
even if i set the sample rate, the iOS platform may not obey the configuration i set
This is correct and the main issue. There is no good semantic to resolve this. Either you assert that your preferred sample rate will be the actually used one, then you can send the sample rate you're configuring the stream with to your server. Or you send whatever the platform tells you is correct, requiring at least one set of samples to have been recorded.
I'm still looking for ways to improve this situation but I cannot circumvent platform limitations. You will have to adjust your server semantics, or not support iOS for the time being. Or you start recording before connecting to the server.
also have a look at #72 for a previous discussion the topic
@westlinkin How are you piping the audio to a WS server? I'm trying to accomplish the same thing.
@westlinkin How are you piping the audio to a WS server? I'm trying to accomplish the same thing.
Sorry for the late reply. You can just listen to the stream, and _channel.sink.add(uint8List);
, _channel
is the websocket channel, uint8List
is the onData
call of the StreamSubscription.
even if i set the sample rate, the iOS platform may not obey the configuration i set
This is correct and the main issue. There is no good semantic to resolve this. Either you assert that your preferred sample rate will be the actually used one, then you can send the sample rate you're configuring the stream with to your server. Or you send whatever the platform tells you is correct, requiring at least one set of samples to have been recorded.
I'm still looking for ways to improve this situation but I cannot circumvent platform limitations. You will have to adjust your server semantics, or not support iOS for the time being. Or you start recording before connecting to the server.
Even after I start listening to the stream, the await MicStream.sampleRate
did not complete. version 0.6.5
, on my iPad (ios 17.2.0) and macOS, it works fine. on ios simulator( ios 17.0.1), it brokes. but vesion 0.7.1+2
, it brokes even on macOS.
oh alright. If the problem occurs on an iOS emulator, this is a duplicate of #27
I'll give it another look to see what changes could have resulted in a different behaviour for macOS
double? sampleRate = await MicStream.sampleRate;
works fine in0.6.5
but in
0.7.1+2
, useint sampleRate = await MicStream.sampleRate
never completes. Is there something I am missing? the same code upgraded from0.6.5
to0.7.1+2