���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /usr/local/FlashphonerWebCallServer/client/examples/demo/rtmfp-client/chat/src/ |
<?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" xmlns:views="rtmfptest.views.*" backgroundColor="#F2F0F0" width="415" height="548" creationComplete="init()" xmlns:local="*"> <fx:Declarations> </fx:Declarations> <fx:Style> .header { fontSize: 36px; } </fx:Style> <fx:Script> <![CDATA[ import flash.external.*; import mx.core.UIComponent; private var nc:NetConnection; private var cam:Camera; private var mic:Microphone; private var videoFarEnd:Video; private var publishStream:NetStream; private var subscribeStream:NetStream; private var subscribeStreamObject:Object; private function init():void{ Logger.info("INIT FLASH CHAT"); if (ExternalInterface.available) { try { ExternalInterface.addCallback("setURLtoFlash", getDataFromJS); } catch (error:Error) { Logger.info(error.message); } } else { Logger.info("Error during set callback"); } } /** * ************************** * CONNECT / DISCONNECT * ************************** **/ private function connect():void{ Logger.info("connect"); var url:String = connectUrl.text; nc = new NetConnection(); nc.client = this; nc.addEventListener(NetStatusEvent.NET_STATUS, handleConnectionStatus); var obj:Object = new Object(); obj.login = login.text; obj.appKey = "flashChatApp"; nc.connect(url,obj); connectBtn.enabled = false; } //disconnect private function disconnect():void{ nc.close(); } private function handleConnectionStatus(event:NetStatusEvent):void{ Logger.info("handleConnectionStatus: "+event.info.code); if (event.info.code=="NetConnection.Connect.Success"){ Logger.info("Connection opened"); disconnectBtn.enabled = true; sendBtn.enabled = true; } else if (event.info.code=="NetConnection.Connect.Closed"){ nc.removeEventListener(NetStatusEvent.NET_STATUS,handleConnectionStatus); Logger.info("Connection closed"); connectBtn.enabled = true; disconnectBtn.enabled = false; sendBtn.enabled = false; } } /** * ************************* * SEND / RECEIVE CHAT MESSAGE * ************************* **/ private function sendMessage():void{ var date:Date = new Date(); var hours = (date.hours<10) ? '0'+date.hours : date.hours; var minutes = (date.minutes<10) ? '0'+date.minutes : date.minutes; var messageDate:String = hours + ":" + minutes; var message:Object = new Object(); message.body = messageText.text message.to = To.text; nc.call("sendData",null,{operationId:null, payload:message, status:null}); chatArea.text += messageDate + " " + login.text + " - " + message.body+"\n"; messageText.text = ""; } public function ping():void{ nc.call("pong", null); } public function OnDataEvent(data:Object):void{ var date:Date = new Date(); var hours = (date.hours<10) ? '0'+date.hours : date.hours; var minutes = (date.minutes<10) ? '0'+date.minutes : date.minutes; var messageDate:String = hours + ":" + minutes; var message:Object = data.payload; chatArea.text += messageDate + " " + message.from + " - " + message.body + "\n"; } /** * **************************** * HANDLE CONNCTION STATE * **************************** **/ private function handleStreamStatus(event:NetStatusEvent):void{ Logger.info("handleStreamStatus: "+event.info.code); if (event.info.code == "NetStream.Publish.BadName"){ Logger.info("Bad streamName. Please publish stream with other name"); }else if (event.info.code == "NetStream.Unpublish.Success"){ publishStream.removeEventListener(NetStatusEvent.NET_STATUS, handleStreamStatus); publishStream=null; } } private function handleSubscribeStreamStatus(event:NetStatusEvent):void{ Logger.info("handleSubscribeStreamStatus: "+event.info.code); } private function asyncErrorHandler(event: AsyncErrorEvent):void{ Logger.info("asyncErrorHandler: "+event); } private function securityErrorHandler(event: SecurityErrorEvent):void{ Logger.info("securityErrorHandler: "+event); } /** ************************* * JavaScript callbacks ************************* **/ private function getDataFromJS(value:String):void { if (value != null || value != "") { connectUrl.text = value; } } ]]> </fx:Script> <s:Label x="111" y="40" styleName="header" text="Flash Chat"/> <!-- connect / disconnect --> <s:Button id="connectBtn" x="200" y="158" width="86" label="Login" click="connect()"/> <s:TextInput id="login" x="42" y="158" width="150" height="21" text="Bob"/> <s:Button id="disconnectBtn" x="294" y="158" label="Logout" click="disconnect()" width="86" enabled="false"/> <s:TextInput id="connectUrl" x="42" y="109" width="200" text="rtmfp://192.168.1.5:1936/live2"/> <!-- chat --> <s:TextArea id="messageText" x="39" y="452" width="251" height="67" text="Hey!"/> <s:Button id="sendBtn" x="311" y="452" height="67" label="Send" click="sendMessage()" enabled="false"/> <s:TextArea id="chatArea" x="39" y="214" width="341" height="136" editable="false" text=""/> <s:TextInput id="To" x="40" y="404" width="251" text="Alice"/> <s:Label x="40" y="384" width="24" text="To:"/> <s:Label x="39" y="432" width="89" text="Your message:"/> <s:Label x="38" y="198" width="89" text="Your chat:"/> <s:Label x="42" y="139" width="89" text="Your name:"/> <s:Label x="42" y="93" width="89" text="Server:"/> </s:Application>