vlclibvlcvlcj

Using vlcj with proxy


I have video file which is only playable using proxy in vlc player, when I try to open it with vlcj I am unable to connect to this media - I've been trying to use http proxy configuration option in mrl ( http://path_to_media :http-proxy=proxy_address ) - but it didn't work for me yet. I've also tried setting environment variable http_proxy but it also didn't work for me. Could anyone tell me what I am doing wrong? Maybe there shouldn;t be a whitespace between path to media and configuration option? Maybe config options do not work on Windows? How can I access this video (I know I could use transcoding to do it but it seems like overkill, I feel there should be a simpler way)


Solution

  • Generally, if you want to pass options such as "--http-proxy" then this is the way to do it:

    MediaPlayerFactory factory = new MediaPlayerFactory("--http-proxy=<your settings");
    

    Or:

    String yourProxySettings = "http://whatever.com";
    MediaPlayerFactory factory = new MediaPlayerFactory("--http-proxy", yourProxySettings);
    

    Then use this factory instance to create your media player.

    I suppose you use this mechanism rather than using media options when you invoke play() because you are configuring the VLC instance itself, not the individual media.

    Caveat: In the versions of VLC I have, I do not see the --http-proxy option reported as an available command-line option.