My first post here - so hi, I’m Philipp and I come from (-> username) Munich in Germany.
I setup Wowza on EC2 with the Dynamic Loadbalancing Module. This works just fine with any compatible flash player like JWPLayer. But I was not able to find a way on how to get loadbalancing to work with iOS clients.
So I went and wrote some php (my first .php script actually, so please enhance it as needed and let me know what you did):
<?php
// CONFIG START - Input in your Wowza Dynamic Loadbalancers address, your application's name and the streamname
$lburl = "http://url-or-ip-of-lb-instance:1935/loadbalancer";
$appname = "liveedge";
$streamname = "myStream";
// Config END
$content = file_get_contents ($lburl);
$replacewith = "";
$ip = str_replace('redirect=', $replacewith, $content);
header("Cache-Control: no-cache, must-revalidate");
header("Location:http://$ip/$appname/$streamname/playlist.m3u8");
?>
I guess it is pretty self-explanatory, it connects to the loadbalancer URL and gets the output (least loaded server). Then it removes the string “redirect=” and puts together a 302 redirect.
So if you open the .php file from your ios device it will work just fine.
To be on the safe side I would recommend to call the file playlist.m3u8 and add an Apache Directive to the server hosting the .php:
AddType application/x-httpd-php .m3u8
Of course you should only do this if you dont plan to deliver real .m3u8 files using the same apache VHost - I recommend using a dedicated VHost for this.
So when you configure your player to use:
http://apachehost-ios-lb.example.com/playlist.m3u8
it actually calls the .php script and gets redirected to:
http://least-used-server/appname/streamname/playlist.m3u8
Tested with iOS and Quicktime for Mac
I hope this is useful for some of you!