Search code examples
htmlapachemedia-playerm4amkv

HTML5 browser local vs internet differences handling MKV and M4A media files


re: http://www.gooplusplus.com/minmedia/demo/minmedia.php

I am working on what may eventually become a Minimalist Media Server for Local Area Networks, with option to launch files to Chromecast. It was prompted by a discovery that there are no UPnP/DLNA client Chrome apps or easy media access methods for Chromebooks.

While Plex works on Chromebooks, Chromecast redirection only works through a Plex web link. In any case, most media servers seem like a lot of unnecessary overhead and periodic disk thrashing when all that is wanted is a simple and direct way to play via wifi from a few terabytes of LAN-hosted media files. IMO, thumbnails and category features, etc. just get in the way of the actual viewing or listening.

Enough soapbox, now to the MKV and M4A file anomaly: when I click on a link to an MKV demo video file from my web host (Hostgator), the browser (both Chrome and Firefox) starts downloading instead of playing the MKV file. When I click the link to the same file locally (Civet Web Server, an open-source fork of Mongoose), the MKV file plays normally in an HTML5 browser window.

The opposite occurs with M4A music files. A click on a Hostgator-hosted M4A file link plays in the browser's HTML5 web player. A click on the file hosted locally prompts downloading instead of playing.

So, can some expert out there tell me why links to these two types of media files behave differently locally vs on the internet? Is it a function of the (1) host [Hostgator] or (2) the web server (Apache vs Civet Web)? Is there some mime type, etc. configuration file for Apache or elsewhere that might force how MKV files are handled by my host?

MinMedia Local Area Network (Win7) MKV links


Solution

  • Reference: http://www.homenetvideo.com/demo/index.php?/Test%20Formats

    How an HTML5 browser like Google Chrome handles MKV, M4V, MOV, M4A, M4B seems to be dependent on the web server's config file.

    Here's what I added to my Hostgator homenetvideo.com .htaccess file:

    RemoveType .webm
    RemoveType .mpeg
    AddType video/webm .webm .mov .m4v .mkv
    AddType audio/mpeg .m4b
    

    Here's what I added to my LAN web server civetweb.conf file:

    extra_mime_types .m4v=video/mp4,.mov=video/webm,.m4a=audio/mpeg,.m4b=audio/mpeg
    

    These formats on both local network and external servers now play from the browser HTML5 player:

    VIDEO: MP4 WEBM OGV + .mkv .mov .m4v
    AUDIO: MP3 OGG WAV + .m4a .m4b
    

    ...

    Homenet Local Media Server - Test Format

    Homenet - MKV file playing in browser HTML5 player