Skip to content

VLC for Android please enable and allow http-referrer and http-user-agent options to be set.

Description

VLC for Android please enable and allow http-referrer and http-user-agent options to be set.

I can get Vlc 3.0.8 on Ubuntu 18.04 64bit desktop to work / be set by using http-referrer and http-user-agent options while using an xspf file, an m3u file, and a Lua script file but when I load any of those files using VLC for Android on my Tablet running vlc 3.2.3 it doesn't work and I get an error "The location cannot be played"

How can I get http-referrer and/or http-user-agent to work / and/or test/fixed in VLC for Android?

Here's an example of a M3U file which works in Vlc 3.0.8 on Ubuntu 18.04 64bit desktop. vlc 3.0.8 on Ubuntu 18.04 64bit

#EXTM3U x-tvg-url="http://epg.streamstv.me/epg/guide-canada.xml.gz"
#EXTVLCOPT:http-user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.25 Safari/537.36
#EXTVLCOPT:http-referrer=https://referrerlink.tv/channel/
#EXTINF:-1 tvg-id="CSPAN-US" tvg-name="CSPAN-US" tvg-language="English" tvg-logo="https://s3.amazonaws.com/schedulesdirect/assets/stationLogos/s10161_h3_aa.png" group-title="",C-Span
https://skystreams-lh.akamaihd.net/i/SkyC1_1@500806/master.m3u8
#EXTINF:-1 tvg-id="CSPAN 2-US" tvg-name="CSPAN 2-US" tvg-language="English" tvg-logo="https://cdn.tvpassport.com/image/station/240x135/cspan2.png" group-title="",C-Span 2
https://skystreams-lh.akamaihd.net/i/SkyC2_1@500807/master.m3u8
#EXTINF:-1 tvg-id="CSPAN 3-US" tvg-name="CSPAN 3-US" tvg-language="English" tvg-logo="https://cdn.tvpassport.com/image/station/240x135/cspan3.png" group-title="",C-Span 3
https://skystreams-lh.akamaihd.net/i/SkyC3_1@500808/master.m3u8

Expected behavior

To enable and allow setting the options http-referrer and http-user-agent on VLC for Android just like in VLC for the desktop.

To test options here's a git site https://ijk4de.gitlab.io/httpheaders/

And the Javascript code to test with if you want to test your own.

<!DOCTYPE html>
<html>
  <head>
    <script type="text/javascript">
    //JavaScript goes here

    function getHeaders() {
    var req = new XMLHttpRequest();
    req.open('GET', document.location, false);
    req.send(null);

    // associate array to store all values
    var data = new Object();

    // get all headers in one call and parse each item
    var headers = req.getAllResponseHeaders().toLowerCase();
    var aHeaders = headers.split('\n');
    var i =0;
    for (i= 0; i < aHeaders.length; i++) {
        var thisItem = aHeaders[i];
        var key = thisItem.substring(0, thisItem.indexOf(':'));
        var value = thisItem.substring(thisItem.indexOf(':')+1);
        data[key] = value;
    }	    

    // get referer
    var referer = document.referrer;
    data["Referer"] = referer;

    //get useragent
    var useragent = navigator.userAgent;
    data["UserAgent"] = useragent;


    //extra code to display the values in html
    var display = "";
    for(var key in data) {
        if (key != "")
        display += "<b>" + key + "</b> : " + data[key] + "<br>";
    }
    document.getElementById("dump").innerHTML =  display;  
    }
    </script>

<noscript>
  <p>This site uses javascript to check http headers please enable javascript</p>
</noscript>

    <meta charset="utf-8">
    <meta name="generator" content="GitLab Pages">
    <title>Plain HTML site using GitLab Pages</title>
    <link rel="stylesheet" href="style.css">
  </head>
 
    
  <body>
    <div class="navbar">
      <a href="https://pages.gitlab.io/plain-html/">Plain HTML Example</a>
      <a href="https://gitlab.com/pages/plain-html/">Repository</a>
      <a href="https://gitlab.com/pages/">Other Examples</a>
    </div>

    <h1>This site is used to view http headers</h1>

    <p>
      This site is used to view http headers.
    </p>
    
    
    <body onload="getHeaders();">

    <div id="dump">
    data comes here
    </div>
  </body>
</html>

Screenshot / video

Edited by stillpointx