Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8643865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:09:23+00:00 2026-06-12T12:09:23+00:00

This my first time using StackExchange so I apologize if I miss anything. I

  • 0

This my first time using StackExchange so I apologize if I miss anything.

I am trying to create a AS3 Flash that will record a video using a webcam and RED5 media server; I am stuck (I am not a programmer, more of a computer handyman that does everything).
The example that comes with RED5 works fine (though is in AS2 and I could not, for some reason, make certain things I need to do work), but my code doesnt seem to record the stream as there is not file, the RED5 console only says:

[INFO] [NioProcessor-3] org.red5.server.adapter.ApplicationAdapter – File lecture.flv was deleted

here is the code so far. (updated 09/07/12)

import flash.display.Sprite;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.media.Camera;
import flash.events.MouseEvent;
import flash.media.Microphone;
import flash.events.*;
import flash.media.Video;

var _cam:Camera
var _mic:Microphone

// create basic netConnection object
var _nc:NetConnection = new NetConnection();

_nc.client = this
// connect to the local Red5 server
_nc.connect("rtmp://localhost/myapp");
_nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);

//Add listeners for buttons
record_btn.addEventListener( MouseEvent.CLICK, recordvid );
stop_btn.addEventListener( MouseEvent.CLICK, stopvideo );
//submit_btn.addEventListener( MouseEvent.CLICK, onSubmit );
//Listeners

function netStatusHandler(event:NetStatusEvent):void{
trace("start netstatus handler");
if (event.info.code == "NetConnection.Connect.Success"){
   attachCamera();
                                                      }
}

function attachCamera(e:Event = null):void {
    trace("attach");
        //Attach Camera to field
        _cam=Camera.getCamera();
        _mic=Microphone.getMicrophone()
        vid.attachCamera(_cam);

}

function stopvideo(e:MouseEvent):void {
    //_ns.close();
}

function recordvid(e:MouseEvent):void {
    var _ns:NetStream = new NetStream(_nc);
     trace("publish");
     _ns.attachCamera(_cam);
     _ns.attachAudio(_mic);
     _ns.publish("lecture", "record");
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:09:24+00:00Added an answer on June 12, 2026 at 12:09 pm

    I just found the answer thru extreme googleing, I needed to declare the Netstream variable outside the function; otherwise the “publish” video was “empty” as the garbage collector was destroying my variable at some point.

    so outside a function I declare

    var _ns:NetStream;
    

    and inside the function I declare:

    function recordvid(e:MouseEvent):void {
         _ns = new NetStream(_nc);
         _ns.attachCamera(_cam);
         _ns.attachAudio(_mic);
         _ns.publish("lecture", "record");
    

    Awesomely enough, I found the answer right here in stackoverflow

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first time using XSLT. I'm trying to create a file that
This is my first time using a webservice and I' trying to create a
This is my first time using XML documents. What I'm trying to do is
this is my first time using any StackExchange website, so let's see how it
This is my first time using CMake and I'm trying to build QJSon, a
This is my first time using stackoverflow for a question that I need to
First: this is my first time using GSON. Trying to parse some JSON, I
This is my first time using AJAX. I'm trying to load one of my
This is my first time using Cocos2d for android and I am trying to
This is our first time using this pattern (we're not even sure that this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.