I am using FFmpeg to re stream video from a camera(which is connected via wifi with no internet connection) to another server, and I want to do the re streaming process via cellular data. As I am already connected to wifi and to use cellular data at the same time bindProcessToNetwork()
. Before executing ffmpeg command I have done the the following
final ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkRequest.Builder req = new NetworkRequest.Builder();
req.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET);
req.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);
cm.requestNetwork(req.build(), new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
//here you can use bindProcessToNetwork
//cm.getNetworkInfo(network);
if (cm.getNetworkInfo(network).getType() == ConnectivityManager.TYPE_MOBILE) {
cm.bindProcessToNetwork(network);
}
}
});
it is working fine in most of the case, like webview is working properly by using cellular data , while connected to wifi , but when I try to execute any ffmpeg command it doesn't work .