Does the RTP Library of Java – Android support multicast?
I'm trying to multicast audio streams from one device to other devices using Android's RTP class
If possible, I don't want to use any third-party libraries
I can use audiostream and audiogroup to set each other's IP addresses to transmit two-way audio between the two devices, but I want to stream to the multicast group
If I try to instantiate audiostream with a multicast address (such as 239.1.1.1) and then use audiostream. Associate() with the same multicast address on another device, but I won't hear the stream
I have read some Android devices that do not support multicast, but my devices (Samsung Galaxy Tab 2S) support it. I even added the following content to my code to try to obtain multicast lock:
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
multicastLock = wifi.createMulticastLock("multicastLock");
multicastLock.setReferenceCounted(true);
multicastLock.acquire();
In addition, my manifest file has the following permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUdio" />
resolvent:
After in-depth research, I found that RTP class does support sending multicast, but does not support receiving. Probably this is because the socket used is not multicastsockets
In addition, for those interested, tab 2 is actually one of the devices that do not support joining multicast groups (that is, it does not send IGMP join packets), but if you set up a static multicast group in the network infrastructure, you will receive packets - so I mentioned above, I know they do support it
A quick way to check whether Android devices support joining multicast groups is to find out whether / proc / net / IGMP files exist