Search code examples
actionscriptrecordred5playback

red5 play video oflademo using actionscript


Hello i have the following problem, I record a video using red5 like this:

nc = new NetConnection();
nc.connect("rtmp://localhost/oflaDemo");
ns = new NetStream(nc); 
ns.attachCamera(cam);
ns.attachAudio(mic);
ns.publish( "file1", "record" );

and the video is stored in C:\Program Files (x86)\Red5\webapps\oflaDemo\streams

while when i try to play the same video i do:

nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
ns.client = nsClient;
video = new Video(myVid.width,myVid.height);
video.attachNetStream(ns);
video.smoothing=true;
myVid.addChild(video);
ns.play("http://localhost:5080/oflaDemo/file1.flv");

but it throws Error #2044: Unhandled NetStatusEvent:. level=error, code=NetStream.Play.StreamNotFound

any ideas???


Solution

  • I solved the problem on how to play the video with:

    <s:VideoPlayer id="myVid" visible="true" width="100%" height="100%" mediaPlayerStateChange="myVid_mediaPlayerStateChangeHandler(event)">
     <s:source>
       <s:DynamicStreamingVideoSource host="{mediaServerUrl}" streamType="recorded">
          <s:DynamicStreamingVideoItem streamName="{videoFolder}/{filename}"/>
       </s:DynamicStreamingVideoSource>
     </s:source>
    </s:VideoPlayer>