Recording and Playing back Streaming Audio and Video

Hi Folks...
I posted this in another forum too. I have this sample code from the e-book: "Learning Flash Media Server 3". The purpose of the code is to create a FLV. The code is not running as it should. When I click on the 'record' button, the label is to change to 'recording', that dosen't seem to happen and also when I click on the 'Stop Record' button, I get the following error:
"TypeError: Error #1009: Cannot access a property or method of a null object reference.
at MinRecord/stopRecord()"
I have my suspicion on a certain section of the code as the possible culprit, but I am not sure how to rectify it, I will post the entire code here so you guys can have a look.
package
      import fl.controls.Button;
      import fl.controls.TextInput;
      import flash.display.Sprite;
      import flash.net.NetConnection;
      import flash.net.NetStream;
      import flash.events.NetStatusEvent;
      import flash.events.MouseEvent;
      import flash.events.Event;
      //import flash.net.ObjectEncoding;
      import flash.media.Camera;
      import flash.media.Microphone;
      import flash.media.Video;
      public class MinRecord extends Sprite
       private var nc:NetConnection;
       private var ns:NetStream;
       private var rtmpNow:String;
       private var msg:Boolean;
       private var cam:Camera;
       private var mic:Microphone;
       private var vid1:Video;
       private var recordBtn:Button;
       private var stopBtn:Button;
       private var textInput:TextInput;
       //Constructor
       function MinRecord ()
       //NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
       nc=new NetConnection();
       nc.addEventListener (NetStatusEvent.NET_STATUS,checkConnect);
       rtmpNow="rtmp://192.168.0.11/vid2/recordings";
       //rtmpNow="rtmp:/vid2";
       nc.connect (rtmpNow);
       addMedia ();
       addUI ();
       recordBtn.addEventListener (MouseEvent.CLICK,startRecord);
       stopBtn.addEventListener (MouseEvent.CLICK,stopRecord);
     private function addMedia ():void
       cam=Camera.getCamera();
       cam.setMode (240,180,24);
       cam.setQuality (0,90);
       mic=Microphone.getMicrophone();
       vid1=new Video(cam.width,cam.height);
       vid1.attachCamera (cam);
       addChild (vid1);
       vid1.x=100;
       vid1.y=50;
       private function addUI ():void
       recordBtn=new Button();
       recordBtn.label="Record";
       recordBtn.x=100;
       recordBtn.y=50+(cam.height) +5;
       recordBtn.width=70;
       addChild (recordBtn);
       stopBtn=new Button();
       stopBtn.label="Stop Record";
       stopBtn.x=recordBtn.x+85;
       stopBtn.y=recordBtn.y;
       stopBtn.width=75;
       addChild (stopBtn);
       textInput=new TextInput();
       textInput.x=recordBtn.x;
       textInput.y=recordBtn.y + 30;
       addChild (textInput);
       private function checkConnect (e:NetStatusEvent):void
            msg=(e.info.code=="NetConnection.Connect.Success");
             if (msg)
              ns = new NetStream(nc);
       private function startRecord (e:Event):void
             if (ns)
                   recordBtn.label="Recording";
                   ns.attachAudio (mic);
                   ns.attachCamera (cam);
                   ns.publish (textInput.text,"record");
       private function stopRecord (e:Event):void
             recordBtn.label="Record";
             ns.close ();
My deduction is that the 'if' statement in the 'startRecord' function is not resolving to 'true' and hence the label is not changing to 'Recording'. Also I feel that the assingment to the variable 'ns' of type NetStream is not being done and hence in the function 'stopRecord' I get the above mentioned error message when I click on the stop button. How do I rectify these problems?

Hi Amit,
Thanks for the message, I had acutually realised late last evening that changing this:
rtmpNow="rtmp://192.168.0.11/vid2/recordings"
to this:
rtmpNow="rtmp:/vid2"
which is what you have also recomended solves one of the problems which is that of the startRecord function, as my server is running on my own local machine. However when I click on stop record, I am getting the following error:
"Error #2044: Unhandled NetStatusEvent:. level=error, code=NetStream.Publish.BadName
at MinRecord/checkConnect()"
I am trying to figure this one out...if you have any clues, let me know. Thanks.

