Multi-tenant Virtual Hosting with Wowza on EC2

That’s a mouthful, isn’t it?

I recently needed to migrate a couple of Wowza Streaming Engine tenants on a baremetal server that was getting long in the tooth, and was getting rather expensive. These tenants were low-volume DVR or HTTP transmuxing customers, with one transcoding customer that required some more CPU power. But this box was idle most of the time. So I decided to move it over to AWS and fire up the box only when necessary. Doing this used to be a cumbersome process with the AWS command-line tools that were Java-based. The current incarnation of tools is quite intuitive and runs in Python, so there’s not a lot of insane configuration and scripting to do.

You may recall my post from a few years back about multi-tenant virtual hosting. I’m going to expand on this and describe how to do it within the Amazon EC2 environment, which has historically limited you to  a single IP address on a system.

The first step to getting multiple network interfaces on EC2 is to create a Virtual Private Cloud (VPC) and start your EC2 instances within your VPC. “Classic” EC2 does not support multiple network interfaces.

Once you’ve started your Wowza instance within your VPC (for purposes of transcoding a single stream, I’m using a c4.2xlarge instance), you then go to the EC2 console, and on the left-hand toolbar, under “network and security” is a link labeled “Network Interfaces”. When you click on that, you have a page listing all your active interfaces.

To add an interface to an instance, simply create a network interface, select the VPC subnet it’s on, and optionally set its IP (the VPC subnet is all yours, in dedicated RFC1918 space, so you can select your IP). Once it’s created, you can then assign that interface to any running instance. It shows up immediately within the instance without needing to reboot.

Since this interface is within the VPC, it doesn’t get an external IP address by default, so you’ll want to assign an ElasticIP to it if you wish to have it available externally (in most cases, that’s the whole point of this exercise)

Once you have the new interface assigned, simply configure the VHosts.xml and associated VHost.xml files to listen to those specific internal IP addresses, and you’re in business.
As for scheduling the instance? On another machine that IS running 24/7 (if you want to stick to the AWS universe, you can do this in a free tier micro instance), set up the AWS command line tools and then make a crontab entry like this:

30 12 * * 1-5 aws ec2 start-instances --instance-ids i-XXXXXXXX
35 12 * * 1-5 aws ec2 associate-address --network-interface-id eni-XXXXXXXX --allocation-id eipalloc-XXXXXXXX
35 12 * * 1-5 aws ec2 associate-address --network-interface-id eni-XXXXXXXX --allocation-id eipalloc-XXXXXXXX
30 15 * * 1-5 aws ec2 stop-instances --instance-ids i-XXXXXXXX 

This fires up the instance at 12:30pm on weekdays, assigns the elastic IPs to the interfaces, and then shuts it all down 3 hours later (because this is an EBS-backed instance in a VPC, stopping the instance doesn’t nuke it like terminating does, so any configuration you make on the system is persistent)

Another way you can use this is to put multiple interfaces on an instance with high networking performance and gain the additional bandwidth of the multiple interfaces (due to Java limitations, there’s no point in going past 4 interfaces in this use case), and then put the IP addresses in either a round-robin DNS or a load balancer, and simply have Wowza bind to all IPs (which it does by default).

Haiti Internet

Mobile Internet In Haiti, Part 2

A while back, I posted about getting mobile Internet in Haiti. As technology changes rapidly, especially when it comes to Haitian internet access, I figured I’d post an update, having just returned from there in late February.

If you have a GSM-capable US phone (most Samsung Galaxy devices use software-defined radios and can speak CDMA or GSM fluently, simply by switching an option in the software), you’ll need to unlock it for international use:

Sprint: Contact Sprint Customer Service while still in the US and ask them for an international unlock. As long as your account has been active for more than 60 days, this should be no problem. They’ll walk you through the UICC unlock process. It helps to be on the Sprint network while this unlock happens, but it can also happen over Wi-Fi if you’re already out of the country.

Verizon: Verizon generally does not lock their phones. You may want to check with Verizon to make sure yours is unlocked. See item #18 in their Global Roaming FAQ.

