FlashComGuru Home streaming portalInfluxisCDNImediaseeUvault
                                                                                       Forum Index | Active Topics | Register
                                                                                                          List Overview | List Archives
                                                                                                                           About this site | Advertise
 

home

Adobe AIR (10)
Applications (36)
Books & Training (10)
Collaboration (15)
Components (8)
Events (69)
Flash Player (23)
Flex (32)
FMS (100)
General (119)
Hosting (5)
Jobs (14)
Off topic (36)
Press Releases (18)
Site Check (11)
Tools (46)
Videos & Players (67)

Follow me on Twitter

 
According to the Flex docs this is possible: "The VideoDisplay control lets you play an FLV file in a Flex application. It supports progressive download over HTTP, streaming from the Flash Media Server, and streaming from a Camera object."
But how do I attach a NetStream (which is playing my live stream) to the component for display? It seems to only have an attachCamera method and a source property, but no attachNetStream method.
It appears that this component manages it's own NetConnection and one has to feed it with a full RTMP string (which can point to a pre-recorded stream or a live stream): The syntax above works for me if I have a live stream called 'live_stream_name' playing.
But this a bit sucky for my particular app which consists of a broadcaster and a receiver. Both parts manage their own NetConnection (the text chat I'm using needs an NC regardless of video) and the fact that the VidoDisplay component establishes its own connection results in errors (the NC's callbacks I use elsewhere are not found for the component's connection).
What's also confusing is that on the broadcasting side I can use the component just fine via attachCamera and then a separate attach to the NetStream. So the component works on one end but not the other (if that makes sense). There's probably a way of hacking it so that it can use your own NC but that seems to be overkill here.

It would be good if you could pass the component a reference to a playing NS instead of a full RTMP address. For now I'll have to roll back and use a plain Video object to make this work.

Comments
[Add Comment]
I end up using NetStream and the Video object with my own controls. It is a gap that some will need to fill, write a nice VideoPlayback/Display component.
# Posted By Renaun Erickson | 1/17/07 7:06 PM
yeah I neded up going down the same route, works for me. I found the docs a bit misleading and the component kind of hard to grasp
# Posted By Stefan | 1/17/07 8:06 PM
VideoDisplay is a nice high level wrap-up of video functionality. However it should let users digg further down for better control by providing access to the (hidden?) underlying netstream object
# Posted By Harry | 1/18/07 12:45 PM
I've had a play with the Flex VideoPlayback component. You are correct it does have annoying limitations. For now its good ole NetStream and Video Class

a
# Posted By [a /] | 2/14/07 11:04 AM
It appears that the VideoDisplay replacement devised here http://www.cynergysystems.com/blogs/page/keunlee?e... might let us get around this (see the example used). I'm not sure why all the class sources needed to be copied wholesale from the mx.controls namespace to do this and I haven't tried it though.
# Posted By Chris McDonough | 6/11/07 8:06 PM
Actually I was very very wrong. you CAN attach the Camera to a VideoDisplay and you CAN attach the NetStream to the VideoDisplay.

Here is a code snippet, for attaching a NetStream for rtmp streaming of an FMS or Red5 server. The code was written for a Flex application within the <mx:Script> tag

var vUi:UIComponent = new UIComponent()
var _v0:Video = new Video(640, 360);
vUi.addChild(_v0);
addChild(vUi);
         
var _s:NetStream = new NetStream(_nc);
_s.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
         
_s.client = this;
         _v0.attachNetStream(_s);         _s.play("Transformers");

It works perfectly
# Posted By a | 9/10/07 5:02 PM
Sorry wrong code above. This is the code you need. "vid" the id of a VideoDisplay object on stage

_cam = Camera.getCamera();
_cam.setMode(220, 165, 30);         _cam.setKeyFrameInterval(60);         _cam.setQuality(0,85);
         
vid.attachCamera(_cam);

The camera captuere
# Posted By a | 9/10/07 5:08 PM
Still no clue regarding Flex and live streaming - anybody has a working example? Ondemand files work quite well, but no matter if I try using <mx:Script> or a VideoDisplay component - it just never works.
# Posted By Jan Petzold | 10/26/07 10:24 PM
you'd have to extend VideoDisplay or simply roll your own component using the Video object in Flex.
# Posted By Stefan | 10/27/07 9:16 AM
Stefan, thanks for your reply - I've already created a component, problem is, that it just never "displays" on the screen - no matter if I choose a live stream or ondemand stream as source. Do you have a working example for this? Thanks.
# Posted By Jan Petzold | 10/27/07 2:30 PM
Jan, nothign hand right now sorry. It may not display in Flexbuilder's design view but if done correctly will show the video once compiled and working.
# Posted By Stefan | 10/27/07 10:15 PM
I saw a great example of streaming video in Flex. They build there own video object and so forth and it uses Red5 server (free FMS). Check it out:

http://www.rockonflash.com/blog/?p=12
# Posted By Stephen | 12/6/07 8:31 PM
First, I've also spent countless hours of frustration messing with the VideoDisplay component in an attempt to get it to display a live stream off flash com server. I read all the posts on this page and still it seems there is no solution for this besides "rolling your own component". Unfortunately, I'm not an expert AS developer and doing such thing would take quite a while even if I was. I'm looking for a quicker and easier solution. Anybody have any other ideas?
# Posted By DanO | 3/1/08 12:17 AM
One alternative is to bring the FLVPlayback component into flex with a custom skin: http://www.flashcomguru.com/index.cfm/2007/7/18/fl...
# Posted By Joeflash | 3/31/08 7:49 AM
well I got the live streams to work as expected dynamically using a VideoDisplay object and passing in full RTMP uri's... now my problem is the fact that I can't pass it a NetStream and now my client numbers are going through the roof.

Used to be 1 connection could stream 3 streams over that one NC... now if you're using this component!

Looks like I'm going to have to extend and override this thing and hopefully find where they get to the nitty gritty under lying videoPlayer component and pass off the NetConnection object.

::sigh::
# Posted By Chad | 11/14/08 1:28 AM
Can you, Chad, post the solution you found to use the VideoDisplay object to play a live stream?
I'm publishing a video from my camera from a Red5 server (thanks to the publisher demo) and I don't know which rtmp URI to pass as a source to the videoplayer.
# Posted By Maurizio | 2/3/09 5:42 PM
I haven't had any luck with Flex 3 with FMS media server 3.5.

I can get the streaming part to work as I look at the FMS admin console I can see that streams that are created, but I cannot get them to display...

Anyone having any luck.

All, I am trying to do is to publish and stream and view it.
# Posted By Jon Raynor | 3/18/09 3:06 PM
Jon,

I'm seeing exactly the same problem with Flex 3 and FMS 3.5. Upload from a live camera to server appears to be working fine and event the playback seems to work, at least I get the right sequence of events, see the number of upload/download bytes incrementing in the admin console..

But then my playback VideoDisplay simply freezes at the very first frame and that's about it. No playback for live streams.

Did you manage to figure out what's wrong?
# Posted By Max G | 5/14/09 6:28 PM
Hi, I have a little problem. I want to make a simple ap playin' FLV videos located on the HDD. This ap will have 1 VideoDisplay and few buttons changing the FLV files displayed in the component. I thought it would be done buy changing the VideoDisplay.source but it doesn't work :-(

Can u help me?

Let's say u have VideoDisplay, Button1, Button2. VideoDisplay doesn't have any source. When u click on the Button1 or Button2 the VideoDisplay recieve an URL to the file1 (by button1) or file2(by button2) and start playin' the video.
# Posted By simczik | 6/27/09 5:04 PM