问题
I am using android AudioStream
to communicate between 2 android devices on wifi, both ways. Is there any way to broadcast an audio message on multiple devices, in the same time ?
Is using multiple AudioStreams, one for each device, a possible way? I need to broadcast to 40 receivers. Will the message be delayed if I use multiple AudioStreams ?
Do you know other solutions ?
回答1:
I think the simplest way is to stream all devices using AudioGroup, you just need to create separate AudioStream for each clients and join them to one AudioGroup. That is it.
AudioGroup audio = new AudioGroup();
audio.setMode(AudioGroup.MODE_NORMAL);
AudioStream stream1 = new AudioStream(yourLocalIP);
stream1.setCodec(AudioCodec.PCMU);
stream1.setMode(RtpStream.MODE_SEND_ONLY);
stream1.associate(firstClientIP, anyport);
stream1.join(audio);
AudioStream stream2 = new AudioStream(yourLocalIP);
stream2.setCodec(AudioCodec.PCMU);
stream2.setMode(RtpStream.MODE_SEND_ONLY);
stream2.associate(secondClientIP, anyport);
stream2.join(audio);
来源:https://stackoverflow.com/questions/41857076/broadcast-audiostream-to-multiple-devices