AT&T: If your phone is under contract with AT&T or is an iPhone, you’re pretty much out of luck. AT&T is so terrified of losing their customers that they will only unlock the phone if you buy out your installment contract or pay an ETF. The good news is that most cell phone repair shops know the unlock codes and will unlock them for you for a small fee. (This is a tip I got from the manager of a local AT&T store who thinks corporate policy on unlocking for international use is dumb). If your phone is out of contract, simply go to https://www.att.com/deviceunlock and fill out the form. There is nobody at AT&T you can talk to about this, nor can the store personnel help you. If the process fails, then you’re simply out of luck, and should consider choosing a more customer-friendly carrier next time.

T-Mobile: No idea. I don’t know anyone who has a T-Mobile device. I expect their policy is probably very similar to AT&T.

Once you get to Haiti, you can stop at either the Digicel or Natcom shops just outside customs at the airport in Port-Au-Prince. (I would expect that there’s a similar setup at Cap-Haitien.) Natcom will load you up with 5GB of data and some voice minutes for 1000 Gdes ($25 US). I don’t know what Digicel’s current pricing is, but I expect it’s comparable. If you’re going to be out in the provinces, Natcom seems to have a better network than Digicel. If you’re staying in and around Port-Au-Prince, either network should work fine for you as both carriers have HSPA+ networks. I don’t know what the Natcom coverage situation is like on La Gonâve, but Digicel has EDGE coverage on most of the island, and HSPA/+ around Anse-a-Galets.

The staff at the Natcom shop had no trouble setting up my Galaxy S4, and in 15 minutes I walked out of there on the Haitian network. Using it as a hotspot was merely a matter of turning it on, and didn’t require any further configuration. Internet speeds in PAP average in the 2-3Mbps range.

It should be noted here that with both carriers, all Facebook traffic is free and doesn’t count toward your data plan usage. This is a pretty cool deal. My understanding is that Facebook located an edge node within Haiti to reduce transit off-island, and free access to the growing smartphone population in Haiti was part of the deal.

On a similar vein, Google also seems to be getting better presence in Haiti, and I’m told they too have edge nodes located in-country. Their maps product actually has pretty good data in PAP, although directions are still iffy as the addressing system there is a little tricky, and there aren’t necessarily names attached to many of the minor streets. It’s pretty good at figuring out where you are though. I wonder how soon they’ll get a Street View rig down there.

When you leave, your SIM will still be usable for 90 days, after which it will expire and no longer function on the network. There is currently excellent public wifi at the PAP airport, so handing your SIM off to one of your Haitian hosts is probably your best bet, as they can get some additional usage out of whatever unused data/minutes are left on it.

(I also discovered that on my Galaxy S4, GPS didn’t work unless there was a SIM in the slot)

 

Streaming on the go

Over the past several months/years, I’ve been accumulating various pieces of gear that, when put together, give me a solid kit to take on the road for doing onsite streaming or demonstration events. It currently consists of:

I still probably should add an SDI Distribution Amp to the kit, but I haven’t had need for it… yet.

The Canon and GoPro each have their own Pelican 1200 cases, and don’t travel with me unless I need to provide cameras (usually I’m getting a feed from video world and streaming it from there). The SD cards travel in a Pelican 0915 case, which is along with the rest of the gear in a Pelican 1510.

I love the Pelican 1510 – It’s legal carry-on size, so when traveling, all that expensive gear is never out of reach, never at the whims of a sticky-fingered TSA agent or baggage handler inside the bowels of the luggage system where nobody can see them. When flying, I’ll take the Pelican and my laptop bag with me, my clothes go as checked luggage (yay for airlines that give me free checked bags!). I modified the 1510 to include a mesh organizer in the lid instead of the egg-crate foam that it normally comes with, which lets me keep track of the various small bits that go with all that gear.

(because the foam inserts are removable, the 1510 along with a borrowed 1610 came in very handy this past summer when I was on vacation and traveling on a float plane – in case my luggage got dunked in the drink, the cases would float and my clothes would stay nice and dry. Pelican also makes a luggage version of the 1510. I love Pelican cases.)

