Solved

Adobe Flex Streaming Capabilities

Posted on 2008-09-30
13
4,627 Views
Last Modified: 2013-11-11
I am evaluating Adobe Flex Builder 3 as a solution for our video streaming interface. I am using Flash Media Server to do the actual streaming. Our goal is to be able to streaming videos in .flv, and .mp4 .m4v, etc formats. Through preliminary test we were able to streaming the .flv files over RTMP without any issues using the VideoDisplay component packaged with Flex . However the .mp4 and .m4v files are not streaming.

These are the formats that have worked with the .flv files
rtmp://(streaming server)/vod/AdobeBand_640.flv
rtmp://(streaming server)/vod/AdobeBand_640

These are the formats we have tried and failed with the .mp4 files:
rtmp://(streaming server)/vod/AdobeBand_1500K_H264.mp4
rtmp://(streaming server)/vod/mp4:AdobeBand_1500K_H264.mp4
rtmp://(streaming server)/vod/mp4:AdobeBand_1500K_H264

Since we had success streaming all the aforementioned formats using the FLVPlayBack component in Flash CS3 Professional, we have also tried installing this component in Flex. We again were able to stream the .flv files but not any other formats. It is essential for this project to be able to stream the H264 files. Is Adobe Flex capable of streaming H.264 files by any means? If so, please provide a small example or link to a viable solution. Any information is appreciated.
0
Comment
Question by:will110
  • 7
  • 6
13 Comments
 
LVL 9

Expert Comment

by:asaivan
ID: 22618283
Only Flash Media Server 3 can do h264.  Are you using FMS3?

Flex is capable of doing video, of course. Using the VideoDisplay component, you simply supply the source URI (like you have above) to the source property of a VideoDisplay component (but there are other alternatives)

http://livedocs.adobe.com/flex/3/html/help.html?content=controls_17.html

0
 

Author Comment

by:will110
ID: 22618731
I am using Flash Media Server 3. I am able to stream the H264 files using Flash CS3 Professional, but not Flex Builder 2 or 3.
0
 
LVL 9

Expert Comment

by:asaivan
ID: 22618739
Can you fill me in on what your set up is in Flex?  Can you post your code?
0
 

Author Comment

by:will110
ID: 22619308
Here is a sample of the code we are using. The hint I'm getting that Flex only streams .flv files is that the error message I get when clicking my pause and play controls states that it cannot find the "flv" on the server. Which kind of indicates to me that it is only looking for .flv files. Have you successfully streamed H264 files using Flex and FMS?
<mx:VideoDisplay x="10" y="10" width="346" height="257" id="vdeo" source="rtmp://192.168.168.10/vod/mp4:topic644(s_b_vid).mp4"  autoPlay="false" cuePointManagerClass="mx.controls.videoClasses.CuePointManager"/>

Open in new window

0
 
LVL 9

Expert Comment

by:asaivan
ID: 22619529
Yes, but I've not done it using the VideoDisplay component.  Do you know how to export a Flash CS3 MovieClip as a SWC?

You would create an empty MovieClip, call it VidPlayer.  Drag a FLVPlayback component to it, call the instance name "vid", or whatever.  Then in the Flash Library, right click it and export it as a SWC file.  Take the exported SWC file and put it in the Flex 'libs' folder, this will automatically import it into your Flex project.

Then you can access the SWC via MXML.  If your MovieClip was called VidPlayer, then in MXML you would be able to do something like:

<local:VidPlayer width="500" height="500">

        <local:vid>

		<video:FLVPlayback source="rtmp://blablabla" />

	</local:vid>

</local:VidPlayer>
 

//Make sure you have you skin SWF in the same directory as the output directory

Open in new window

0
 

Author Comment

by:will110
ID: 22619703
I have tried using the FLVPlayback by adding it as a component in Flex. The results I received were the same as using the VideoPlayback in that the MP4 files did not stream. Only the FLVs. Have you had success streaming any H264 file using VideoPlayback in Flex?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 9

