First, I know I am not the only person to utilize Multi-site WordPress and run into the issue of videos not streaming properly on iOS devices. I spent most of my time just trying to understand what the actual issue was — thinking it was an flash, permissions, file types, encoding issues, etc. Basically, I got run around in circles until I finally came to the conclusion the WordPress on Multi-site installations handled URLs strangely. What I mean is, WordPress does not allow the handling of bytes. In fact, here’s the exact problem;
“Serving video to iOS devices does not work in Multisite WordPress due to lack of byte-range support” Apparently iOS requires byte-range support for audio and video. Serving a static .mp4 file to an iOS from Apache works fine, but serving the same file from a WordPress MS 3.01 installation fails. This is because the file URL is rewritten to use ms-files.php. The PHP file does a readfile($file) on the file to serve it. This is incompatible with iOS devices and will fail.”
Essentially, if I were to use a direct link from Apache there would be no issues. However, that’s annoying, right? Constantly changing the URL to the direct link in blogs.dir/”blog”/files/”etc” when I should just be able to use a plugin like JWPlayer to insert it with a simple button. The problem here is that WordPress will attempt to deal with the URLs and create it’s own fun version and when it attempts to handle the request, an iOS device will go, “Give me the first 2 bytes!” to which WordPress will respond;
Annoying, right? Yes. Yes it is. Yes it is very annoying. What’s even more annoying is that I was unable to find an answer on wordpress.org or longtailvideo about the issue. I received significant help from wordpress.stackexchange.com though, which was nice. It at least got me thinking in the right direction. Also, while I did get mod xsendfile installed, I will openly admit that for some reason I did not include the alteration to the wp-content.php file and my boss pointed this out. So imagine how awesome it was to add the line in and watch streaming come alive! victory dance!
So, all that aside, you may be a person with the same issue thinking, “How on earth do I fix this? I want to stream video. What do I do?”
Extremely IMPORTANT Update (8-28-2012)
mod_xsendfile was updated in 0.10 to remove the “XSendFileAllowAbove” command and was replaced with the XSendFilePath command. As a result, the configuration file had to change from ‘XSendFileAllowAbove on’ to ‘XSendFilePath your/path/here (ex: /var/www/html/wordpress)’ . The conf file is also now xsendfile.conf instead of mod_xsendfile.conf.
So my files look a little something like this now;
Step 1: Download the apache module: mod_xsendfile.
yum install mod_xsendfile
Step 2: I also installed the httpd-devel package.
yum install httpd-devel
Step 3: Make sure in /etc/httpd/conf.d/wordpress.conf that the following lines are enabled;
Or (if it’s the 0.10 module, you’ll use the method I mentioned above, aka;
Step 4: Restart Apache
service httpd restart
Step 5: Go to /var/www/html/wordpress and update your wp-config.php file with the following;
That’s it. That got it working for us. What a trying issue indeed.