Lots of Wall WartsHere’s the problem with all that gear though: Except for 1 or 2 devices, every single one of them requires a “wall wart” power adapter. There’s no room in that case for the several power strips that I’d need to do this in a self-contained manner, where all I need from the venue is an outlet and (optionally) an ethernet drop. Additionally, all those adapters in the lid make for a huge jumbled mess on the TSA’s x-ray machines, so more often than not, they want to take a look inside, and swab it for residues. I got to looking at the gear and realized that every single piece of it that used external power would accept a 12VDC input, and they all even shared the same polarity.

[table id=2 /]

Another thing I discovered along the way is that manufacturers rarely specify the details of the DC connector beyond the voltage and only occasionally the current draw. Trying to get connector information from vendor specs is a pain in the rear. This sucks if you have to order a replacement power supply because yours broke or got lost. With the help of a pair of calipers and some trial and error, I was able to figure out what each one was.

I started hunting around for 2 items: A distribution bus, and a compact 6A (or bigger) DC power supply.

The DC bus proved to be problematic, until I hit upon the right combination of keywords that revealed what I needed on Amazon: an 8-way fanout meant for use on security cameras, which had the 5.5×2.1mm connector that I’m discovering is nearly ubiquitous. Bonus: I didn’t have to make my own splitter.

On the power supply front, I found several meant for A/V use, but all of them were large and not well suited to portability. I found my solution on eBay: There is an endless variety of  OEM laptop power supplies that put out 12V and 6A. Many of them are sold as an “LED Power Supply”, and run about 10-15 bucks. I found one that had the same 5.5×2.1mm connector that all my gear needed. Due to difficulties in getting the calipers down inside the connectors, I initially thought the BMD converters were 5.5×2.1mm, but they’re 5.5×2.5mm, and the center pin is too fat – but 5.5×2.5mm female connectors will also accommodate the smaller 2.1mm pins just fine. I should have ordered a 5.5×2.5mm fanout instead. Lesson learned. In order to adapt the 5.5×2.1mm splitter to the various devices, I dug around amazon to find the various adapters I’d need. The only problem is the Lemo connector used by the Teradek Cube: Those locking connectors are $100 each. Ouch.

By a happy coincidence, my wife has a battery booster pack in her van that is float-charged by a 12V connection, which also happens to be 5.5mmx2.1mm. I recently had to order a replacement CLA adapter for it, and picked up an extra one, which would allow me to run this whole streaming rig from automotive, solar or battery power if needed. The whole setup draws about 70W at full load if all of it is running.

I also ordered (but haven’t yet received) a female 5.5×2.1mm to CLA socket, so that I can pop in a CLA USB charger to power my iPad, charge the GoPro, and other USB devices so I don’t eat up a port on the computer just for power, as I’ve only got two.

(As a side note, Ruckus/XClaim and AirTight access points also use 12V 5.5×2.5mm connectors as an alternative to PoE, but if I need wifi the AeroHive unit will do the job. Aruba APs use a smaller connector, whose dimensions I am presently unsure of)

Now my whole rig can be run off two AC outlets (plus a third until I can somehow find a cheaper Lemo connector!). I think the next step is to find some sort of way of putting a battery inline, effectively giving me a UPS for the whole stack (although the laptop , iPad, and the Teradek units all have internal batteries as well) Edit : I since acquired an Anker Astro Pro2 External Battery which has not only the ever-convenient 5.5×2.1mm 12V input socket, but also a DC output (which includes an adapter that goes from the battery pack to a 5.5×2.1mm output plug) that effectively turns this into a 12V UPS which can deliver up to 22W on the USB ports and 18W on the DC port (which is selectable between 9V and 12V), meaning a 10 hour runtime at full load. The unit is only slightly bigger than a small tablet. I can’t run ALL the gear on it at once, but I can at least put the really critical stuff on it. The 1st-generation model of that charger has a beefier 48W DC output that can go to 16V and 19V to power laptops.

The completed kit, with much fewer wall warts!

The completed kit, with much fewer wall warts!

Here’s the DC parts list, with links to Amazon:



Instant Replays on Wowza

