- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Here's the code Hironmay, if you change it to <s:Application> it throws an error at line 4.
If I run this as it is I get a whole bunch of error warnings in a pop-up panel, so not sure what that's about.
I did insert all my id and room url's in the one on my computer by the way - they are blank in the code below.
Would you be able to give me a clue as to what "Stream ID" and "Publisher ID" refer to. I know this is a lot to ask but for beginners there really is a lot to learn here. I sense that a beginners book might be in order here!!
Ian
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
xmlns:rtc="http://ns.adobe.com/rtc"
xmlns:s="library://ns.adobe.com/flex/spark">
<mx:Script>
<![CDATA[
/**********************************************************
* ADOBE SYSTEMS INCORPORATED
* Copyright 2010 Adobe Systems Incorporated
* All Rights Reserved.
* NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the
* terms of the Adobe license agreement accompanying it.If you have received this file from a
* source other than Adobe, then your use, modification, or distribution of it requires the prior
* written permission of Adobe.
* *********************************/
import com.adobe.rtc.events.AddInLauncherEvent;
import com.adobe.rtc.events.StreamEvent;
import com.adobe.rtc.sharedManagers.descriptors.UserDescriptor;
/* import com.adobe.rtc.collaboration.ScreenSharePublisher;
protected var _sspublisher:ScreenSharePublisher;
public function init():void
{
/* launch it from actionscript
_sspublisher = new ScreenSharePublisher();
addChild(_sspublisher);
_sspublisher.publish();
//trace("streamManager: " + cSession.streamManager.sharedID);
}
*/
private function startSS():void
{
if(sspublisher != null && !sspublisher.isPublishing) {
sspublisher.addEventListener(StreamEvent.STREAM_RECEIVE, onStreamReceived);
sspublisher.addEventListener(AddInLauncherEvent.STOP, onAddinStop);
//sspublisher.addEventListener(StreamEvent.STREAM_DELETE, onStreamDelete);
sspublisher.publish();
startss_bt.enabled = false;
stopss_bt.enabled = true;
pause_bt.enabled = true;
pause_bt.label = "Pause Screen Sharing";
}
}
private function stopSS():void
{
if(sspublisher != null && sspublisher.isPublishing) {
sspublisher.stop(publisherid.text);
startss_bt.enabled = true;
stopss_bt.enabled = false;
pause_bt.enabled = false;
publisherid.text = "";
streamid.text = "";
}
}
// addin cancelled
private function onAddinStop(p_evt:AddInLauncherEvent):void{
startss_bt.enabled = true;
stopss_bt.enabled = false;
pause_bt.enabled = false;
publisherid.text = "";
streamid.text = "";
}
private function pauseSS():void
{
if(sspublisher != null && sspublisher.isPublishing) {
if(pause_bt.label == "Pause Screen Sharing") {
sspublisher.pause(true);
pause_bt.label = "Resume Screen Sharing";
}
else{
sspublisher.pause(false);
pause_bt.label = "Pause Screen Sharing";
}
}
}
private function onStreamDelete(p_evt:StreamEvent):void
{
if(p_evt.streamDescriptor.streamPublisherID == publisherid.text && sspublisher.isPublishing)
{
sspublisher.stop(p_evt.streamDescriptor.streamPublisherID);
startss_bt.enabled = true;
stopss_bt.enabled = false;
pause_bt.enabled = false;
}
}
private function onStreamReceived(p_evt:StreamEvent):void
{
var publisherDescriptor:UserDescriptor = null;
if(p_evt.streamDescriptor.originalScreenPublisher != null)
publisherDescriptor = cSession.userManager.getUserDescriptor(p_evt.streamDescriptor.originalScreenPublisher);
else
publisherDescriptor = cSession.userManager.getUserDescriptor(p_evt.streamDescriptor.streamPublisherID);
var myDescriptor:UserDescriptor = cSession.userManager.getUserDescriptor(cSession.userManager.myUserID);
if(publisherDescriptor.displayName == myDescriptor.displayName ||
publisherDescriptor.userID.indexOf(myDescriptor.userID) >= 0){
publisherid.text = p_evt.streamDescriptor.originalScreenPublisher;
streamid.text = p_evt.streamDescriptor.id;
}
}
]]>
</mx:Script>
<!--
You would likely use external authentication here for a deployed application;
you would certainly not hard code Adobe IDs here.
-->
<rtc:AdobeHSAuthenticator
id="auth" userName="" password=""/>
<rtc:ConnectSessionContainer backgroundAlpha="0.0" roomURL="" id="cSession" authenticator="{auth}" width="100%" height="100%">
<mx:Canvas width="100%" height="100%">
<rtc:ScreenSharePublisher id="sspublisher" playerVersion="10"/>
<mx:VBox width="100%" height="100%" horizontalAlign="center">
<mx:VBox width="50%" height="50%" horizontalAlign="center" verticalAlign="middle">
<mx:Label text="Stream ID:"/><mx:TextInput id="streamid" text=""/>
<mx:Label text="Publisher User ID:"/><mx:TextInput id="publisherid" text=""/>
</mx:VBox>
<mx:HBox width="50%" height="50%" horizontalAlign="center" verticalAlign="middle">
<mx:Button id="startss_bt" label="Start Screen Sharing" click="startSS()"/>
<mx:Button id="pause_bt" label="Pause Screen Sharing" click="pauseSS()" enabled="false"/>
<mx:Button id="stopss_bt" label="Stop Screen Sharing" click="stopSS()" enabled="false"/>
</mx:HBox>
</mx:VBox>
</mx:Canvas>
</rtc:ConnectSessionContainer>
</mx:Application>
Views
Replies
Total Likes