Changeset 0f973c08b964db1275e3a7379cd46660a974b7dd

Show
Ignore:
Timestamp:
03/06/11 17:09:37 (15 months ago)
Author:
Robin Gareus <robin@…>
Parents:
87c08fa30db304b89c0e17a2c94909af0474fc0e
Children:
6bb14a37382b8ebb9192f9d82432a2e03b67b558
git-committer:
Robin Gareus <robin@gareus.org> / 2011-03-06T18:09:37Z+0100
Message:

sansarmes: notify, AVauth etc

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • flex/sansarmes/main.mxml

    r87c08fa r0f973c0  
    55    layout="vertical" 
    66    verticalAlign="middle" 
    7     backgroundColor="#dddddd" 
     7    backgroundColor="#d0d0d0" 
    88    creationComplete="onAppInit()" > 
    99 
     
    1313                    fault="onPubFault(event)" 
    1414                    concurrency="single" 
    15                     method="GET" /> 
     15                    method="POST" /> 
    1616 
    1717    <mx:Script> 
     
    3333            private var cam:Camera; 
    3434            private var mic:Microphone; 
     35            private var avallowed:Boolean 
    3536             
    3637            private var server:String; 
     
    6061                password="f78b64c9e0f2ea24fddce2b0d809cb2855fed1a6"; 
    6162                uploadName=null; 
     63                avallowed=false; 
    6264               
    6365                br.enabled=false; 
     
    6870                cam = Camera.getCamera(); 
    6971                mic = Microphone.getMicrophone(); 
     72 
     73                Security.showSettings("2"); 
     74                mic.addEventListener(StatusEvent.STATUS, this.onAvStatus); 
     75 
    7076                if (!cam || !mic) { 
    71                     bc.enabled=false; 
    72                     ta.enabled=false; 
    73                     te.enabled=false; 
    74                     tt.enabled=false; 
    75                     Alert.show('You do need a camera for live streaming.\nPlease connect one and then reload this Page.', 
    76                                'No camera detected', mx.controls.Alert.OK); // XXX translate 
     77                    avdeny(); 
    7778                    return; 
    7879                } 
     
    8182                mic.setSilenceLevel(0,2500); 
    8283                mic.gain=80; 
     84                mic.setUseEchoSuppression(true); 
    8385                 
    8486                cam.setMode(640,480,25); 
     
    98100                myVu.graphics.clear(); 
    99101                vucanvas.rawChildren.addChild(myVu);  
     102            } 
     103 
     104            private function onAvStatus(event:StatusEvent):void { 
     105                if (event.code == "Microphone.Muted"){ 
     106                    avdeny(); 
     107                } else { 
     108                    avallowed=true; 
     109                } 
     110            } 
     111 
     112            private function avdeny():void { 
     113                bc.enabled=false; 
     114                ta.enabled=false; 
     115                te.enabled=false; 
     116                tt.enabled=false; 
     117                br.enabled=false; 
     118                bp.enabled=false; 
     119                bu.enabled=false; 
     120                Alert.show('You do need a camera for live streaming.\nPlease connect one and then reload this Page.', 
     121                           'No camera detected', mx.controls.Alert.OK); // XXX translate 
    100122            } 
    101123 
     
    173195                conn.client = this; 
    174196                conn.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler); 
    175                  conn.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); 
     197                conn.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); 
    176198                conn.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); 
    177199                conn.connect(server,username,password,uploadName); 
     
    299321 
    300322            private function license_choise(eventObj:CloseEvent):void { 
     323                var notify:int=cbNotify.selected?1:0; 
    301324                if (eventObj.detail==Alert.YES) { 
    302                     service.send({file:uploadName}); 
     325                    service.send({notify:notify, file:uploadName}); 
    303326                } 
    304327            } 
     
    346369        } 
    347370        .footer { 
    348             font-size: 8; 
     371            font-size: 7; 
    349372            textAlign: right; 
    350373            color: #f0fff0; 
     
    368391 
    369392    <mx:Box direction="horizontal" width="100%"> 
    370         <mx:VBox width="388" height="420"> 
     393        <mx:VBox width="388" height="440"> 
    371394            <mx:Text width="370"> 
    372395                <mx:htmlText> 
     
    414437        </mx:VBox> 
    415438 
    416         <mx:VBox height="420"> 
     439        <mx:VBox height="440"> 
    417440            <mx:VideoDisplay id="video" width="340" height="240" /> 
    418441            <mx:ProgressBar width="340" mode="manual" label="%3%%" labelPlacement="center" visible="false" id="soundProgress"/> 
     
    435458                </mx:htmlText> 
    436459            </mx:Text> 
     460            <mx:CheckBox id="cbNotify" width="340" label="Informez-moi par e-mail quand la vidéo est publiée." selected="false"/> 
    437461            <mx:Button id="bu" click="ask_license()" label="publier"/> 
    438462        </mx:VBox>