Skip to main content
Participant
October 7, 2013
Question

cam doesnt start

  • October 7, 2013
  • 1 reply
  • 557 views

code

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

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"




   xmlns:s="library://ns.adobe.com/flex/spark"




   xmlns:mx="library://ns.adobe.com/flex/mx" applicationComplete="init()">


<fx:Declarations>



<!-- Place non-visual elements (e.g., services, value objects) here -->


</fx:Declarations>






<fx:Script>



<![CDATA[




import mx.core.UIComponent;










import spark.components.Group;




private const SERVER:String = "rtmfp://stratus.adobe.com/";




private const DEVKEY:String = "YOUR-DEVKEY";















[Bindable]




private var connected:Boolean = false;










private var video:Video;










private var netConnection:NetConnection;




private var stream:NetStream;










private function init():void{





video = new Video(320,240);





video.x = 10;





video.y = 10;












var uic:UIComponent = new UIComponent();





uic.addChild(video);












addElement(uic);












connect();




}










private function connect():void{





netConnection = new NetConnection();





netConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatus);





netConnection.connect(SERVER+DEVKEY);




}










private function netStatus(event:NetStatusEvent):void{





writeText(event.info.code);












switch(event.info.code){






case "NetConnection.Connect.Success":






setupStream();













break;




}











}










private function setupStream():void{





var groupspec:GroupSpecifier = new GroupSpecifier("myGroup/multicastOne");





groupspec.serverChannelEnabled = true;





groupspec.multicastEnabled = true;












stream = new NetStream(netConnection,groupspec.groupspecWithAuthorizations());





stream.addEventListener(NetStatusEvent.NET_STATUS, netStatus);












var cam:Camera = Camera.getCamera();












stream.attachCamera(cam);





stream.publish("multicast");












video.attachCamera(cam);




}










private function writeText(txt:String):void{





txtHistory.text += txt+"\n";




}









]]>


</fx:Script>






<s:TextArea top="10" bottom="10" id="txtHistory" width="252" right="10"/>

</s:Application>

This topic has been closed for replies.

1 reply

Participant
October 10, 2013

Cam starts perfect here with my old cirrus dev key.  Make sure if this is targeting mobile to give the right permissions to Android, but it might be something in your flash player you aren't seeing, the prompt might be displaying out of your window to allow for permissions to access cam.  To change on a mac , launch application from flash builder and in the window that appears right click and go to global settings, camera and mic tab, Camera and Microphone Setting by Site, look for the site name local or 127.0.0.1 or both and allow them without asking permission.  I ran this project as a mobile android app and it worked without a problem, didn't test if the same would run in a browser.  Tested in both 3.8 and 3.9 releases, so I think you might get more help in another forum than the Air Beta Channel discussions, this is usually where we talk about things that used to work and now work differently so you might get more responses on the Flex discussions over at Apache or I don't know if Stratus is being supported now that they moved the hosting of the old LCCS to Influxis.  I wasnt kinda surprised my dev key worked still.