Why the camera StatusEvent method does not work in Flex 4.6 Desktop Application?

Hello

I have a simple Desktop Application (in collaboration with adobe AIR) that retrieves the web camera, adds two EventListener (activity and event status) and starts the preview.

The event activity method works correctly while the status event method to notify that the correct connection is never thrown.

Here is the method to initialize and start the webcam.

private function videoDisplay_creationComplete():void 
{
          camera = Camera.getCamera();
          camera.setMode(320,240,15,false);
          camera.setKeyFrameInterval (4);
          camera.setQuality (0,100);


          videoDisplay.attachCamera(camera);


          if (camera) 
          {
                    camera.addEventListener(ActivityEvent.ACTIVITY, camera_activity);
                    camera.addEventListener(StatusEvent.STATUS, camera_status);
          } 
          else 
                    textArea.text += "Nessuna camera disponibile.";
}

//Listener chiamato quando il video o il microfono vengono attivati/disattivati
private function camera_activity(evt:ActivityEvent):void 
{
          var str:String = "[{0}] activating:{1}\n";

          textArea.text += StringUtil.substitute(str,
                    evt.type,
                    evt.activating);
}


//Listener chiamato quando lo stato della webcam cambia
private function camera_status(evt:StatusEvent):void 
{
          var str:String = "[{0}] code:'{1}', level:'{2}'\n";

          textArea.text += StringUtil.substitute(str,
                    evt.type,
                    evt.code,
                    evt.level);

          switch (evt.code) 
          {
                    case "Camera.Muted":
                              Alert.show("User denied access to camera.");
                              break;
                    case "Camera.Unmuted":
                              Alert.show("User allowed access to camera.");
                              break;
          }
}


Thanks in advance.

Greetings

I think that if you already allowed access to the camera (for example the Flah Player asks you anymomre to allow) you wil get event direct activity instead of the status event.

The status event is absolutely necessary if you get the triggering event. You can check current FPS the camera and if is > 0 for an interval of shor your camera works very well.

C

Tags: Flex