One of the useful features of Wowza is its ability to record a stream to disk and then be able to use that recording for a replay. In version 3.5, it would simply take the stream name, slap an MP4 extension on the end, and version any previous ones with _0, _1, etc. In 3.6, the default naming scheme for these recordings was a timestamp, with a configuration option to use the legacy naming convention. In Version 4, it appears this legacy naming convention option has disappeared altogether, meaning you can’t set up a player to just play back “streamname.mp4” and it would always grab the most recent one. EDIT: It appears that this loss of functionality was unintentional and has been classified as a bug, which should be fixed very soon.

This became a problem for one of my clients after their Wowza server got updated to V4. It wasn’t practical to re-code the player every week, or to go into the server and manually rename the file. Since it’s on a Windows server, PowerShell to the rescue:

$basepath= "C:\Program Files (x86)\Wowza Media Systems\Wowza Streaming Engine 4.0.3\content\"
$replayfile =  gci $basepath\streamname*.mp4 | sort LastWriteTime | select -last 1
$link = $replayfile.Name

cmd /c del $basepath\replay.mp4
cmd /c mklink $basepath\replay.mp4 $basepath\$link

I then put this into a scheduled task, with time-based triggers. Powershell is a little tricky to get into a scheduled task, but I finally got the syntax right:

Action: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Arguments: -nologo -file “C:\Program Files (x86)\Wowza Media Systems\Wowza Streaming Engine 4.0.3\content\replay.ps1”

If you’re on Linux or OSX, you can do this in bash instead:

#!/bin/bash

basepath='/usr/local/WowzaStreamingEngine/content'
unset -v replayfile
for file in "$basepath"/streamname*.mp4
 do
  [[ -z $replayfile || $file -nt $replayfile ]] && replayfile=$file
 done;
rm -f $basepath/replay.mp4
ln -s $replayfile $basepath/replay.mp4

and put it in your crontab (this example is every sunday at 11:30am)

30 11 * * 0 /bin/bash /usr/local/WowzaMediaServer/content/replay.sh

In the wild: EGO cordless electric mower

It’s a clean, green, mowing machine!

mower_largeI’m going to veer off my usual topics here to give you my thoughts on a recently acquired tech toy of a different flavor: My lawnmower. This is NOT a sponsored post.

When we moved into our previous house almost 11 years ago, we went on a coupon-fueled shopping spree at Home Depot, and picked up your standard 4-stroke gas-powered mower. It worked well, but after a while, the tedium of dealing with oil and gas and all those moving parts makes you think “there’s got to be a better way”. We’d been eyeing electric mowers for a while, but either they were corded (obnoxious – chance of mowing the cord is high!), or had enough battery life to make you need a wagon full of spare batteries, and in neither case did they have enough oomph to cut grass that had gone more than about 12 hours since the last mowing.

When the Toro died this spring (I think it busted a rod, or something else pretty major in the engine), I started looking at battery-powered options again. At our new place, the lot is nearly half an acre. Anyone in their right mind would have bought a small riding mower. Consumer Reports narrowed me down to two options: The Black & Decker CM1936, with a 19″ deck and self-propelled version for $439 at Amazon (now $379), or the EGO LM2001, with a 20″ deck for $499 at Home Depot. I was initially leaning toward the B&D’s lower price, but was eventually won over by the EGO’s slightly wider cutting deck, its 5-year warranty, and the 30-minute charger (which would have been another $130 for the B&D). That the EGO is 50 pounds lighter was a big plus as well.

Since Home Depot had it in stock, I headed over there and picked it up. It comes in a large cardboard box that easily fit in the back seat of my full-size Toyota. Because the mower handle folds down and collapses, there was no assembly to speak of. It’s pretty much a matter of taking it out of the box, removing the requisite bits of tape and protective film, and a few plastic bags, and putting the box on the curb for the recyclers to pick up. Virtually all of the packaging is recyclable, which is a plus.

EGO Battery Pack

This is alien technology. Or at least from the future.

The battery pack and the charger look like something right out of a sci-fi movie. The battery is the heart of the system, and battery technology has made significant progress in the last few years. Power tool manufacturers love to tout the voltage of their battery system, under the idea that “More Volts = Better”. Being a geek with a background in electronics, I know that this is mostly bunk, but when it comes to battery systems, there’s some validity to it, because virtually all power tool batteries consist of a serial/parallel array of 1.2V rechargeable cells. More cells = more oomph. EGO says the motor in this mower is 600 watts, which works out to a little over 10 amps. The battery pack is 4Ah, so at full load, one should expect about 25 minutes of use. Since in the real world, the motor isn’t under full load the whole time, it gets pretty close to EGO’s claimed run time of about 45 minutes. I’ve found that this isn’t enough to do my whole yard, but after the battery runs out, I’m usually ready to go sit inside for half an hour, and cool off with a cold beverage and some air conditioning, while the battery charges back up (and yes, it DOES only take half an hour!).

Performance-wise, it does OK with normal mowing, but heavy grass is something best approached in phases at different cutting heights (which are adjustable to 5 levels with a single lever somewhat reminiscent of the shifter in my minivan). On my gas mower, I’d usually deal with heavy grass by putting the discharge chute on and letting it eject the cuttings rather than mulch them. On the EGO mower, this plan is no good. While it comes with a discharge chute that attaches in the same place as the bag, it clogs easily, and is generally useless. Bagging works pretty well, though.

So easy a kid can mow!

Where this mower really shines is how easy it is to use. Much of the body is molded polypropylene, so at 40-odd pounds, it weighs about half what my old gas mower did (the B&D unit is actually 15 pounds HEAVIER than my Toro), and is so quiet that it won’t bother the neighbors. When sitting inside while someone is mowing, it sounds like a gas mower several blocks away. A typical gas mower is usually over 90dB, where permissible exposure levels are not much more than an hour. I don’t know offhand what this unit is, but it’s a LOT quieter. There’s no fuel to mess with, or oil changes, or any of that. When you’re done, it folds up neatly and can be stood on end, taking up no more than 2 square feet of your garage. Between the light weight, the quiet, and the lack of fumes, my 10-year-old daughter is actually willing to mow the lawn. (Another major motivating factor is that mowing the grass pays for her cell phone service).

Other than keeping it clean, there’s really no long-term maintenance to worry about. It comes with a 5-year warranty, although the blade isn’t covered, as it’s considered a wear part. There are no moving parts other than the motor itself (compare to a 4-stroke gasoline engine, which even with a single cylinder is a very complex piece of machinery).

As for energy consumption, a full charge is 224 watts of electricity. A full charge will run you somewhere between 2 and 4 cents worth of electricity, depending on where you live. The EPA defines a gallon of gasoline as equivalent to about 33.4kW of electrical energy. My old Toro would go through about a quart of gas to mow the yard. At nearly 4 bucks a gallon for the non-ethanol stuff that won’t wreck the engine, that’s a buck a mow. With 2 charges, that’s also about 20x the amount of energy that the EGO uses to achieve the same job. Oddly enough, the “fuel” cost of the electric mower is also about 1/20 that of the gasoline.

EGO in storage mode

If carbon footprint is something you care about, 1 full mow is about half a pound of CO2 if your electricity is from natural gas, and about a full pound if it’s from coal. Zero if it’s from nuclear, solar, or wind. The gasoline mower belches out about 4.5 pounds per mow, along with a whole bunch of other nasty stuff that your car has the decency to clean up first.

As for quirks, there are a couple. The handle has a couple of different safety interlocks, and must be fully extended and locked for the mower to operate. There’s a dead-man switch on the push bar, much like virtually any other mower. There’s also a removable safety key that must be pushed in to start the mower. I’ve found that when mowing close to bushes that the slide lock tends to come undone, allowing the handle to slide in just enough to cut the mower out. The first few times, you find yourself standing there wondering why the mower won’t work, until you notice the bright green latch on the handle hanging open.

When going through heavy grass, if the current draw on the motor becomes too much, the green power light will start flashing yellow. If you don’t ease up on it, it will stop the mower. Once the battery gets low, the indicator light will turn red, at which point you’ve got about 3-5 minutes until break time. The battery is really good at delivering a fairly flat and constant amount of power, so there’s not really much decline in power until the battery decides to go completely dead.

