Changeset 319ba64245fa5363c5b3928e1d92b09712bdb188
- 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:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r5f4af41
|
r319ba64
|
|
| 7 | 7 | backgroundColor="#dddddd" |
| 8 | 8 | 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 | |
| 10 | 17 | <mx:Script> |
| 11 | 18 | <![CDATA[ |
| … |
… |
|
| 17 | 24 | import mx.rpc.events.FaultEvent; |
| 18 | 25 | import mx.core.SoundAsset; |
| | 26 | import mx.core.mx_internal; |
| 19 | 27 | |
| 20 | 28 | |
| … |
… |
|
| 34 | 42 | [Embed('media/Marseillaise.mp3')] private var anthem:Class; |
| 35 | 43 | 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; |
| 37 | 49 | |
| 38 | 50 | private function onAppInit():void |
| … |
… |
|
| 45 | 57 | password="f78b64c9e0f2ea24fddce2b0d809cb2855fed1a6"; |
| 46 | 58 | accepted_license=false; |
| | 59 | uploadName=null; |
| 47 | 60 | |
| 48 | 61 | br.enabled=false; |
| | 62 | bp.enabled=true; // XXX |
| | 63 | bu.enabled=true; // XXX |
| 49 | 64 | |
| 50 | 65 | // cam & mic |
| … |
… |
|
| 193 | 208 | br.enabled=false; |
| 194 | 209 | video.attachCamera(null); |
| | 210 | video.mx_internal::videoPlayer.clear(); |
| 195 | 211 | bc.label="démarrer la caméra"; |
| 196 | 212 | } |
| … |
… |
|
| 205 | 221 | bc.enabled=true; |
| 206 | 222 | } |
| | 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}); |
| 207 | 265 | } |
| 208 | 266 | |
| … |
… |
|
| 305 | 363 | <mx:Button id="br" toggle="true" change="recBt(event)" label="démarrer l'enregistrement"/> |
| 306 | 364 | </mx:VBox> |
| 307 | | <mx:VBox > |
| | 365 | |
| | 366 | <mx:VBox height="420"> |
| 308 | 367 | <mx:VideoDisplay id="video" width="340" height="240" /> |
| 309 | 368 | <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"/> |
| 310 | 382 | </mx:VBox> |
| 311 | 383 | </mx:Box> |