Similar Questions

  • The Stream.play () method does not work why?

    I want to create an application to switch streams and republish them under continuous flow unique to the remote server.

    In the first step, I tested "Livestream code" of the "Multipoint publishing example" p. 184 of "FLASHMEDIA SERVER 4.5 Developer's Guide ADOBE®" If ns.publish method is used. He managed.

    I try stream.play method now.

    I wrote main.asc code as in the Stream.play example (p. 162) of the 'the ACTIONSCRIPT Language Reference® to ADOBE® FLASH® MEDIASERVER 4.5 server-side", but I have a certain problem despite this.

    I try to spread on my local server (Uri - "localhost/studia") by two customers - OUT and my request for "Livestream" accordingly (with stream name "livestream2") and retraslate it to a remote server by using my "studia" on a local application.

    The connection between two servers (with application "on-line") appears in the Remote Server Admin Consol, but the flow of my local server do not come to her.

    Here's my main.asc script:

    application.myRemoteConn = new NetConnection();

    application.myRemoteConn.onStatus = {function (info)}

    trace ("Connect" + info.code + "\n");

    Respond to all customers

    for (var i = 0; i < application.clients.length; i ++) {}

    application.clients [i]. Call ("onServerStatus", null, info.code, info.description);

    }

    };

    Connect use NetConnection object remote server (the remote server works with other application wery well)

    application.myRemoteConn.connect ("rtmp://RemoteServer/live");

    Estimate of the server data flow

    application.myStream = Stream.get ("livestream");

    application.myStream = Stream.get ("livestream");

    If {(application.myStream)

    application.myStream.play ("livestream2", 0, -1, true, application.myRemoteConn);

    }

    The Stream.play () method does not work why?

    What I've done wrong?

    In this case, I recommend a mixture of solution...

    Something like that will be interesting to check:

    var tempSwitchingStream = Stream.get ("myswitchingstream"); create a stream live temp on the server local app...

    tempSwitchingStream.play (livestream1, 0, -1);      Subscribe to tempSwitching to livestream1... That is to say get the content of livestream1 in there... I can also switch to different streams inside... tempSwitchingStream will get the contents of the stream of //switched

    If (tempSwitchingStream) / / if there is

    {

    NS. Attach (tempSwitchingStream);  Subscribe to my net workflow to receive data from tempSwitchingStream

    NS. Publish (livestream, "live");  now flows net is get data from tempSwitchingStream, so publishing those data with the name "livestream" on the connection to the network... NET already know its NetConnection... See above

    }

    Did you get the point? I created a temporary stream that can pass the stream in its method of game and then I push this temporary stream to a remote server...

    However, it is tricky... Majorly, in most cases similar to yours, people write applications on the application of remote server to get the stream and he spend the pull in play method as described in the first method discussed...

  • Why the Polish support page does not work?

    Why the Polish support page does not work?

    http://PL.consumer.Toshiba.EU/PL/support/home/support_home?

    I think the error message is pretty clear:

    + Service temporarily unavailable +.
    + The server is temporarily unable to process your request due to downtime or maintenance capacity problems. Please try again later. +

  • Why the button "Save as" does not work in new Acrobat Reader? Very annoying...

    Why the button "Save as" does not work in new Acrobat Reader? Very annoying...

    I have already updated to the last DC v15.009.20077...

    So I found a way, if I do it just right, it works (with the file, click the "tiny" file and then save as. I made the mistake of first pressing the home much more first. Really not intuitive or easy to use even if... Looks like you have replaced the button "save under" with the "save in the cloud." We use mettle at work, and the cloud of Adobe is irrelevant for me...

  • Why the "vertical-align" argument does not work?

    Very often, I try to use the "vertical-align" argument to control the CSS formatting, but so far he has never worked, so I had to resolve the situation by specifying values for margin...

    Why the "vertical-align" argument does not work in CSS?

    Alternatives?

    For your reading pleasure.

    http://phrogz.NET/CSS/vertical-align/index.html

    Gary

  • The key fire method does not work

    Hi all

    I have a little problem with my javafx application. I designed my application with the scene designer and added a few buttons for them. For each button, I defined a listener method (annotated with @FXML) and

    I also added each button as member variable to my controller. So far so good.

    Now my controller extends an AbstractController which has certain functions inside. Inside of my method to initialize I pass the button to a method of the abstract class to collect the buttons inside a set.

    Now, to a point that I want to get all buttons of my abstract class defined but that does not work.

    I tried to add to each button setAction method and implemented an anonymous class before you put the button in my game. Then the fire of the button method calls the anoymous class / method. But

    Why it works don't not with a @FXML annotated method?

    The problem would be the "timing"? If I switch the button the the class abstract in the init, the button may not be registred listener method? Just for my understanding, when the init method calls anyway?

    It is difficult to create a small test application for this problem, but maybe someone can help me already.

    Greetings,

    Hauke

    I misunderstood the question a bit, I think. It also works with the following changes:

    Buttons.fxml

    
    
    
    
    
    
     

    Controller.Java

    import javafx.event.*;
    import javafx.fxml.FXML;
    import javafx.scene.control.Button;
    
    public class Controller extends AbstractController {
      @FXML private Button button1;
      @FXML private Button button2;
      @FXML private Button button3;
    
      public void initialize() {
      this.addButtons(button1, button2, button3);
      }
    
      @FXML private void buttonPressed(ActionEvent event) {
      Button button = (Button)event.getSource();
      System.out.println(button.getText() + " fired");
      }
    }
    

    In this version, where managers of the action for the individual buttons are defined in the FXML, these action handlers will be actually installed earlier: before Controller.initialize () is called (and potentially before the controller is instantiated and the buttons are injected in the it).

  • Why the button new folder does not work

    the button create a new folder does not work

    Hello

    You have a common problem with Windows 7. The work that I and many others use is a utility called FileMenu Tools. You can download safely from this link: http://www.softpedia.com/get/PORTABLE-SOFTWARE/System/System-Enhancements/FileMenu-Tools-Portable.shtml .

    After downloading, install the program. Each option is checked by default. I would be much more selective on this subject, otherwise your context menu will be a full page long! When the main window opens, you will see a list on the right side of all the elements that can be added to the context menu. Start weeding through the list and every one to take away, you don't need the United Nationsby checking the box.

    Once you have completed your selection (de-selections) make sure that you click the green check mark in the row of icons at the top of the left window of the interface to 'Apply' of your choice. The program can do much more, but that answers your specific question. I am told that the program has a good help file, so try here if you are interested.

    Let me know how you fare.

    Kind regards

    BearPup

  • Why the keyboard shortcuts/function does not work on Satellite Pro A200?

    I did some research for almost two hours now and no solution.

    I want to do is to be able to use the Fn key for shortcut keys the F0 - F12 Fn + ESC to mute the sound, or button Fn + F6/F7 to set the brightness on my screen. I am running Windows XP, these information are necessary. Things I've tried so far was installing utilities Toshiba, such as the Fn-accessibility and Fn-esse, but they still do not work.

    I have no idea why they have not worked since I arrived to my laptop. Help, please! Thank you!!!

    In the history of the most important info is missing: what model of laptop do you have?
    Please send the exact model number.

  • Why the Age of Mythology does not work on Windows 7?

    I just installed Age of Mythology on Windows 7 RC, when I start the game it says: the application could not start correctly (0xc0000005).
    I tried to run with compatibility for Windows xp sp1 & sp2 and Windows Vista sp1 & 2, but it still does not, beside that works great on windows xp.
    I looked in google for a solution, but all I found is that everyone says he's working on Windows 7.
    So, I need your help please.
    Thank you

    Hello Adams-PC,

    Please use the Forums for Microsoft Windows.

    I show the requirments system for this game are as below.  I suggest to go to the link below and selecting contact us to check if this game is compatible with Windows 7.  I have also included a link below for support with Windows 7, which is where I would suggest to go for the management of this problem.  Thank you!

    The system configuration required
    • Microsoft® Windows® 98/Me/XP/2000
    • PC with 450 MHz equivalent or higher processor
    • 128 MB of system RAM
    • 1.5 GB of available disk space
    • 32 x speed or more fast CD-ROM drive
    • Required 16 MB video card
    • Sound card, speakers or headphones required for audio
    • Microsoft mouse or compatible pointing device
    • 56.6 kbps or better modem to play online

    http://support.Microsoft.com/?PR=GMS

    Forum Windows 7:
    http://social.technet.microsoft.com/Forums/en/category/w7itpro, windowsvistaitpro, windowsxpitpro / Engineer James Microsoft Support answers visit our Microsoft answers feedback Forum and let us know what you think.

  • Why the opacity mask texture does not work?

    I am trying to add a texture to a vector shape in Illustrator and I am doing it by creating an opacity mask. I try to use textures of paper for this. For some reason, it does not. First, I tried to paste the texture after clicking on the area of opacity mask in the transparency window. It didn't work, so I tried a suggestion I saw in the forum and stacked two layers, as you would for a clipping mask and some times and it still doesn't work. Instead of a paper texture, rectangle remains a solid color. I thought that this could be because the documents I used were too subtle, a texture so I tried to use a stronger texture. He always remained a flat color. I can't understand what I'm doing wrong. Is there something on my settings or preferences that is the cause?

    I put your texture on a yellow form with black wavy lines.

    That seems to work. I put a red rectangle on a layer below to show what is the mask.

    The result is perhaps too subtle for the black lines (just like painting on paper with a solid black ink).

    I would try to hide the separate lines of the yellow background with a more varied texture.

  • Why the lightroom download button does not work

    Why does not the buttom of lightroom download trial

    Please try a different web browser.  It is likely that your security settings, add-ons, or toolbars that are interferering with downloading affects availability.

  • Why the standard keyboard shortcuts does not work in the new update?

    Suddenly the standard keyboard shortcuts for example, Zoom (Select the Zoom tool temporarily) and moving around the document (Select the hand tool temporarily) no answer/works? Others with the same problem?

    No problem here.

    Usually, it is a sign that some third-party utilities entering your keystrokes (Shift key, key Alt/Option, etc.).

    Try restarting. Turn off all your startup apps or hold the SHIFT key as you launch your operating system to turn them off. Then open InDesign and probably all will be well. Therefore you need to understand what it is (e.g., Chrome plug-ins are common problems) that is causing the problem.

  • Drag and drop the game. splice method does not work on the table

    Hello

    I have a drag and drop game. You listen a sound for 'bread' peculiarities, you switch to slide that mc in a box. If it's the right object I want to delete as mc and splice table so it isn't select this object more.

    However I notice two things.

    When I splice (0) a specific item - so nothing works.

    When I connect the indexed element cuurent IE: the last element to get right - it is not actually delete it table.

    I highlighted the parts of key code.

    private function placeBubbles (): void
    {
    var nextX:int = 0;
    for each (var: bubble in bubbles)
    {
    bubble.buttonMode = bubble.useHandCursor = true;
    bubble.addEventListener (MouseEvent.MOUSE_DOWN, dragHandler);
    bubble.addEventListener (MouseEvent.MOUSE_UP, checkDrag);
    Bubble.x = 0 + nextX;
    Bubble.y = 300;
    nextX += 100;

    addChild (bubble);
    }
    nextGameRound();
    }

    private function nextGameRound (): void
    {
    currentIndexArray = int (Math.random () * bubbles.length);
    currentBubble bubbles = [currentIndexArray];

    currentBubble.playSound ();
    }

    private void checkDrag(e:MouseEvent)
    {
    e.currentTarget.stopDrag ();
    If (this.currentBubble.hitTestObject (this.box))
    {
    If (currentBubble & & currentBubble == e.currentTarget)
    {
    currentBubble.visible = false;
    trace ("Right");
    Bubbles.splice (currentIndexArray);
    Bubbles.splice (0);

    trace (Bubbles);
    nextGameRound();
    soundCorrect.play)
    }
    }
    on the other
    {

    TweenLite.to (e.currentTarget, 1, {x: xIni, y: yIni, ease:Strong.easeOut, onComplete:onFinishTween}) ;// - If you want something happens on the ending of tween - good idea while children must wait})

    }
    nextGameRound();
    }

    the splice() method accepts two arguments.  the first is the index of the item to delete (start) and the 2nd argument is the number of elements to remove.  in your situation, you should use:

    Bubbles.splice(currentIndexArray,1);

  • Why the firefox search bar does not work?

    If I type a website or search for words in the Firefox search bar and hit 'return' nothing happens. If it's a site I went to before, if fills but when I hit 'back' nothing happens.

    I use Firefox on a Macbook OS X Yosemite 10.10.2 36.0.1

    Pkrys said

    If I type a website or search for words in the Firefox search bar and hit 'return' nothing happens. If it's a site I went to before, if fills but when I hit 'back' nothing happens.

    I use Firefox on a Macbook OS X Yosemite 10.10.2 36.0.1

    I actually ended up doing an update of Firefox. My problem is solved. Thank you.

  • Why the Internet Download Manager does not work on Firefox?

    I have Internet Download Manager 6.15 and is used exclusively for download nearly everything. However, I can't use it while using Firefox, why?

    Yes... I think it's because u do not installed correctly, I think that it may be because you do not restart your computer once you have it installed, what would you say, you try to restart your computer and try to download anything using mozilla. I hope this will help you.

Maybe you are looking for