Expert Comment

by:asaivan
ID: 22619884
Yes.  Perhaps this code will help:
<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*" xmlns:video="fl.video.*"

 creationComplete="init()">
 

		

	<mx:UIComponent id = 'foo'/>

	<mx:Script>

		<![CDATA[

			private var vidPlayer:VidPlayer = new VidPlayer();

			

			private function init():void

			{

				foo.addChild(vid);

				

				vidPlayer.vid.source = "rtmp://blablabla";

			}

		]]>

	</mx:Script>
 

</mx:Application>

Open in new window

0
 

Author Comment

by:will110
ID: 22622537
I tested the code below and received this error:

VideoError: 1000: Unable to make connection to server or to find FLV on server
      at fl.video::VideoPlayer/play()
      at fl.video::FLVPlayback/play()
      at PlayerTest/__btnPlay_click()[C:\Documents and Settings\tester\My Documents\Flex Builder 3\VideoPresentationProject\src\PlayerTest.mxml:17]
<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*" creationComplete="init();">

	<mx:Script>

		<![CDATA[

			

			private var player:FLVpb = new FLVpb();

			private function init():void{

				foo.addChild(player);

				player.pb.source = "rtmp://192.168.168.10/vod/mp4:AdobeBand_1500K_H264.mp4";

				

			}

		]]>

	</mx:Script>

	<mx:UIComponent id="foo"/>

	<mx:HBox>

		<mx:Button id="btnPlay" label="Play" click="player.pb.play();"/>

		<mx:Button id="btnPause" label="Pause" click="player.pb.pause();"/>

	</mx:HBox>

	

</mx:Application>

Open in new window

0
 
LVL 9

Expert Comment

by:asaivan
ID: 22625225
Are you sure you have your rtmp string correct?  It makes no difference whether you compile in Flash or Flex with the FLVPlayback component.  
0
 

Author Comment

by:will110
ID: 22638556
I have redone all steps in adding flvplayback. Again it seems the flvs play fine but not the mp4. I'm worried I might be entering the rtmp string incorrectly also. Do you know of a live rtmp address that links with an h264 file that I can test? I really need to know for sure if I can stream the h264s from flex.

0
 
LVL 9

Accepted Solution

by:
asaivan earned 500 total points
ID: 22638759
Well, I guarantee you that you CAN indeed stream h264 files from Flex.  Totally.  I'm doing it myself.  My guess is that you have set up something incorrectly in FMS regarding the h264 streaming content.  I noticed you are using the default vod app folder, I've never used this, so I don't know if it's the problem, but my suggestion would be to set up your own virtual directory in FMS, and add a different application to the applications folder.  e.g:

First, take that file main.txt, rename it to main.asc (they wouldn't let me upload it otherwise), put it in a new folder under the applications folder called "video".

Go to your FMS conf/_defaultRoot_/_defaultVhost_/Vhost.xml file.

Then go to the <VirtualDirectory> tag.  Add this line inside:

 <Streams>general;SOME ABSOLUTE PATH TO YOUR VIDEO FILES</Streams>

Then restart FMS.  The above path should something like C:\Videos\streams if on Windows, if your on Linux, then something like /var/streams (make sure permissions are set on Linux). Put those MP4s your trying to stream in that folder.

Then in your RTMP string you would have:

rtmp://192.168.168.10/video/mp4:general/AdobeBand_1500K_H264.mp4

Give it a shot.
main.txt
0
 

Author Closing Comment

by:will110
ID: 31501605
Thank you for your help. I tried all the steps you listed, and though it still did not resolve the issue it did show me an alternative way of setting up my FMS. In the end I was able to get it to work by using rtmpe:// instead of rtmp://. Im not sure the reason for one worked over the other, but I'm relieved. Thanks!
0
 
LVL 9

Expert Comment

by:asaivan
ID: 22671145
Great, I'm glad you got it working. :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now