Setup web Proxy in Un4Seen Bass.Net

363 views Asked by At

I'm writing a streaming media player that uses the Bass.Net wrapper for Un4Seen's Bass native audio API. I want the media player to support a web proxy, which is easy enough for me to setup in the built in .NET webclient library, but I cannot find documentation on how to setup the proxy in Bass.Net

Any ideas of how to do this?

1

There are 1 answers

0
Prof On
public IntPtr _myProxyPtr;
...
// create an unmanaged pointer containing a copy of the string
_myUserAgentPtr = Marshal.StringToHGlobalAnsi("user:pass@server:port");
Bass.BASS_SetConfigPtr(BASSConfig.BASS_CONFIG_NET_PROXY, _myProxyPtr);
...
// make sure to free the myUserAgentPtr!!!  
// e.g. when you dispose your class or application
Marshal.FreeHGlobal(_myProxyPtr);

BASS_CONFIG_NET_PROXY Proxy server settings. newvalue (IntPtr): The "User-Agent" header. The proxy server settings, in the form of "user:pass@server:port"... null = don't use a proxy. "" (empty string) = use the default proxy settings. If only the "user:pass@" part is specified, then those authorization credentials are used with the default proxy server. If only the "server:port" part is specified, then that proxy server is used without any authorization credentials.

BASS does not make a copy of the proxy string, so it must reside in the heap (not the stack), eg. a global variable - see example below! This also means that the proxy setting can subsequently be changed at that location without having to call this function again.

Changes take effect from the next internet stream creation call. By default, BASS will use the Windows proxy settings, as set in the Internet Properties control panel.

From here: http://www.bass.radio42.com/help/html/e67e2d41-ed14-19c1-b75a-48bad250f261.htm