1. Download our Official Android App: Forums for Android!

Streaming video with basic HTTP authentication?

Discussion in 'Android Apps & Games' started by UncleMike, Apr 22, 2012.

  1. UncleMike

    UncleMike Android Expert
    Thread Starter
    Rank:
    None
    Points:
    163
    Posts:
    2,322
    Joined:
    Nov 15, 2009

    Nov 15, 2009
    2,322
    483
    163
    Central NJ
    I'm using FreeNAS as a storage location for my videos on my home network. On the local network I'm using a WD TV Live unit to play these videos on my TV by accessing them via the smb/cifs service on the FreeNAS machine. With the web server also enabled on the FreeNAS machine, and appropriate port redirection on my router, I can access these files from my Android device from anywhere. Clicking on the video in the web browser starts the video streaming in MX Player.

    I don't want these videos available to anyone that discovers my open port, but if I enable basic HTTP authentication on the FreeNAS machine, MX Player suddenly cannot play the video. I realize that MX Player doesn't know the credentials, and offers no way for me to provide them.

    I also tried Moboplayer with no luck. Are there any video players available that would work with this setup?
     

    Advertisement

  2. UncleMike

    UncleMike Android Expert
    Thread Starter
    Rank:
    None
    Points:
    163
    Posts:
    2,322
    Joined:
    Nov 15, 2009

    Nov 15, 2009
    2,322
    483
    163
    Central NJ
    I found what I think is a usable solution to this that doesn't require authentication to access the videos.

    The basic idea is to setup the firewall on the FreeNAS machine to allow only local IPs and the current IP of my phone to connect - all other traffic to the web server is rejected. But how does the FreeNAS machine know what the current IP of my phone is? Dynamic DNS of course!

    After determining the public IP address of my phone, I setup a host entry for my phone with no-ip.org. I then added the host name as "allowed" in the firewall. Everything worked fine. That is, until the public IP of my phone changed. I updated the host entry with no-ip.org, but now luck. After restarting the firewall, everything was working fine again. But it turns out that the firewall resolves host names only when it starts, not when it's evaluating traffic with regard to the firewall rules. Restarting the firewall every few minutes (using cron) seems to get around this problem, as the host names are re-resolved each time the firewall restarts.

    What about keeping the host entry up to date automatically? This is where Tasker comes in. Yes, Tasker. I made a no-ip.org client using Tasker. Each time my public IP changes, Tasker updates the host entry automatically.

    I've only had it running for a few days, but when I'm satisfied that it's working properly I'll post the details of the profiles and tasks.
     

Share This Page

Loading...