Show
Ignore:
Timestamp:
03/05/11 16:42:33 (15 months ago)
Author:
Robin Gareus <robin@…>
Parents:
5f4af41a522ce089d4a803f43f828328284811dc
Children:
eb719711269312a77b89ba047aa0ea803a4c68d9
git-committer:
Robin Gareus <robin@gareus.org> / 2011-03-05T17:42:33Z+0100
Message:

sansarmes: playback and publish fn, no state yet.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • flex/sansarmes/main.mxml

    r5f4af41 r319ba64  
    77    backgroundColor="#dddddd" 
    88    creationComplete="onAppInit()" > 
    9         
     9 
     10    <mx:HTTPService id="service" resultFormat="text" 
     11                    url="http://tac1.theartcollider.org/sansarmes/publish.php" 
     12                    result="onPubOK(event)" 
     13                    fault="onPubFault(event)" 
     14                    concurrency="single" 
     15                    method="GET" /> 
     16 
    1017    <mx:Script> 
    1118        <![CDATA[ 
     
    1724            import mx.rpc.events.FaultEvent; 
    1825            import mx.core.SoundAsset; 
     26            import mx.core.mx_internal; 
    1927 
    2028         
     
    3442            [Embed('media/Marseillaise.mp3')] private var anthem:Class; 
    3543            private var sound:Sound = new anthem() as Sound; 
    36                         private var soundChannel:SoundChannel = null; 
     44            private var soundChannel:SoundChannel = null; 
     45 
     46            // video playback 
     47            private var nc:NetConnection; 
     48            private var ns:NetStream; 
    3749 
    3850            private function onAppInit():void 
     
    4557                password="f78b64c9e0f2ea24fddce2b0d809cb2855fed1a6"; 
    4658                accepted_license=false; 
     59                uploadName=null; 
    4760               
    4861                br.enabled=false; 
     62                bp.enabled=true; // XXX 
     63                bu.enabled=true; // XXX 
    4964 
    5065                // cam & mic 
     
    193208                    br.enabled=false; 
    194209                    video.attachCamera(null); 
     210                    video.mx_internal::videoPlayer.clear(); 
    195211                    bc.label="démarrer la caméra"; 
    196212                } 
     
    205221                    bc.enabled=true; 
    206222                } 
     223            } 
     224 
     225            public function playBt(event:Event):void { 
     226                // todo: check uploadName etc 
     227                // todo: disconnect camera, re-enable  
     228 
     229                bc.selected=false; 
     230                camBt(null); 
     231 
     232                if(!bp.selected) { 
     233                    if (ns) { 
     234                        ns.seek(0); ns.pause(); 
     235                    } 
     236                    video.attachCamera(null); 
     237                    video.mx_internal::videoPlayer.clear(); 
     238                    return; 
     239                } 
     240 
     241                nc = new NetConnection(); 
     242                nc.connect(null); 
     243                ns = new NetStream(nc); 
     244                //ns.play("http://tac1.theartcollider.org/sansarmes/data/sac-(pas_de_titre;moi;1299314449031-854).flv"); /// XXX 
     245                ns.play("http://tac1.theartcollider.org/sansarmes/data/"+uploadName+".flv"); /// XXX 
     246                // TODO: check error. 
     247                video.mx_internal::videoPlayer.attachNetStream(ns); 
     248                video.mx_internal::videoPlayer.visible = true; 
     249 
     250                //ns.togglePause(); 
     251            } 
     252 
     253            private function onPubOK(event:ResultEvent):void { 
     254                Alert.show('Your video entered the moderation queue and will be published after review, soon.', 
     255                           'Published.', mx.controls.Alert.OK); 
     256            } 
     257 
     258            private function onPubFault(event:FaultEvent):void { 
     259                Alert.show('Publication failed. please contact robin.gareus@citu.info', 
     260                           'Publication Failed.', mx.controls.Alert.OK); 
     261            } 
     262 
     263            public function pubBt(event:Event):void { 
     264                service.send({file:uploadName}); 
    207265            } 
    208266 
     
    305363            <mx:Button id="br" toggle="true" change="recBt(event)" label="démarrer l'enregistrement"/> 
    306364        </mx:VBox> 
    307         <mx:VBox > 
     365 
     366        <mx:VBox height="420"> 
    308367            <mx:VideoDisplay id="video" width="340" height="240" /> 
    309368            <mx:ProgressBar width="340" mode="manual" label="%3%%" labelPlacement="center" visible="false" id="soundProgress"/> 
     369            <mx:Spacer height="100%"/> 
     370            <mx:Text width="340"> 
     371                <mx:htmlText> 
     372                    <![CDATA[<b>étape 5</b>: vérifier l'enregistrement]]> 
     373                </mx:htmlText> 
     374            </mx:Text> 
     375            <mx:Button id="bp" toggle="true" change="playBt(event)" label="lecture"/> 
     376            <mx:Text width="340"> 
     377                <mx:htmlText> 
     378                    <![CDATA[<b>étape 6</b>: valider l'enregistrement pour publication]]> 
     379                </mx:htmlText> 
     380            </mx:Text> 
     381            <mx:Button id="bu" click="pubBt(event)" label="publier"/> 
    310382        </mx:VBox> 
    311383    </mx:Box>