OSMF and Akamai Streams

For the last few hours I’ve been looking for info on how to do akamai streaming with the Adobe Open Source Media Framework. Mainly so we could take advantage of Akamai’s CDN streaming (rtmp).

Apparently, it’s easier than I thought it was going to be. Do the following and you’ll be set.

{syntaxhighlighter brush: jscript;fontsize: 100; first-line: 1; }var url:String = “rtmp://my.stream”; // or “http://my.video/123.mp4”;

var player:MediaPlayer = new MediaPlayer();
var sprite:MediaPlayerSprite = new MediaPlayerSprite(player);
var ve:VideoElement = new VideoElement(new StreamingURLResource(url));
// use URLResource(url) if it’s a non-stream
player.media = ve;{/syntaxhighlighter}

It’s that simple. Download the OSMF Source here (make sure you get the .swc out). Instructions for where it put the swc file are here.

Also, here’s an excellent resource I use in my stream development: http://support.akamai.com/flash/

 

UPDATE

I thought I was done with this, but I was wrong. I think I may have finally found the answer I’ve been looking for: Akamai’s Basic Streaming OSMF Plugin. You’ll find it in the OSMF Source in the folder libs:plugins:AkamaiBasicStreamingPlugin

Here’s the extra code I added to my “player”.

{syntaxhighlighter brush: jscript;fontsize: 100; first-line: 1; }import com.akamai.osmf.AkamaiBasicStreamingPluginInfo;
import org.osmf.events.MediaFactoryEvent;
import org.osmf.media.PluginInfoResource;

var mediaFactory:DefaultMediaFactory = new DefaultMediaFactory();
mediaFactory.addEventListener(MediaFactoryEvent.PLUGIN_LOAD, this.pluginLoadHandler);
mediaFactory.addEventListener(MediaFactoryEvent.PLUGIN_LOAD_ERROR, this.pluginLoadErrorHandler);
mediaFactory.loadPlugin(new PluginInfoResource(new AkamaiBasicStreamingPluginInfo()));

function pluginLoadHandler(event:MediaFactoryEvent):void {
this.removeEventListener(MediaFactoryEvent.PLUGIN_LOAD, this.pluginLoadHandler);
this.removeEventListener(MediaFactoryEvent.PLUGIN_LOAD_ERROR, this.pluginLoadErrorHandler);
trace(“pluginLoadHandler”);
}
function pluginLoadErrorHandler(event:MediaFactoryEvent):void {
throw new Error(“DisplayPortal->pluginLoadErrorHandler”);
}{/syntaxhighlighter}

That’s it for now.

Leave a comment

Your email address will not be published. Required fields are marked *