![]() |
|
||||||||||
|
|||||
|
[+3 26.05.13]
[+1 26.05.13] Регистрация: May 2013
Сообщений: 2
|
Доброго времени суток форумчане!
Помогите с написанием p2p flash video чата, хочется сделать что то на подобии www.videochatru.com, но у меня мало что получается. Искал в гугле, нашел десятки видео чатов, но они не работали нормально (не было двусторонней связи). Да и сам я мало знаю этот язык. Буду благодарен если поможете)) |
|
|||||
|
Регистрация: Mar 2013
Сообщений: 32
|
Изучайте документацию, сайт http://tomkrcha.com/, там масса полезной информации.
Создание подобных приложений - это серьезные коммерческие проекты. Достаточно взглянуть на сегодняшнюю вакансию: http://www.flasher.ru/forum/showthread.php?t=199417 Просто так исходники вам вряд ли кто-то даст. Так что изучайте материалы, начинайте создавать каркас, а дальше обращайтесь с частными вопросами. |
|
|||||
|
Регистрация: Dec 2006
Сообщений: 1,764
|
nurique что не получается, выкладывай сюда, ошибки, куски кода, помогут, а то что сейчас хотите, это называется - сделайте за меня
__________________
а за окном атлантический океан! |
|
|||||
|
[+3 26.05.13]
[+1 26.05.13] Регистрация: May 2013
Сообщений: 2
|
начал делать)) или ***))
но flash builder ругается на эту строку public class chat extends Application implements IStateClient2, мол классы не должны быть вложены для полного обзора выкладываю все что у меня есть видеочат import spark.components.Application; import mx.core.IStateClient2; import org.softservice.web.classes.utils.FlashVarsHandler; import com.skins.Converter; import mx.core.IFlexModuleFactory; import com.MyVideo; import com.ClientVideo; import com.ServerAgent; import com.ScriptAgent; import com.TextAgent; import flash.net.URLLoader; import flash.display.LoaderInfo; import com.LocalSettings; import flash.display.StageScaleMode; import flash.display.StageAlign; import flash.events.Event; import flash.events.KeyboardEvent; import flash.events.ProgressEvent; import flash.events.IOErrorEvent; import flash.media.Sound; import flash.net.URLRequest; import mx.events.FlexEvent; import flash.net.URLVariables; import flash.utils.setTimeout; import com.utils.XMLDictionary; import flash.events.MouseEvent; import flash.ui.Keyboard; import flash.utils.ByteArray; import flash.external.ExternalInterface; import mx.binding.BindingManager; import com.skins.ConverterSkin; import mx.core.mx_internal; import mx.styles.CSSStyleDeclaration; import mx.styles.CSSCondition; import mx.styles.CSSSelector; import mx.events.PropertyChangeEvent; import mx.core.DeferredInstanceFromFunction; import mx.states.State; use namespace mx_internal; public class chat extends Application implements IStateClient2 { public function chat() { super(); this.minWidth=20; this.minHeight=20; this.width=850; this.height=640; this.currentState="normal"; this.mxmlContentFactory=new DeferredInstanceFromFunction(this._chat_Array2_c); this.addEventListener("applicationComplete",this.___chat_Application1_applicationComplete); states=[new State( { name:"normal", overrides:[] } )]; } public static var FlashVars:FlashVarsHandler; private static var _skinParts:Object = { contentGroup:false, controlBarGroup:false }; private var _349730400converter:Converter; private var __moduleFactoryInitialized:Boolean = false; override public function set moduleFactory(param1:IFlexModuleFactory) : void { super.moduleFactory=param1; if(this.__moduleFactoryInitialized) { return; } this.__moduleFactoryInitialized=true; mx_internal::_chat_StylesInit(); } override public function initialize() : void { super.initialize(); } private var version:String = "> Current version is 1.2 at 27/04/2010"; public var myVideo:MyVideo; public var clientVideo:ClientVideo; public var serverAgent:ServerAgent; public var scriptAgent:ScriptAgent; public var textAgent:TextAgent; private var user_name:String = "host-7"; private var stream_url:String = "rtmp://chatroulette.online-webcam.net:1935/videoroulette"; private var dataLoader:URLLoader; private var stratus_url:String = "rtmfp://stratus.adobe.com/"; private var stratus_key:String = "e6193da0edee53ef31612bd5-456f466f147d"; private function init() : void { FlashVars=new FlashVarsHandler(LoaderInfo(this.loaderInfo).parameters); this.user_name=FlashVars.getString("user_name",""); this.stream_url=FlashVars.getString("stream_url","rtmp://chatroulette.online-webcam.net:1935/videoroulette"); if(LocalSettings.my_id=="") { GlobalScript.param["my_connect_id"]=this.user_name; LocalSettings.my_id=GlobalScript.param["my_connect_id"]; } else { GlobalScript.param["my_connect_id"]=LocalSettings.my_id; } GlobalScript.param["client_connect_id"]=""; GlobalScript.param["client_connect_id_last"]=""; GlobalScript.param["my_malefemale"]=""; GlobalScript.param["client_malefemale"]=""; GlobalScript.param["pairIP"]=""; this.stage.scaleMode=StageScaleMode.NO_SCALE; this.stage.align=StageAlign.TOP_LEFT; this.stage.addEventListener(Event.RESIZE,this.stageResizeHandler); this.stage.addEventListener(KeyboardEvent.KEY_DOWN,this.globalKeyDownHandler); this.dataLoader=new URLLoader(); this.dataLoader.addEventListener(Event.COMPLETE,this.onDataLoadComplete); this.dataLoader.addEventListener(ProgressEvent.PROGRESS,this.onDataLoadProgressHandler); this.dataLoader.addEventListener(IOErrorEvent.IO_ERROR,this.onDataLoadError); GlobalScript.param["stratus_url"]=this.stratus_url; GlobalScript.param["stratus_key"]=this.stratus_key; GlobalScript.param["connected_with_ban_client"]=false; GlobalScript.param["stream_url"]=this.stream_url; GlobalScript.param["sharedObjectName"]=""; GlobalScript.param["myStreamName"]=""; GlobalScript.param["pairStreamName"]=""; GlobalScript.param["stratus_my_id"]=""; GlobalScript.param["stratus_pair_id"]=""; GlobalScript.param["stratus_outgoingStream_connected"]=false; GlobalScript.param["stratus_incomingStream_connected"]=false; GlobalScript.param["stratus_client"]=false; GlobalScript.param["use_debug"]=false; GlobalScript.param["use_dump"]=false; GlobalScript.param["use_stratus"]=true; GlobalScript.param["camera_fps"]=15; GlobalScript.param["camera_bps"]=96000; GlobalScript.param["camera_quality"]=93; GlobalScript.param["ping_time"]=3000; GlobalScript.param["ping_count"]=1; GlobalScript.param["sndConnect"]=new Sound(); GlobalScript.param["sndMsgRec"]=new Sound(); GlobalScript.param["sndMsgSent"]=new Sound(); GlobalScript.param["sndConnect"].load(new URLRequest("assets/sndConnect.mp3")); GlobalScript.param["sndMsgRec"].load(new URLRequest("assets/sndMsgRec.mp3")); GlobalScript.param["sndMsgSent"].load(new URLRequest("assets/sndMsgSent.mp3")); this.converter.ob_input.addEventListener(FlexEvent.ENTER,this.ob_inputEnter); var _loc1_:URLRequest = new URLRequest("assets/settings.xml"); var _loc2_:URLVariables = new URLVariables(); _loc2_.nocache=new Date().getTime(); _loc1_.data=_loc2_; this.dataLoader.load(_loc1_); } private function ob_inputEnter(param1:FlexEvent) : void { if(this.serverAgent.connected) { if(this.converter.ob_input.text.indexOf("#version")==0) { this.textAgent.addText("",this.version,GlobalScript.Dictionary.getText("text-color-you",""),GlobalScript.Dictionary.getText("text-message-color-system","")); } else { this.serverAgent.addMyMessageToRSO(this.converter.ob_input.text); } this.converter.ob_input.text=""; this.converter.ob_input.editable=false; setTimeout(this.timeBlockTimer,30); } } public function timeBlockTimer() : void { this.converter.ob_input.editable=true; } private function onDataLoadComplete(param1:Event) : void { var _loc2_:XML = new XML(this.dataLoader.data); GlobalScript.Dictionary=new XMLDictionary(_loc2_); this.setLanguage(); this.myVideo=new MyVideo(this.converter.previewYou,this.converter,this); this.clientVideo=new ClientVideo(this.converter.previewStranger,this.converter,this); this.serverAgent=new ServerAgent(); this.textAgent=new TextAgent(this.converter.ob_chat,this.converter.ob_input); this.textAgent.addTextCDATA(GlobalScript.Dictionary.getText("text-onload","")); this.scriptAgent=new ScriptAgent(this.converter,this); GlobalScript.param["traceTextArea"]=this.converter.ob_trace; this.converter.ob_trace_clear.addEventListener(MouseEvent.CLICK,this.ob_trace_clearHandler); this.converter.tryingP2P.text=""; this.converter.totalUsers.text=GlobalScript.Dictionary.getText("text-online-users","Online users: %1").replace("%1","0"); if(GlobalScript.param["use_debug"]) { GlobalScript.param["traceTextArea"].visible=true; GlobalScript.param["traceTextArea"].enabled=true; this.converter.ob_trace_clear.visible=true; this.converter.ob_trace_clear.enabled=true; this.converter.ob_ban_clear.visible=true; this.converter.ob_ban_clear.enabled=true; } this.DrawSkin(); if(LocalSettings.cb_autostart) { this.converter.bt_play.label=GlobalScript.Dictionary.getText("menu-nextcam","Next Cam (F9)"); this.converter.bt_play.enabled=true; this.doConnect(); } } private function setLanguage() : void { this.converter.bt_play.label=GlobalScript.Dictionary.getText("menu-startchat","Start Chat"); this.converter.bt_stop.label=GlobalScript.Dictionary.getText("menu-stop","Stop (F8)"); this.converter.bt_ban.label=GlobalScript.Dictionary.getText("menu-ban","Ban"); this.converter.cb_camrequired.label=GlobalScript.Dictionary.getText("menu-camrequired","Cam required"); this.converter.cb_autoreconnect.label=GlobalScript.Dictionary.getText("menu-autoreconnect","Auto reconnect"); this.converter.cb_autostart.label=GlobalScript.Dictionary.getText("menu-autostart","Auto start"); this.converter.cb_sounds.label=GlobalScript.Dictionary.getText("menu-chatsounds","Chat sounds"); this.converter.cb_clean.label=GlobalScript.Dictionary.getText("menu-cleanchatlog","Clean chatlog"); this.converter.bt_report.label=GlobalScript.Dictionary.getText("menu-report","Report"); this.converter.fm_text2.text=GlobalScript.Dictionary.getText("menu-iam","I am"); this.converter.fm_text.text=GlobalScript.Dictionary.getText("menu-seekingfor","seeking for"); this.converter.str_receive.text=GlobalScript.Dictionary.getText("menu-receive","Receive:"); this.converter.str_speaker.text=GlobalScript.Dictionary.getText("menu-speaker","Speaker:"); this.converter.you_cam.text=GlobalScript.Dictionary.getText("menu-cam","Cam:"); this.converter.you_mic2.text=GlobalScript.Dictionary.getText("menu-mic","Mic:"); this.converter.you_send.text=GlobalScript.Dictionary.getText("menu-send","Send:"); this.converter.you_mic.text=GlobalScript.Dictionary.getText("menu-mic","Mic:"); this.converter.str_video.label=GlobalScript.Dictionary.getText("menu-video","Video"); this.converter.str_audio.label=GlobalScript.Dictionary.getText("menu-audio","Audio"); this.converter.you_video.label=GlobalScript.Dictionary.getText("menu-video","Video"); this.converter.you_audio.label=GlobalScript.Dictionary.getText("menu-audio","Audio"); } private function ob_trace_clearHandler(param1:MouseEvent) : void { GlobalScript.param["traceTextArea"].text=""; } private function onDataLoadProgressHandler(param1:ProgressEvent) : void { } private function onDataLoadError(param1:IOErrorEvent) : void { } private function globalKeyDownHandler(param1:KeyboardEvent) : void { if(param1.keyCode==Keyboard.F9) { this.doConnect(); } } public function doConnect() : void { this.myVideo.attachCameraFirst(); this.serverAgent.doConnect(this.stream_url); } public function closeConnection() : void { this.serverAgent.closeConnection(); } public function doPairBan() : void { this.serverAgent.doPairBan(); } public function doSavePictures(param1:ByteArray) : void { this.serverAgent.doSavePictures(param1); } private function stageResizeHandler(param1:Event) : void { this.DrawSkin(); } private function DrawSkin() : void { if(ExternalInterface.available) { ExternalInterface.addCallback("f_clientWidthHeight",this.f_clientWidthHeight); ExternalInterface.call("doResize"); } else { this.f_clientWidthHeight(this.stage.stageWidth,this.stage.stageHeight,this.stage.stageWidth,this.stage.stageHeight); } } public function updateTextScrolling() : void { this.textAgent.updateTextScrolling(); } public function f_clientWidthHeight(param1:Number, param2:Number, param3:Number, param4:Number) : void { GlobalScript.tracer.dump("f_clientWidthHeight "+param1+" "+param2+" "+param3+" "+param4+" "+isNaN(param1)+" "+isNaN(param2)); var _loc5_:Number = param3; var _loc6_:Number = param4; this.converter.back.width=_loc5_; this.converter.back.height=_loc6_; if(isNaN(param1)) { param1=param3; } if(isNaN(param2)) { param2=param4; } if(this.converter.cb_autoreconnect.x+this.converter.cb_autoreconnect.width>_loc5_) { this.converter.cb_autoreconnect.visible=false; } else { this.converter.cb_autoreconnect.visible=true; } if(this.converter.cb_camrequired.x+this.converter.cb_camrequired.width>_loc5_) { this.converter.cb_camrequired.visible=false; } else { this.converter.cb_camrequired.visible=true; } if(this.converter.bt_stop.x+this.converter.bt_stop.width>_loc5_) { this.converter.bt_stop.visible=false; } else { this.converter.bt_stop.visible=true; } if(this.converter.bt_play.x+this.converter.bt_play.width>_loc5_) { this.converter.bt_play.visible=false; } else { this.converter.bt_play.visible=true; } if(this.converter.bt_ban.x+this.converter.bt_ban.width>_loc5_) { this.converter.bt_ban.visible=false; } else { this.converter.bt_ban.visible=true; } var _loc7_:Number = 180; var _loc8_:Number = 180; var _loc9_:Number = param1-380-36; var _loc10_:Number = param2-40-50; if(_loc9_<_loc7_) { _loc9_=_loc7_; } if(_loc10_<_loc8_) { _loc10_=_loc8_; } this.converter.ob_chat_group.width=_loc9_; this.converter.ob_chat_group.height=_loc10_; this.converter.ob_chat_border.width=_loc9_; this.converter.ob_chat_border.height=_loc10_; this.converter.ob_chat_scroller.width=_loc9_; this.converter.ob_chat_scroller.height=_loc10_; this.converter.ob_chat.width=_loc9_; this.converter.ob_chat.height=this.converter.ob_chat.textHeight; this.converter.ob_input.width=_loc9_; this.converter.ob_input.y=this.converter.ob_chat_scroller.y+this.converter.ob_chat_scroller.height+15; this.converter.totalUsers.x=_loc5_-this.converter.totalUsers.width-36; setTimeout(this.updateTextScrolling,20); } private function _chat_Array2_c() : Array { var _loc1_:Array = [this._chat_Converter1_i()]; BindingManager.executeBindings(this,"temp",_loc1_); return _loc1_; } private function _chat_Converter1_i() : Converter { var _loc1_:Converter = new Converter(); _loc1_.setStyle("skinClass",ConverterSkin); _loc1_.id="converter"; if(!_loc1_.document) { _loc1_.document=this; } this.converter=_loc1_; BindingManager.executeBindings(this,"converter",this.converter); return _loc1_; } public function ___chat_Application1_applicationComplete(param1:FlexEvent) : void { this.init(); } mx_internal var _chat_StylesInit_done:Boolean = false; mx_internal function _chat_StylesInit() : void { var _loc1_:CSSStyleDeclaration = null; var _loc2_:Array = null; var _loc3_:Array = null; var _loc4_:CSSCondition = null; var _loc5_:CSSSelector = null; if(mx_internal::_chat_StylesInit_done) { return; } mx_internal::_chat_StylesInit_done=true; styleManager.initProtoChainRoots(); } override protected function get skinParts() : Object { return _skinParts; } public function get converter() : Converter { return this._349730400converter; } public function set converter(param1:Converter) : void { var _loc2_:Object = this._349730400converter; if(_loc2_!==param1) { this._349730400converter=param1; if(this.hasEventListener("propertyChange")) { this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"converter",_loc2_,param1)); } } } } Последний раз редактировалось mooncar; 26.05.2013 в 13:06. |
|
|||||
|
Модрон-ветеринар
|
nurique, вы правила форума читали вообще?
1. Мат. 2. Нарушение чужих авторских прав (декомпил). 3. Файл добавляются в сообщение, а не выкладываются на внешних ресурсах. Тема закрыта.
__________________
Идите первым! |
![]() |
![]() |
Часовой пояс GMT +4, время: 08:39. |
|
|
« Предыдущая тема | Следующая тема » |
|
|