How-To: Stream videos to iOS devices with Multisite WordPress

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;

 

HERPA DA DERPA?

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;

xsendfile.conf

wordpress.conf

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;

XSendFile on

XSendFileAllowAbove on

Or (if it’s the 0.10 module, you’ll use the method I mentioned above, aka;

XSendFilePath /var/www/html/wordpress

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;

wp-config.php:define('WPMU_SENDFILE', true);

That’s it. That got it working for us. What a trying issue indeed.

Tagged with: , , , , , , ,
Posted in Apache, Featured, How-To's, Technology, Wordpress
3 comments on “How-To: Stream videos to iOS devices with Multisite WordPress
  1. Toni Soto says:

    Thanks for sharing! Let me ask you a question about WP Multisite : I’ve you set up WP Multisite as blog plataform for users coming from another application? If so, how do they login into WP Multisite? SSO, LTI perhaps? Is it the same WP Multisite and Multiuser (some posts out there talk about ‘multiuse’)? From where could I download WP Multisite? Too many questions isn’t it? Anyway, thanks in advance for all.

    • Courtney says:

      If you want to learn how to enable Multisite, please refer to here: http://codex.wordpress.org/Create_A_Network
      As for logging in — it depends on how you have set authentication up. I mean, one of the common ways is to have the Active Directory (or OpenLDAP) plugin and then allow users from your domain to login to wordpress with that account. It will auto add the accounts.

  2. Doug says:

    Any ideas on how to fix this problem on windows based servers?

1 Pings/Trackbacks for "How-To: Stream videos to iOS devices with Multisite WordPress"

Leave a Reply

Banner O’ Ads

Enter your email address to subscribe to this blog and receive notifications of new posts by email. I wont spam you, I promise.

Join 8 other subscribers

%d bloggers like this: