Created
June 2, 2014 07:14
-
-
Save shvyrev/bdb1148da29b874aa9db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" | |
width="100%" height="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off" | |
xmlns:model="datech.comdi.model.*" xmlns:layouts="datech.comdi.ui.layouts.*" | |
xmlns:panels="datech.comdi.ui.panels.*" | |
preloader="datech.comdi.ui.components.preloader.ComdiPreloader" | |
backgroundColor="0xb8babf" | |
initialize="initPlayer()" xmlns:player="datech.comdi.ui.components.player.*" | |
xmlns:external="datech.comdi.external.*" xmlns:settings="datech.comdi.settings.*" | |
xmlns:utils="datech.comdi.utils.*"> | |
<mx:Script> | |
<![CDATA[ | |
import datech.comdi.net.ComdiNetConnection; | |
import mx.controls.Alert; | |
import ru.webinar.app.net.WebinarConnection; | |
import ru.webinar.record.WebinarRecordLogFacade; | |
private static const NO_WEBINAR:String = "status.NO_WEBINAR"; | |
private static const WEBINAR_ID:String = "webinarId"; | |
private static const PLAYER_SERVER:String = "playerServer"; | |
private static const PLAYER_OFFSET:String = "playerOffset"; | |
private static const PLAYER_DURATION:String = "playerDuration"; | |
private static const HIDE_TIMELINE:String = "hideTimeline"; | |
private static const EDIT:String = "edit"; | |
private static const ALLOW_SEEK:String = "allowSeek"; | |
private static const EDITKEY:String = "editkey"; | |
private var started:Boolean = false; | |
private function initPlayer():void { | |
comdi.user.id = "player"; | |
comdi.isPlayer = true; | |
} | |
private function isStarted(ready:Boolean):Boolean { | |
WebinarRecordLogFacade.debug = true; | |
params.setProperty("webinarId", "299928"); | |
params.setProperty("playerServer", "live-sd.webinar.ru"); | |
params.setProperty("api", "http://api.webinar.ru"); | |
params.setProperty("sessionId", "e297b7499254f26a67f238409aaf03a3"); | |
params.setProperty("playerOffset", "2433"); | |
params.setProperty("playerDuration", ""); | |
if (!started && ready) { | |
started = true; | |
startPlayer(); | |
} | |
return started; | |
} | |
private function startPlayer():void { | |
var id:String = params.hasProperty(WEBINAR_ID) ? params.getProperty(WEBINAR_ID) : ""; | |
var server:String = params.hasProperty(PLAYER_SERVER) ? params.getProperty(PLAYER_SERVER) : ""; | |
player.offset = params.hasProperty(PLAYER_OFFSET) ? int(params.getProperty(PLAYER_OFFSET)) * 1000 : 0; | |
player.duration = params.hasProperty(PLAYER_DURATION) ? int(params.getProperty(PLAYER_DURATION)) * 1000 : 0; | |
player.hideTimeline = ComdiParameters.getBoolean(params.getProperty(HIDE_TIMELINE)); | |
player.edit = ComdiParameters.getBoolean(params.getProperty(EDIT)); | |
player.editkey = params.getProperty(EDITKEY); | |
player.scrollMode = ComdiParameters.getBoolean(params.getProperty(ALLOW_SEEK), true); | |
comdi.webinar.id = id; | |
comdi.webinar.twitterModule.twitts.cumulative = true; | |
comdi.webinar.notes.notes.cumulative = true; | |
comdi.webinar.questionsModule.questions.cumulative = true; | |
if (server) { | |
comdi.isPlayerServer = true; | |
var conn:ComdiNetConnection = comdi.playerConnection; | |
conn.client.addCommand("onConnect", onConnect); | |
conn.client.addCommand("onLog", onLog); | |
conn.connect("rtmp://" + server + "/player/" + id); | |
comdi.room.connect("rtmp://" + server + "/media/" + id); | |
} else { | |
view.visible = true; | |
player.loadFile("webinar.log"); | |
//"webinar.log" | |
} | |
var api:String = ComdiParameters.instance.hasProperty("api") ? ComdiParameters.instance.getProperty("api") : "http://api.webinar.ru"; | |
WebinarConnection.instance.session.webinarId = id; | |
player.loadLog(api + "/event/" + id + "/log.json?sessionId=" + encodeURIComponent(WebinarConnection.instance.session.sessionId)); | |
} | |
private function onConnect():void { | |
comdi.playerConnection.netConnection.call("getLog", null); | |
} | |
private function onLog(items:Array = null):void { | |
if (items) { | |
view.visible = true; | |
player.setLogContent(items); | |
} else { | |
setTimeout(onError, 1000); | |
} | |
} | |
private function onError():void { | |
Alert.show(locale[NO_WEBINAR], "", 4, null); | |
} | |
]]> | |
</mx:Script> | |
<mx:Metadata> | |
[SWF(backgroundColor="#b8babf")] | |
</mx:Metadata> | |
<mx:Style source="/assets/css/style.css"/> | |
<model:Comdi id="comdi"/> | |
<external:ComdiParameters id="params" application="{this}"/> | |
<external:ComdiLocale id="locale" localeByParam="{params.ready ? params.lang : null}"/> | |
<settings:ComdiLocalSettings id="prefs"/> | |
<utils:UncaughtErrorCapturer/> | |
<mx:Canvas width="100%" height="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off" cacheAsBitmap="true"> | |
<mx:Box color="0xb8babf" backgroundColor="0xb8babf" width="100%" height="100%"/> | |
</mx:Canvas> | |
<mx:Canvas width="100%" height="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off" | |
visible="{isStarted(params.ready)}"> | |
<mx:VBox id="view" width="100%" height="100%" minWidth="800" minHeight="600" verticalScrollPolicy="off" | |
horizontalScrollPolicy="off" visible="false"> | |
<mx:ViewStack width="100%" height="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off" | |
visible="{comdi.isPlayer}" | |
selectedIndex="{params.ready ? 1 : 0}"> | |
<mx:Canvas width="100%" height="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off"/> | |
<panels:ComdiCanvas width="100%" height="100%"> | |
<layouts:ComdiWorkspaceLayout id="workspace" width="100%" height="100%" verticalScrollPolicy="off" | |
horizontalScrollPolicy="off"/> | |
<!--<panels:DebugPanel id="debugPanel" close="debugPanel.visible=false"/>--> | |
</panels:ComdiCanvas> | |
</mx:ViewStack> | |
<mx:VBox width="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off" paddingBottom="10" | |
paddingLeft="10" paddingRight="10"> | |
<player:ComdiPlayer id="player" width="100%" baloon="{baloon}"/> | |
</mx:VBox> | |
</mx:VBox> | |
<player:CommentBaloon id="baloon" visible="false" showEffect="Fade" hideEffect="Fade"/> | |
</mx:Canvas> | |
<mx:Binding source="workspace.cameraModule" destination="player.infoscroll.cameraBox.panel"/> | |
<mx:Binding source="workspace.previewModule" destination="player.infoscroll.presentationBox.panel"/> | |
<mx:Binding source="workspace.chatModule" destination="player.infoscroll.chatBox.panel"/> | |
</mx:Application> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment