Two For One : Playing YouTube Flash Videos + Proxying / Changing Local IP Used
-
Hey there! Let's see if you can shed some light on my problem. [C++ with Qt 5.2, using Qt Creator]
Situation: I've got a PC with several local IP addresses assigned, let's say .1 to .100. The router has different configurations regarding bandwidth, ports, connections, etc. for each local IP. I'm integrating this Local IP-switching to my Qt apps, in particular to an app that offers a nice browsing experience using QWebView.
What I need I : To be able to change which local IP QWebView uses to get its requests out.
What I've tried so far:
- Local proxying. I use this:
@
proxy = new QNetworkProxy();
proxy->setType(QNetworkProxy::HttpProxy);
proxy->setHostName("127.0.0.1");
proxy->setPort(port);
proxy->setApplicationProxy(*proxy);
@
And then map each port to a local IP, using for example STUNNEL.
This works perfectly overall, but has the little drawback that I'm not able to play some YouTube videos. All I get is static and "An error has ocurred". Please note that removing the proxy, using QNetworkProxyFactory::setUseSystemConfiguration(true) makes all videos work correctly. I must be missing something, maybe some settings? I have these set:
@
view->page()->settings()->setAttribute(QWebSettings::JavaEnabled, true);
view->page()->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
view->page()->settings()->setAttribute(QWebSettings::AutoLoadImages, true);
@- Intercepting all QNetworkRequest and modifying the Local IPs they use: Nope. Couldn't find how to do it. I can intercept them, but didn't find a way to change the local IP they go out through. I can get the interface, but that's of no help (one interface may have several local IPs assigned).
Any ideas? Keep in mind that, bottom line, the idea is to browse the web successfully (for example, being able to watch something as common as YouTube flash videos, not even trying to get HTML5 to work) and that the Local IP packets use can be changed.
I'll report any advance I make on the subject.
Thanks in advance.
Edit: Typo.
- Local proxying. I use this: