This is the second post in a series about injecting JSON based metadata into a live RTP streams using Wowza Media Server, Adobe Flex and OSMF.
What We’ve Built
So far in the previous post we got Wowza setup and created a module which will inject our JSON metadata into our live RTP stream.
What We’re Building (in this post)
In this short post we’ll be triggering the injection of metadata from the browser using a flash object created with Flex. Depending on your needs you may choose to call this method in some other way.
Developing in Flash Builder
The first thing you’ll need is Flash Builder, or in my case a 30 day trial of Flash Builder.
Once you have Flash Builder you’ll need to create a Flex Project for the web. At the time of writing this I was using Flex 4.5.1.
NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
NetConnection nc = new NetConnection();
nc.connect("your server name");
nc.call("wowza_module_method_name", null, "your movie name", JSONMetadata);
This code tells the net connection to use the object encoding of AS 1.0/2.0 which Wowza likes. Then it creates the connection to your server and passes the movie name as a method parameter so that Wowza knows what stream to inject the data into. The JSONMetadata parameter is an Flex Object that contains all the metadata to inject.