Changeset 72fdc647b33b659395c78e32c90a90e685f2ae3d for flex
- Timestamp:
- 03/10/11 15:08:36 (14 months ago)
- Parents:
- 34a11f2ffe4ddf280d5b202de17a984ce81c2485
- Children:
- a3706cf61a210c0acbba31fc661ca48f97086fcf
- git-committer:
- Robin Gareus <robin@gareus.org> / 2011-03-10T16:08:36Z+0100
- Location:
- flex/derrick-av
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
flex/derrick-av/main.html
r99bf52b r72fdc64 18 18 <div style="margin: 0 auto; width:720px;"> 19 19 <!--[if !IE]> --> 20 <object type="application/x-shockwave-flash" data="main.swf?t= 2" width="720" height="420">20 <object type="application/x-shockwave-flash" data="main.swf?t=3" width="720" height="460"> 21 21 <!-- <![endif]--> 22 22 23 23 <!--[if IE]> 24 <object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="640" height="4 20"24 <object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="640" height="460" 25 25 codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> 26 26 <param name="movie" value="main.swf" /> -
flex/derrick-av/main.mxml
r2038785 r72fdc64 1 1 <?xml version="1.0" encoding="iso-8859-1"?> 2 2 <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 3 width="720" height="4 20"3 width="720" height="460" 4 4 layout="absolute" 5 5 backgroundColor="#ffffff" … … 8 8 creationComplete="onAppInit()" > 9 9 10 <mx:HTTPService id="pubreq" resultFormat="text" 11 url="http://tac1.theartcollider.org/mcluhan/publish.php" 12 result="onPubOK(event)" 13 fault="onPubFault(event)" 14 concurrency="single" 15 method="POST" /> 16 10 17 <mx:Script> 11 18 <![CDATA[ … … 24 31 private var server:String; 25 32 private var password:String; 26 private var username:String; 33 private var username:String; 34 35 // video playback 36 private var nc:NetConnection; 37 private var ns:NetStream; 27 38 28 39 [Bindable] … … 32 43 private function onAppInit():void 33 44 { 34 var argv:Object = Application.application.parameters; 35 baseName=argv['name']; 45 //var argv:Object = Application.application.parameters; 46 //baseName=argv['name']; 47 baseName='McL'; 36 48 server="rtmp://188.165.42.118/rec-hq"; 37 49 username="4dc84c9279d0fcaa793eecfbc544cdbe7ea5f6e4"; 38 50 password="f78b64c9e0f2ea24fddce2b0d809cb2855fed1a6"; 39 51 br.enabled=false; 52 bp.enabled=false; 53 bu.enabled = false; 40 54 countrycodes = new ArrayCollection( [ 41 55 { id:'XXX', label:'Please select your country..'}, … … 302 316 } 303 317 318 private function avdeny():void { 319 br.enabled=false; 320 bp.enabled=false; 321 bu.enabled=false; 322 bc.enabled=false; 323 cc.enabled=false; 324 ta.enabled=false; 325 tt.enabled=false; 326 te.enabled=false; 327 tg.enabled=false; 328 Alert.show('You do need a camera for live streaming.\nPlease connect one and then reload this Page. It may also be that the camera is currently in use by another application: please close that app and reload.', 329 'No camera detected', mx.controls.Alert.OK); 330 } 331 332 private function onAvStatus(event:StatusEvent):void { 333 if (event.code == "Microphone.Muted"){ 334 avdeny(); 335 } 336 } 337 304 338 public function myinit():void { 305 339 cam = Camera.getCamera(); 306 340 mic = Microphone.getMicrophone(); 341 342 Security.showSettings("2"); 343 mic.addEventListener(StatusEvent.STATUS, this.onAvStatus); 344 307 345 if (!cam || !mic) { 308 br.enabled=false; 309 bc.enabled=false; 310 cc.enabled=false; 311 ta.enabled=false; 312 tt.enabled=false; 313 te.enabled=false; 314 tg.enabled=false; 315 Alert.show('You do need a camera for live streaming.\nPlease connect one and then reload this Page. It may also be that the camera is currently in use by another application: please close that app and reload.', 316 'No camera detected', mx.controls.Alert.OK); 317 return 346 avdeny(); 347 return; 318 348 } 319 349 … … 415 445 stream.close(); 416 446 conn.close(); 447 bp.enabled=true; 448 bu.enabled=true; 417 449 } 418 450 … … 425 457 tg.enabled=false; 426 458 br.enabled=true; 459 bp.enabled=false; 460 bu.enabled=false; 427 461 video.attachCamera(cam); 428 462 bc.label="Stop the Camera"; … … 443 477 if(br.selected) { 444 478 bc.enabled=false; 479 bp.enabled=false; 480 bu.enabled=false; 445 481 startConnection() 446 482 }else { … … 448 484 bc.enabled=true; 449 485 } 450 } 486 } 487 488 private function playStatusHandler(event:NetStatusEvent):void { 489 switch (event.info.code) { 490 case "NetStream.Buffer.Flush": 491 case "NetStream.Play.Start": 492 case "NetStream.Buffer.Full": 493 case "NetStream.Buffer.Empty": 494 case "NetStream.Seek.Notify": 495 break; 496 case "NetStream.Play.StreamNotFound": 497 Alert.show('error:\n'+event.info.code, 'Alert.', mx.controls.Alert.OK); 498 bp.enabled=false; 499 bu.enabled=false; 500 case "NetStream.Play.Stop": 501 bp.selected=false; 502 playBt(null); 503 break; 504 default: 505 //Alert.show('debug:\n'+event.info.code, 'Alert.', mx.controls.Alert.OK); 506 break; 507 } 508 } 509 510 public function playBt(event:Event):void { 511 512 bc.selected=false; 513 bc.enabled=false; 514 515 if(!bp.selected) { 516 if (ns) { 517 ns.seek(0); ns.pause(); 518 } 519 video.attachCamera(null); 520 video.mx_internal::videoPlayer.clear(); 521 bc.enabled=true; 522 br.enabled=true; 523 camBt(null); 524 return; 525 } 526 527 tt.enabled=false; 528 ta.enabled=false; 529 cc.enabled=false; 530 te.enabled=false; 531 tg.enabled=false; 532 br.enabled=false; 533 534 if (!uploadName) return; // XXX error? NO: BUG :) 535 536 nc = new NetConnection(); 537 nc.connect(null); 538 ns = new NetStream(nc); 539 ns.addEventListener(NetStatusEvent.NET_STATUS, playStatusHandler); 540 ns.play("http://tac1.theartcollider.org/mcluhan/data/"+uploadName+".flv"); 541 video.mx_internal::videoPlayer.attachNetStream(ns); 542 video.mx_internal::videoPlayer.visible = true; 543 } 544 545 private function onPubOK(event:ResultEvent):void { 546 Alert.show('The video was registered and is queued for moderation. If you have any questions do not hesitate to contact mcmovie@digitalrumors.net.', 'Publication successful', mx.controls.Alert.OK); 547 bu.enabled = false; 548 } 549 550 private function onPubFault(event:FaultEvent):void { 551 Alert.show('The request for publication failed. Please contacter mcmovie@digitalrumors.net', 552 'Publication failed', mx.controls.Alert.OK); 553 bu.enabled = false; 554 } 555 556 public function pubBt(event:Event):void { 557 pubreq.send({file:uploadName}); 558 } 451 559 452 560 ]]> … … 475 583 </mx:Text> 476 584 477 <mx:Box direction="vertical" width="100%" height="3 50" id="welcome" visible="true" x="0" y="30">585 <mx:Box direction="vertical" width="100%" height="390" id="welcome" visible="true" x="0" y="30"> 478 586 <mx:Spacer height="100%"/> 479 587 <mx:Box direction="horizontal"> … … 498 606 </mx:Box> 499 607 500 <mx:Box direction="horizontal" width="100%" height="3 50" id="mainrec" visible="false" x="0" y="40">608 <mx:Box direction="horizontal" width="100%" height="390" id="mainrec" visible="false" x="0" y="40"> 501 609 <mx:VBox width="330" height="100%"> 502 610 <mx:Text width="320"> … … 545 653 <mx:Text width="340"> 546 654 <mx:htmlText> 547 <![CDATA[<b>Step 4</b>: Start recording]]>655 <![CDATA[<b>Step 4</b>: Record Video]]> 548 656 </mx:htmlText> 549 657 </mx:Text> 550 658 <mx:Button id="br" toggle="true" change="recBt(event)" label="Start Recording"/> 659 <mx:Text width="340"> 660 <mx:htmlText> 661 <![CDATA[<b>Step 5</b>: Verify recording]]> 662 </mx:htmlText> 663 </mx:Text> 664 <mx:Box direction="horizontal" > 665 <mx:Button id="bp" toggle="true" change="playBt(event)" label="Playback"/> 666 <mx:Button id="bu" click="pubBt(event)" label="Publish"/> 667 </mx:Box> 551 668 </mx:VBox> 552 669 </mx:Box> 553 670 554 <mx:Text width="100%" styleName="footer" x="0" y="4 00">671 <mx:Text width="100%" styleName="footer" x="0" y="440"> 555 672 <mx:htmlText> 556 673 <![CDATA[© 2011 CITU.fr, robin@gareus.org]]>