Similar Messages

  • Using CAN bus to transport and play the stream audio data

    hello,
    Just want to build a PC-Based control network using CAN bus (Ethernet not considered).The system is separated two parts , one is the front unit(FU), and the other is the centeral unit(CU). FU performs dialing-up number to the CU , and play the stream audio media data come from CU, CU monitor the telephone call activated from FU's user , send rm or mp3 data to the FU . I'd like to know if CAN bus could realize this function? if it can , which hardware must be supplied ? Is there any suggestion that not use PBX to realize the voice (telphone) communication ? Please give an solution , your advise is greatly appreciated . Thanks.
    David

    Hi David,
    the CAN protocol essentially just gives you the ability to transfer (broadcast) up to eight data bytes across the network at a maximum data rate of 1 Mbit/s.
    There are so-called higher level (or layer) protocols that further specify the data exchange between a data producer can the consumer (DeviceNet, CANopen, etc.).
    If your application is not tied to any of those protocols, that means you have the freedom to design all (CAN) nodes of your network, you can implement your own protocol based on the eight data bytes and the arbitration ID CAN offers.
    For more information on the CAN protocol, take a look at appendix B of the NI-CAN Hardware and Software Manual, or visit the web site of CAN in Automation (CiA).
    For your particular application you would need a CAN port on both the FU and the CU (preferably high-speed physical layer) and a PCI interface CAN card for you development.
    -B2k

  • On my iPhone 4s the video play back , the audio is very low . All other audio is good on phone even older video plays nice and loud . I have no idea what is wrong?

    On my iPhone 4s taking video then playing back ,the audio is so low you can barely hear it . I played older videos and the audio works perfect . All other audio works perfect on the phone too. I have no idea what is going on ?

    Hey!
    I have tried holding down the home and power button countless of times. It doesnt respond at all. Plug my phone to a charger and hold down the power button and my phone switched on. But it said Activation Required and said connect to Itunes. As e screen remains on the connect to Itunes screen, I disconnect the charger from my phone and my phone went dead instantly. My battery is full btw. Tried connecting to Itunes through my Macbook Pro but iTunes doesnt detect my device and the apple logo flashes for about a few seconds on my phone and then disappear and then came back on again. My Iphone has been connected to my laptop for about 30 mins and the apple logo has been coming on and off for 30 minutes now and Itunes has not detect my device yet.
    SIGHHH.

  • Is it possible to record parts of a phone call on Skype into Logic, then play back the audio while still on the Skype call?  I'm a voice teacher coaching students in other cities, and Skype is not helpful with this idea.

    Is it possible to record parts of a phone call on Skype into Logic, then play back the audio while still on the Skype call?  I'm a voice teacher coaching students in other cities, and Skype can't offer any suggestions.

    Hi
    What I'm saying is:
    Make a new MONO audio track (use the + button). Assign it to input 1
    Make a second new MONO track, assign it to input 2
    Name both tracks, record-enable both tracks, and record.
    You could, of course, make both tracks in one go via the new track dialog box, and hav ethem automatically assigned to ascending inputs.
    CCT

  • Record audio clip and play back it into media player

    how can i record voice clip using java application and play back it with media player.

    870902 wrote:
    how can i record voice clip using java application and play back it with media player.1) Record from "javasound://0" using a Processor / DataSink
    2) Play back the file from 1 using a Player

  • Problems with Camino and Safari browers on sites streaming audio and video.

    The Camino browser (latest update) will not allow me to type anything if I am listening to a site with streaming audio or video. As soon as I start typing, I get white patches all over the place. The only solution was to use Safari for listening and do the typing on Camino. Now, Safari freezes on every single site that has any streaming. The Safari version is 3.03, and it was working fine a few days ago. Any ideas?

    Hi,
    Try troubleshooting the Safari .plist file.  Quit Safari.
    Open a Finder window. Select your Home Folder in the Sidebar on the left. It has a small house icon. Then open the Library folder then the Preferences folder.
    Move the com.apple.Safari.plist file from the Preferences folder to the Desktop. Relaunch Safari. Try a .flv file. If it downloads the file as it should then move the .plist file to the Trash, otherwise move it back to the Preferences folder.
    If that didn't help, back to the Finder window, Home folder, Library / Safari. Move the Downloads.plist file from the Safari folder to the Trash. Restart Safari. Try again.
    And check Safari / Preferences - Extensions. Could be an Extension causing a conflict. If you have any installed, turn that off, relaunch Safari, try again.
    Carolyn  

  • Recording and playing back

    Hi, I have question about recording and playing back.
    I am going to record by AudioQueue and to play back by MPMoviePlayerController.
    My code can record by AudioQueue.
    But, It can not record After playing back by MPMoviePlayerController.
    Is Anyone who had same problem and solved it.
    Please tell me resolution method.

    Hi
    Welcome to Apple Discussions.
    We don't get very many questions about Core Audio here so if you don't get any response, you can try the Apple emailing list for Core Audio:
    [email protected]
    The list is very friendly and I'm sure someone there will be able to answer your question.
    Bob

  • MHP(XletView)  streaming audio and video sample

    I need some sample which uses streaming audio and video for Xletview, where can find it??

    Hi,
    If you want some examples check the pege:
    http://www.mhp-interactive.org/code/codesamples.shtml
    Have a nice playing
    Regards, Martinez

  • Streaming audio and video frequently freezes or becomes garbled.

    Streaming audio and video frequently freezes or becomes garbled on my Macbook.  I do not have this problem with non streaming media such as iTunes or downloaded video.  The problem started six or eight months ago and has gradually become worse.  I don't know what to start checking.

    I have some issues with this feature. I can play all the media, however, I can only hear sound for a few secondsbut no images; then freezes.
    Format: xvid (.avi)
    OS: Windows Vista home premium X64 (WMP 11)
    Does anyone has the same problem or a fix?

  • Google app can't play all the audio and video on this page, any suggestions?

    New Lenovo Yoga laptop with W8.1. I have downloaded the google app, and when I search for something and the go to open a video, the flash player doesn't work and I get a message across the top of the window saying "google app can't play all the audio and video on this page"
    Does anyone have a fix? i can only find a fix for google chrome, not their app.
    Thanks

    The "app" from the windows app store called "google search" http://apps.microsoft.com/windows/en-gb/app/308dc145-6851-487d-b83b-1223a3b52dc2
    It isn't specific to search video or anything else, you just type in the search and it finds the answers, but it isn't done via chrome. When the result includes a video or audio and I click on the link to that page, the app kicks up that the flash player needs downloading. I can't work out how to do it

  • Operating Windows 7 Home Premium, 2 user accounts. Running Firefox one user can stream audio and video, the other cannot. Can anyone help?

    Two accounts set up. One can stream audio and video using Firefox, the other account cannot. The account with cannot stream a/v is able to steam a/v using (gasp) MS Internet Explorer. Is there some setting I have screwed up?

    There are some compatibility issues between the latest Flash player and some Firefox add-ons or settings. Could you see whether anything in this article helps: [[Flash 11.3 doesn't load video in Firefox]].

  • Streaming audio and/or video crashes your router BEFW11s4 firmware problem

    Ok!!! Apparently some of us have had the problem where trying to stream audio and/or video can cause the Linsys BEFW11S4 to crash, where only a power down and re-up will retore communication. Changing the MTU size has been suggested ad-nausium. I hope this works for you all, because it worked for me.
    Apparently the latest firmware is the problem. I just installed an older firmware version and problem solved (1.50.14).
    ftp://ftp.linksys.com/pub/network/befw11s4_v4_v1.50.14_code.bin
    So, looks like maybe Linksys could hopefully issue another firmware update that fixes this (we hate having to use old firmware... trading off one bug fix for other multiple bugs that may rear their ugly head later on).
    list of bugfix history found here:
    http://www.linksys.com/servlet/Satellite?blobcol=urldata&blobheadername1=Content-Type&blobheadername2=Content-Disposition&blobheadervalue1=text%2Fplain&blobheadervalue2=inline%3B+filename%3Dbefw11s4_v4_v1.52.02_ver.txt&blobkey=id&blobtable=MungoBlobs&blobwhere=1130824460891&ssbinary=true

    Hi all -
    This looks like this will fix the issue I have with my router. I'm willing to try it, anyway.
    My question is pretty basic: What do I do after I download the file?
    Thanks, Kate

  • My iPad camera photos will wirelessly sync with my iMac and iCLoud photo stream, but the videos do not, is USB connection the only way to transfer videos or is there also a wireless method?

    My iPad camera photos will wirelessly sync with my iMac and iCLoud photo stream, but the videos do not, is USB connection the only way to transfer videos or is there also a wireless method?

    Videos are not included with the Photo Stream. Photo Stream is for photos only.
    There is not a wireless method for importing videos from the iPad's Camera Roll.

  • Any way to disable the bluetooth handset and use enable streaming audio only?

    I don't use bluetooth in my car to make or receive phone calls and only use it to stream Pandora.  On my previous BBs I was able to disable the handset function and just use streaming audio, but I'm not finding any similar options on the Z10.  Does anyone know of a way to do this? Right now I'm just powering off my stereo when I receive a call, but that is not a great solution.  Thanks for any feedback.
    Solved!
    Go to Solution.

    Hello rangerdanger and welcome to the BlackBerry Support Community Forums.
    Thanks for your question regarding Bluetooth.
    The BlackBerry Z10 does not have the option to edit what services are allowed with a Bluetooth connection.
    Depending on your vehicle, you may have to access your Bluetooth set up or settings within your car's dash to control what features are enabled with Bluetooth. 
    If you are unsure how to access these settings, contact your dealership or consult your owners manual.
    Cheers!
    -HMthePirate
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • Is there some way I can insert and play these additional audio files, accessible via separate button

    I am converting a CD-ROM course to an online format with that software.
    In the majority of slides created I have used the Import Audio function to insert a primary audio file containing important curriculum information.
    This file typically activates the moment you open the slide.
    So far so good.
    However, in many slides I also need to insert some secondary audio files.
    While the Import Audio function permits me to splice several files into one, this isn't what I want.
    Instead, I need to insert one or more additional audio files that can be activated independently via separate buttons on a given slide.
    I can in fact do this with the Insert Button function, but in the process a Windows Media Player file opens when I convert the project into HTML.
    My question:
    Is there some way I can insert and play these additional audio files, accessible via separate buttons, without creating and opening a Windows Media Player file?
    Thanks

    It is hard to assess the situation without sitting at your computer and having a look myself.  First, if you're seeing space savings I doubt all your files are a compressed format.  Frequently if you try compressing a compressed format file such as AAC (don't confuse with AIFF) you will actually find the file gets larger because there is overhead to compression and if it cannot compress any more then you end up just adding overhead on top of no savings.  Second, normally if you zip the iTunes library it would basically make it inaccessible to iTunes and iTunes would make you a brand new library or at least flag all your tracks as missing (as you are seeing ain part).
    I don't know what computer you are running, which operating system, which version of iTunes.  Unless they have done something radical in Lion in terms of letting you zip your iTunes folder and still have it functional, you either didn't zip the whole thing, or... I don't know.  One scenario is that somehow your media have been split up and you have them in several locations.  One isn't really part of your library except for 80 tracks, so when you compressed it (and I still am puzzled by the compression unless it was AIFF files you were no longer using), it didn't really make much difference to the playability.  Then you have an untouched library elsewhere.
    Use the Reveal In Finder command to see where some of those problem files are located vs. where the playable files are located.

Maybe you are looking for