EGO also has a blower, edger, and hedge trimmer that work with the same battery (they also make a smaller and lighter 2Ah battery for those devices, but all batteries in the EGO tool family are interchangeable, so if you find yourself about 10 minutes short on the mower, get the trimmer or blower with its battery, run the mower on the small battery for 20 minutes, and then switch to the big battery to finish the lawn while you recharge the small battery, which will be ready for trimming or blowing by the time you get done mowing. If you already have batteries and chargers, you can order just the tools without batteries directly from EGO for less money. Similarly, you can order extra batteries from them (the big one is $199, the little one is $129).

Bottom line, It may be a spendy piece of equipment, but not having to deal with gasoline, fumes, noise, maintenance, and being able to send the kid out to mow instead of doing it myself is well worth the price of admission. Oh, and it also has an LED headlight, for those midnight mowing escapades.

X-Plane in its full 39" 4K Glory

My God, It’s Full Of Pixels!

One of my desktop monitors gave it up last week, the backlight started flickering and randomly disconnecting from my Mac (which causes all attached displays to go dark for a second while it recomputes your workspace). Needless to say, it was sapping productivity even worse than Facebook. I’ve been eyeing 4K monitors for a while now, and both Dell and Lenovo have some decent low-cost options in 28″ sizes ($700ish), but that was still more than I was willing to cough up for a new monitor right now, even with the Lenovo dealer demo discount.

Then came last weekend, where TigerDirect ran a $70 rebate on a Seiki SE39UY04 39″ (yes, you read that right, thirty-nine inches) 4K TV with a whole mess of inputs (3 HDMI, 1 VGA, 1 Component, as well as a tuner). Base price before rebate: $400. Four hundred bucks. BEFORE the rebate. For 4K. That brings it down into the realm of even inexpensive 27″ monitors. Some googling found that the tech press actually has good things to say about this “off-brand” display (with the caveat that there are very few graphics chips currently out there that can drive this resolution, and that HDMI 1.4 is limited to 30Hz refresh at 4K). Since the rebate was a very limited-time offer, I jumped on it, figuring I was gonna have spend that much on a monitor anyway. For those who missed last weekend’s rebate from TD, It’s currently available on Amazon (with Prime!) for $299 (plus larger sizes too!).

Three days later, UPS shows up bearing goodies, and I hooked it up this morning. The unit is generally well built, comes with a solid but unobtrusive pedestal, and the bezel is not huge. It even comes with a decent HDMI cable. There’s been a lot of discussion online as to whether the first-generation Retina MacBook Pro can drive this monster at native resolutions at all. Let me put those to rest: it can, with Mavericks 10.9.3, at 30Hz. Because of the refresh rate, it’s not a great rig for gaming (but it’s still beautiful with X-Plane!!!), but it’s great for sheer pixel space to put my calendar, e-mail, a couple of network monitoring screens, multiple RDP sessions, and lots of other things that don’t require high refresh rates. Colors are quite good, as is brightness, and the built-in speakers are surprisingly loud (almost too loud to use with my computer even at the lowest volume setting) If you press “Menu” on the remote, followed by “0 0 0 0”, you can get into the factory menu which allows you to tweak the color temperature, and the “Warm” setting is shockingly close to my MacBook. The factory menu also lets you dial down the backlight (which I did – even so, this TV is already near the bottom of its category when it comes to energy consumption). I also dialed the default sharpness setting down to 0, as, like most TVs, the edge enhancement algorithms designed for making TV pictures look better really butcher computer signals.

Tweetdeck is 1440x900, RDP window is 1920x1080.  No scaling. Just pixels.

Tweetdeck is 1440×900, RDP window is 1920×1080. No scaling. Just pixels.

Did I mention that 4K is an awful lot of pixels? It is a LOT of pixels. 8,294,400 of them . Holy cow. I’m a lifelong pixel junkie, and I’m loving this. The 39″ display is big enough to use on your desktop at native resolution at a comfortable distance of about 4′ (rather than driving it at a pixel-doubled 1920×1080 workspace). Drawing network maps in Visio and Ekahau at 4K resolution is something out of a dream.

Visio at 3840x2160.

Visio at 3840×2160.

Ekahau Site Survey

Ekahau Site Survey

My biggest problem? Losing my mouse cursor. Gotta use a solid color background. That’s OK, my GPU is probably just as glad it doesn’t have to deal with an 8MP image.

X-Plane in its full 39" 4K Glory

X-Plane in its full 39″ 4K Glory

Bottom line, for under $400, this is a surprisingly good piece of hardware. Seiki may be considered an “off-brand” label, but don’t forget that Vizio was in the same position when they started selling good HD televisions for dirt cheap. The only real downside I see right now is using a VGA port that is limited to 1920×1080 instead of putting a DisplayPort interface there instead. OK, Roku, When can I expect a 4K version of your box so I can watch Breaking Bad and House of Cards in their full 4K glory? Et tu, Chromecast?

This video looks utterly spectacular on this screen (Downloaded with YTD and played with QuickTime)

Browser-Aware Player Code, 2014 Edition

Yet another installment in the never-ending series of dealing with different platforms. This is precipitated by the continued boneheadedness of Google when it comes to supporting any live streaming transports in the native browser (they just simply don’t). Some handset manufacturers are adding HLS support back, though.

You’ll notice there’s also code in here to reference an MPEG-DASH manifest as well as “sanjose” and “smooth” (in Wowza parlance). This script doesn’t make use of those capabilities at the moment, but once I get a good list of which browsers can support MSE and DASH.js, I’ll update it to be able to use that player.

This assumes that you’re using cloud-hosted JW Player with a key, but if you’re not, simply replace the first SCRIPT reference with your locally hosted JWPlayer file and comment out the jwplayer.key line.

If you wish to use a different player such as FlowPlayer, you can replace the appropriate code in the flashPlayer() function.


<HTML>
<HEAD>
<TITLE>Player</TITLE>


<script type="text/javascript" src="http://p.jwpcdn.com/6/8/jwplayer.js?ver=3.9"></script>
<script type="text/javascript">

jwplayer.key='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';

jwplayer.defaults = { "ph": 2 };

</script>


</HEAD>
<BODY STYLE="margin: 0px; background-color: white">
<div id="videoframe"></div>

<SCRIPT type="text/javascript">
// Browser-aware video player for JW Player and Wowza
// V0.3 - May 19, 2014
// (c)2014 Ian Beyer
// Released under the GPL

var container='videoframe';
var width="100%";
var aspect="4:3";



//This section calculates actual sizes for player when using non-responsive elements.

var multiplier=aspect.split(":");
var fixedwidth = Math.floor(window.innerWidth*width.split("%")[0]/100);
var fixedheight = Math.floor(window.innerWidth*multiplier[1]/multiplier[0]*width.split("%")[0]/100);
console.log ('Size: '+width+', '+aspect+' ('+fixedwidth+' x '+fixedheight+')');

var streamserver='wowzanode1.tvwmedia.net';
var streamport='1935';
var streamapp='srcEncoders';
var streamname='TVW01';

var streambase=streamserver+':'+streamport+'/'+streamapp+'/_definst_/'+streamname;
var cupertinourl='http://'+streambase+'/playlist.m3u8';
var sanjoseurl='http://'+streambase+'/Manifest.f4m';
var smoothurl='http://'+streambase+'/Manifest';
var dashurl='http://'+streambase+'/manifest.mpd';
var rtmpurl='rtmp://'+streambase;
var rtspurl='rtsp://'+streambase;

var agent=navigator.userAgent.toLowerCase();
var is_iphone = (agent.indexOf('iphone')!=-1);
var is_ipad = (agent.indexOf('ipad')!=-1);
var is_ipod = (agent.indexOf('ipod')!=-1);
var is_safari = (agent.indexOf('safari')!=-1);
var is_iemobile = (agent.indexOf('iemobile')!=-1);
var is_blackberry = (agent.indexOf('blackberry')!=-1);
var is_android1= (agent.indexOf('android\ 1')!=-1);
var is_android2= (agent.indexOf('android\ 2')!=-1);
var is_android3= (agent.indexOf('android\ 3')!=-1);
var is_android4 = (agent.indexOf('android\ 4')!=-1);

var is_chrome = (agent.indexOf('chrome')!=-1);

if (is_iphone) { iosPlayer(); }
else if (is_ipad) { iosPlayer(); }
else if (is_ipod) { iosPlayer(); }
else if (is_android1) { rtspPlayer(); }
else if (is_android2) { rtspPlayer(); }
else if (is_android4) { a4Player(); }
else if (is_blackberry) { rtspPlayer(); }
else if (is_iemobile) { rtspPlayer(); }
else { flashPlayer(); }

function iosPlayer()
{
var player=document.getElementById(container)
player.innerHTML='<VIDEO '+
' SRC="'+cupertinourl+'"'+
' HEIGHT="'+fixedheight+'"'+
' WIDTH="'+fixedwidth+'"'+
' poster="poster.png"'+
' title="Live Stream"'+
' CONTROLS>'+
'</video>';
}

function windowsPlayer()

{

// Need to add code here for silverlight player in Windows Phone to support the 12 users that actually have one. Until then use rtspPlayer();

}

function a4Player()
{
var player=document.getElementById(container)
player.innerHTML='<A HREF="'+cupertinourl+'">'+
'<IMG SRC="player.png" '+
'ALT="Start Mobile Video" '+
'BORDER="1" '+
'WIDTH="'+width+'">'+
'</A>';
}

function dashPlayer()

{

// Reserved for future use

}

function rtspPlayer()
{
var player=document.getElementById(container)
player.innerHTML='<A HREF="'+rtspurl+'">'+
'<IMG SRC="player.png" '+
'ALT="Start Mobile Video" '+
'BORDER="0" '+
'WIDTH="'+width+'">'+
'</A>';
}

function flashPlayer()
{


//If using JW6 Premium or Enterprise, you can also use the cupertinourl here.

jwplayer(container).setup({
 width: width,
 aspectratio: aspect,
 file: rtmpurl,
 autostart: false
 });


}

</SCRIPT>
</BODY>
</HTML>

Multi-Tenant/IP Hosting for Wowza Streaming Engine

For most users, running Wowza Media Server/Wowza Streaming Engine (which I’ll refer to as just “Wowza”) are perfectly content running it out of the box as is on a dedicated server. Where it gets a little more interesting is when you have to co-exist with other server applications that want some of the same ports (I’m lookin’ at YOU, web servers!).

By default, Wowza binds itself to all available IP addresses on ports 1935 (RTMP, but will also take HTTP requests on that port), 8086 (for some basic management functions), 8083 and 8084 (for JMX), and with WSE4, 8087 (REST) and 8088 (WSE Manager). It won’t bind itself to port 80 specifically because of the common problem of co-existing with web servers. If you have Wowza enabled for IPv6, it will also bind to all available IPv6 addresses on the same ports.

This technique is also good for reducing surface area, where you can have remote management such as SSH or RDP listening on one address, and someone scanning your streaming server IP won’t find any open management ports to attempt to exploit.

Read more

Mobile Voice in Haiti

As a follow-on to my previous post about getting mobile internet, here’s one about getting voice service on your US phone (at least if you have a Sprint phone).

I have a Samsung Galaxy S4 on Sprint. Sprint’s CDMA voice network is incompatible with the GSM networks in most of the rest of the world, but recent Samsung Galaxy devices (at least the S3 and S4, and other devices of the same generation/platform) use a software-defined radio that can be made to speak GSM or CDMA at will, with a simple settings change. CDMA doesn’t require a SIM but LTE and GSM do, so the Galaxy is a de facto international phone.

Sprint lets you do international roaming calls for $2/min, which is absurdly high. It’s much better to get a SIM from a local carrier and use that. Making it do this is relatively simple. If your account is in good standing, a simple phone call to Sprint will unlock your phone for using other SIMs (and before you try to do this for a GSM carrier in the US, it explicitly does NOT work on AT&T or T-Mobile). This unlock process does require a data connection (mobile or Wi-Fi) for the phone to receive the unlock signal. After doing that, there’s a simple process that the Sprint rep will give you over the phone to complete the process.

Once that’s done (took me about 5 minutes on the phone – which I did via Skype from Haiti!), all you have to do is go find a local SIM (and in the case of the Galaxy, trim it down to size), pop it in the phone, switch it over to GSM in the Mobile Networks settings, pick your carrier, and off you go.

I’ll add screenshots just as soon as I can make the phone do them. The normal S4 tricks aren’t working.