Getting Started OSMF (Part 2)

Open Source Media Framework

In Part 1 we briefly looked at some documentation and references for quickly getting up to speed on OSMF.  Now in Part 2 I want to touch on some different options the developer has regarding what classes to use to actually build their OSMF video player.  The main difference in the various options has to do with choosing ease of coding and simplicity versus flexibility / player capabilities.  One option is to use the VideoElement class.  Video element makes it simple to connect to a video stream and instantiate a player:

var mediaPlayerSprite:MediaPlayerSprite = new MediaPlayerSprite();
var videoElement:VideoElement = new VideoElement();
var dynResource:DynamicStreamingResource = new DynamicStreamingResource("rtmp://");

dynResource.streamItems = Vector.<DynamicStreamingItem>([]); //code shortened here; see the documentation for the full example

videoElement.resource = dynResource;
addChild(mediaPlayerSprite); = videoElement;

The benefit of using VideoElement is it’s simple to instantiate, however it is also limited in that it can’t handle all types of media, such as a swf or a dynamic multi-bitrate stream.  So, if you know exactly what media types your player is going to be handling, then VideoElement may be sufficient for your needs.  But if you need your player to be a little smarter, and handle any type of media “automagically”, then you should look into abstracting your code a little more, such as by using DefaultMediaFactory (see the ASDOC for code example).  DefaultMediaFactory will add a layer of abstraction, allowing your player to add the appropriate org.osmf.elements class depending on the media stream it receives, e.g. VideoElement vs. SWFElement vs. F4MElement, etc.

Fuad Kamal

With a background in biotechnology, Fuad began his career developing assays and cutting edge technologies around HIV research. From there he shifted into the bioinformatics arena, where he developed innovative information systems in Perl. He started playing with the Flash platform around the time Flash 4 was released, and later developed the flash interface for the Flight Information Display System (FIDS) that you see at pretty much every major airport around the world today. Fuad loves delving into new technologies and pushing technologies in novel directions. Currently he is focused on providing mobile strategy & development for the Health & Fitness markets. He is an iOS developer, teaches an Android & Kotlin college course, and is currently writing The Kotlin Book Fuad has often applied principals he learned from his study of the martial arts to mentoring others as well as taking a unique approach to problem solving. He has found that quite often, the barriers we set before us are more mental than anything else, and the key to overcoming them lies in understanding this concept.

Click Here to Leave a Comment Below

Leave a Reply:

Warning: Missing argument 2 for Jetpack_Subscriptions::comment_subscribe_init(), called in /home/abunur/webapps/anaara_blog/wp-includes/class-wp-hook.php on line 286 and defined in /home/abunur/webapps/anaara_blog/wp-content/plugins/jetpack/modules/subscriptions.php on line 602

%d bloggers like this: