Skip to main content
June 28, 2011
Answered

In Flex3,NetStream publishs record ,the video has no image,only has voice

  • June 28, 2011
  • 1 reply
  • 1148 views

<?xml version="1.0" encoding="utf-8"?>

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

<mx:Script>

<![CDATA[

import mx.controls.Alert;

import mx.core.mx_internal;

import flash.media.Camera;

  

private var nc:NetConnection;

private var ns:NetStream;

private var crm:Camera;

private var mic:Microphone;

private var shobj:SharedObject;

private var myurl = "rtmp://localhost:8888/video/flv";

private function init():void{

crm = Camera.getCamera();

mic = Microphone.getMicrophone();

     if(crm){

          crm.setMode(video.width,video.height,200,true);

          crm.setQuality(0,70);

          video.attachCamera(crm);

          conn();

     }else{

          Alert.show("USING");

     }

}

private function conn():void{

            nc = new NetConnection();

            nc.connect(myurl);

            nc.addEventListener(NetStatusEvent.NET_STATUS,onNetStatusHandler);

}

private function onNetStatusHandler(evt:NetStatusEvent):void {

            if(evt.info.code=="NetConnection.Connect.Success")

            {

                shobj = SharedObject.getRemote("show",nc.uri,true);

               shobj.addEventListener(SyncEvent.SYNC,sharedObject_func);

               shobj.connect(nc);

                ns=new NetStream(nc);

                ns.addEventListener(NetStatusEvent.NET_STATUS,onNetStatusHandler);

                ns.attachCamera(crm);

                ns.attachAudio(mic);

                ns.publish("tmp_vedio","record");

            }

        }

]]>

</mx:Script>

<mx:VideoDisplay width="167" height="144" id="video"/>

</mx:Application>

         So,I play the record video , but there is no image , just voice . (My compute's carema is good) Anyone can help me ? Thanks.

    This topic has been closed for replies.
    Correct answer SE_0208

    Thank you for your reply.

    The videoplayer I used is Windows Media Player. And I want to send my recorded file and MXML file to you - But I don't know how to add file in this forum ,so can you give me your email ? I will send them to you by email. 


    That's the problem - Windows Media Player won't play FMS recorded files. You can download any free software which plays FLV files and check. Or you can develop simple flash client to play the recorded file back.

    1 reply

    Participating Frequently
    June 28, 2011

    How are you playing the recorded video?

    June 28, 2011

    I find the record file, and then play it by Video Player in my own computer.But I just hear the voice that I recorded, no picture.

    Participating Frequently
    June 28, 2011

    Seems strange - so when you say your camera is good - i suppose you can see the camera feed which is attached to your video object - Am I right?

    I was asking you how are you playing because i wanted to see if your playback client is coded properly and it attaches NetStream to Video Object propely. Is this videoplayer coded by you - can you share the code of it.

    Also is it possible for you to pass me the recorded file?