Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display a live streaming video using VideoDisplay in Flex

I'm wondering how to use a VideoDisplay object (defined in MXML) to display video streamed from FMS via a NetStream.

The Flex3 docs suggest this is possible:

The Video Display ... supports progressive download over HTTP, streaming from the Flash Media Server, and streaming from a Camera object.

However, later in the docs all I can see is an attachCamera() method. There doesn't appear to be an attachStream() method like the old Video object has.

It looks like you can play a fixed file served over HTML by using the source property, but I don't see anything about how to attach a NetStream.

The old Video object still seems to exist, though it's not based on UIComponent and doesn't appear to be usable in MXML.

I found this blog post that shows how to do it with a regular Video object, but I'd much prefer to use VideoDisplay (or something else that can be put directly in the MXML).

like image 979
Herms Avatar asked Sep 03 '08 19:09

Herms


2 Answers

VideoDisplay is a wrapper on VideoPlayer, which in turn is a Video subclass. Unfortunately, the wrapper prevents you from attaching an existing NetStream to the Video object.

However, a reference to that component is held with in the mx_internal namespace, so the following should do the trick:

videoDisplay.mx_internal::videoPlayer.attachNetStream(incomingStream);
videoDisplay.mx_internal::videoPlayer.visible = true;

(you need to import the mx.core.mx_internal namespace)

like image 140
Cosma Colanicchia Avatar answered Oct 21 '22 16:10

Cosma Colanicchia


Unfortunately you can attachNetStream() only on Video object. So you are doomed to use em if you want to get data from FMS.

By the way attachCamera() method publishes local camera video to the server so be careful ;)

like image 29
Artem Tikhomirov Avatar answered Oct 21 '22 16:10

Artem Tikhomirov