How to make VideoDisplay component work with Macromedia Flash Communication/Media Server?

If you already know about VideoDisplay component, please skip next two paragraphs to see the solution.
VideoDisplay component in Macromedia Flex 2.0 would be replacement of MediaDisplay component in previous versions of Flex. Unlike MediaDisplay component, it doesn’t have any UI controls, it’s a face-less component. It provides you API to control the video playback. So you can build user-interface, controls around it and skin it according to your choice. This was quite difficult with MediaDisplay.
Macromedia Flex 2.0 is still in alpha-phase and if you strongly feel the need of controls, please give us your feedback. We can probably ship it with some default controls.
Anyways, let’s talk about the issue which some people faced while using VideoDisplay with RTMP URLs.
Problem: VideoDisplay component doesn’t play video from a RTMP URL?
For example, following code would compile but won’t work as expected i.e. it won’t play video when application is run.

<mx:Application xmlns:mx="" xmlns="*" >
<mx:VideoDisplay autoPlay="true" url="rtmp://localhost/videodisplay/intro"/>

Solution: VideoDisplay is based on Peldi’s FLVPlayer. Like FLVPlayer, it requires a server-side ActionScript file(main.asc) to be placed inside corresponding FlashCom application directory on server.
If you are missing main.asc on server-side, VideoDisplay won’t be able to play videos from a RTMP URL.
You need to place main.asc inside “scripts” folder under your FlashCom application directory. I am taking above code as reference to explain where you can place main.asc. You can see the directory structure of a FlashCom application in following image:
directory structure of videodisplay flashcomm application.
Description about directories shown above:

  • videodisplay – this is your application directory on flash-media-server
  • scripts – this is the directory where you need to place main.asc and if required, other server-side AS files.
  • streams – this is the directory which contains application-instances directories. For example, _definst_ which is default instance directory.
  • _definst_ – this directory corresponds to default instance of videodisplay application. In this case, intro.flv is placed inside this directory.

I have uploaded the main.asc on my server so that you can download it from here itself. You can also get the same file from Peldi’s blog, but you need to download the entire to get main.asc.
Download main.asc

  • Thanks, this is also some education for me :) I think it’s high time I learnt something about Flash Media Server.

  • Nice to know, you learnt something from it..

  • Philippe maegerman

    I don’t see where you specify the stream name …

  • hi,
    The “intro” is the stream name in the url: rtmp://localhost/videodisplay/intro

  • Hello, Hope you can help – I am new to Flash – using Flash 8. I need to bind text to a curved stroke path and I cannot find the way in Flash 8 to do this. Can you help? Thanks – Mike

  • hi
    im ahsan
    i want learn macro media flash how can do i work at flash can u help me in this matter ???
    plz help me
    bye tc

  • Does main .asc sit server side then, not in the local flash directory for compiling?

  • Arun

    It solved my problem,