Passing parameters to Red5 application with OSMF
Recently working on a Flex project i had the need to implement a video player in my Flex application. Although my needs did not involve media streaming, rather only playing live streams, i still needed a  industry standard code to my solution. Thats where OSMF (Strobe)  came handy. Tracking OSMF for a few months, seems like we finally have a usable version – OSMF 1.0  (0.93).
The second hurdle was passing parameters to RTMP application. As the traditional Netconnection class allows connection params in the constructor, i was unable  to find a example on the web involving OSMF and passing parameters to RTMP applications. Finally after some struggle , god’s grace
i think i nailed it. Here is the code snippet showing you how to connect to a RTMP application and passing parameters when connecting.
Note: Make sure you have latest OSMF revision from trunk added to your project classpath.
<mx:Application applicationComplete="application1_applicationCompleteHandler(event)" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="1024" minHeight="768">
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
import org.osmf.containers.MediaContainer;
import org.osmf.elements.VideoElement;
import org.osmf.events.MediaPlayerStateChangeEvent;
import org.osmf.media.MediaPlayer;
import org.osmf.net.NetLoader;
import org.osmf.net.StreamType;
import org.osmf.net.StreamingURLResource;
private static const REMOTE_STREAMING:String = "rtmp://localhost/RtmpAuthenticate/DarkKnight.flv";
private var mediaElement:VideoElement;
private var mediaPlayer:MediaPlayer;
private var container:MediaContainer;
protected function application1_applicationCompleteHandler(event:FlexEvent):void
{
var vector:Vector.<Object> = new Vector.<Object>();
vector[0] = "rajdeep";
vector[1] = "xyz123";
// TODO Auto-generated method stub
mediaElement = new VideoElement(new StreamingURLResource(REMOTE_STREAMING,StreamType.RECORDED,NaN,NaN,vector),new NetLoader);
container = new MediaContainer();
container.addMediaElement( mediaElement );
// Flex requires a DisplayObject to be wrapped in Flex Framework UI Abstraction
videoParent.addChild( container );
// MediaPlayer is a virtual controller. Assign it a media element and it will autoplay the media by default.
mediaPlayer = new MediaPlayer(mediaElement);
mediaPlayer.addEventListener(MediaPlayerStateChangeEvent.
MEDIA_PLAYER_STATE_CHANGE,onMediaPlayerState);
container.width = 320;
container.height = 240;
}
private function onMediaPlayerState(me:MediaPlayerStateChangeEvent):void
{
trace(me.state);
}
]]>
</mx:Script>
<mx:UIComponent x="144" y="110" width="409" height="325" id="videoParent" />
</mx:Application>
Popularity: 22% [?]
March 26, 2010
Tags: Actionscript 3.0, Flash, Flash Player 10.1, OSMF, Red5, RTMP, Streaming, Video Posted in: Actionscript 3.0, OSMF, Red5




18 Responses
Frau Viagra - March 9, 2011
Potenzmittel Apcalis…
[...]Apcalis SX Oral Jelly Potenzmittel ist im Gegensatz zu anderen Mitteln fluessig einzunehmen[...]…
fresno limousines - March 10, 2011
Recent Blogroll Additions…
[...]usually posts some very interesting stuff like this. If you’re new to this site[...]…
Flax Seed Benefits - March 12, 2011
Flax Seeds Benefit…
[...] below you’ll find the link to some sites that we think you should visit. Posted in [...]…
Discover CieAura - March 13, 2011
Cieaura Suggests It is A Fantastic Write-up Cool…
[...] Take time to see these some might be interest too… [...]…
Meat Slicer - March 14, 2011
Your Friend & Partner…
I really think your blog is great! I’ve added a link back here; I hope that’s alright as I’d like my readers to check your site & articles out. It’s Here on my site’s blog. Always like to honor high quality content. Great job!…
carpet cleaning kalamazoo - March 14, 2011
battle creek carpet cleaning…
[...]the time to read or visit the content or sites we have linked to below the[...]…
apple mac mini - March 14, 2011
apple mac mini 2011…
[...]the time to read or visit the content or sites we have linked to below the[...]…
Sensa Trial - March 14, 2011
Sensa Scam…
[...]below you’ll find the link to some sites that we think you should visit[...]…
wartrol reviews - March 18, 2011
good post…
I can see now whats my friend is saying.. good post…
Direct Car Shipping - March 19, 2011
Car Shipping…
[...]our team noticed your site was mentioned in some of our embroidering style and design web site[...]…
homes for sale in new bern nc - March 20, 2011
…
[...]below that are definitely worth checking out[...]…
Life Partners Lawsuit - March 21, 2011
patio heaters…
[...]followed below there can be the website link towards a world-wide-web sites i visualise be certain to use[...]…
Scary Maze - March 22, 2011
Play Scary Maze…
[...]here are some other site that might interest you[...]…
Infertility los angeles - March 28, 2011
Community Service Hours…
[...]followed below there can be the website link towards a world-wide-web sites i visualise be certain to use[...]…
hobby lobby coupon 40% off - March 29, 2011
Parking in Brooklyn…
[...]below you’ll find the link to some sites that we think you should visit[...]…
Conveyancing Solicitor - March 29, 2011
Conveyancing Solicitors…
[...]below you’ll find the link to some sites that we think you should visit[...]…
champignons - March 30, 2011
Did you know Jolie broke up with him?…
[...]below you will find the link to a couple sites we think you should visit[...]…
strollers - April 4, 2011
Infertility los angeles…
[...]the time to read or visit the content or sites we have linked to below the[...]…
Leave a Reply