.tmp_B9C796008065D6DA3B51DD73E2B0B3A0_Extensions-$173.lzx
<canvas debug="true">
<view name="sharingViewTest" bgcolor="red" x="0" y="0" width="1000" height="1000">
<switch>
<when property="$as3">
<passthrough>
import flash.external.ExternalInterface;
import flash.media.*;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.NetStatusEvent;
import flash.net.NetStreamPlayOptions;
import flash.net.NetStreamPlayTransitions;
</passthrough>
</when>
</switch>
<attribute name="_nc" value="null
"/>
<attribute name="_nsPlay" value="null
"/>
<attribute name="defaultURL" value="rtmp://10.192.151.200:1935/closermeetings/air
" type="string"/>
<attribute name="userID" value="dooseok.yoo@access-company.com
" type="string"/>
<attribute name="tokenID" value="SH14da92da4cbd06c418d816ad68d519
" type="string"/>
<attribute name="channel" value="e50185c86ec048f685f0834063f2227b
" type="string"/>
<attribute name="_playOption" value="null
"/>
<handler name="oninit">
if ($debug) Debug.info(" ===== CREATE TEST SHARING VIEW ===== ");
if ($debug) Debug.write(" [ CREATE TEST SHARING VIEW ] :: ", this);
if ($debug) Debug.write(" [ CREATE TEST SHARING VIEW ] :: ", this.defaultURL);
if ($debug) Debug.write(" [ CREATE TEST SHARING VIEW ] :: ", this.userID);
if ($debug) Debug.write(" [ CREATE TEST SHARING VIEW ] :: ", this.tokenID);
setDefaultSize(1440,900);
//this.connect();
this.playVideo.startSharing();
</handler>
<view name="button" x="0" y="0" width="100" height="30" bgcolor="blue">
<handler name="onclick">
parent.connect();
</handler>
</view>
<method name="setDefaultSize" args="w,h">
if ($debug) {
var widthRatio = 1;
var heightRatio = 1;
var ratio = 1;
if (this.width < w) {
widthRatio = this.width/w;
}
if (this.height < h) {
heightRatio = this.height/h;
}
Debug.write(" ----- this.width :: ", this.width);
Debug.write(" ----- this.height :: ", this.height);
Debug.write(" ----- w :: ", w);
Debug.write(" ----- h :: ", h);
Debug.write(" ----- heightRatio :: ", heightRatio);
Debug.write(" ----- widthRatio :: ", widthRatio);
if (widthRatio <= 1 || heightRatio <= 1) {
if (widthRatio < heightRatio) {
ratio = widthRatio;
} else {
ratio = heightRatio;
}
}
Debug.write(" ----- ratio :: ", ratio);
this.playVideo.setAttribute("width", Math.round(w * ratio));
this.playVideo.setAttribute("height", Math.round(h * ratio));
Debug.write(" ----- this.playVideo.width :: ", this.playVideo.width);
Debug.write(" ----- this.playVideo.height :: ", this.playVideo.height);
}
</method>
<method name="connect">
if ($debug) Debug.write("-------------- connnectStart::");
this._nc = new NetConnection();
this._nc.connect(this.defaultURL, this.userID, this.tokenID, "live");
this._nc.addEventListener(NetStatusEvent.NET_STATUS, _onStatus);
if ($debug) Debug.write("-------------- connnectEnd::");
</method>
<method name="_onStatus" args="stats">
if ($debug) {
Debug.info(" ===== Sharing view netConnection onStatus =====", this, "_onStatus", stats.info.code);
Debug.write(" [ Sharing view netConnection onStatus ] - stats.info.code :: ", stats.info.code);
switch (stats.info.code) {
case "NetConnection.Connect.Success":
if ($debug) Debug.info(" ==== Connect Success ===== ");
this.playBroadCast();
break;
case "NetConnection.Connect.Closed":
if ($debug) Debug.info(" ==== Connect Failed ===== ");
break;
default:
if ($debug) Debug.info(" ==== Another Message ===== ");
break;
}
}
</method>
<method name="playBroadCast">
this._nsPlay = new NetStream(this._nc);
Debug.write("[ playBroadCast ] - _nsPlay :: ", this._nsPlay);
this._nsPlay.addEventListener(NetStatusEvent.NET_STATUS, _onPlayStatus);
Debug.write(" [ playBroadCast ] - playVideo :: ", playVideo);
this.playVideo.attachVideo(this._nsPlay);
Debug.write(" [ playBroadCast ] - check 1 :: ");
this._playOption = new NetStreamPlayOptions();
this._playOption.transition = NetStreamPlayTransitions.RESUME;
this._playOption.streamName = this.channel;
this._nsPlay.play2(this._playOption);
//this._nsPlay.play(this.channel);
</method>
<method name="_onPlayStatus" args="stats">
if ($debug) {
Debug.info(" ===== _onPlayStatus ===== ");
Debug.write(" [ _onPlayStatus ] - stats.info.code :: ", stats.info.code);
}
</method>
<view name="playVideo" bgcolor="black" valign="middle" align="center" width="1000" height="650">
<passthrough when="$as3">
import flash.media.*;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.NetStatusEvent;
</passthrough>
<attribute name="__LZvideo" value="null
"/>
<handler name="onclick">
if ($debug) {
Debug.write("###### test sharing view : onclick");
}
</handler>
<method name="startSharing">
var mc = new Video(this.width, this.height);
this.sprite.addChild(mc);
this.__LZvideo = mc;
this.applySizeToVid();
this.parent.connect();
</method>
<method name="applySizeToVid">
if (this.__LZvideo == null) {
return;
}
var vid = this._getflashvideo();
vid.width = this.width;
vid.height = this.height;
</method>
<method name="_getflashvideo">
return this.__LZvideo;
</method>
<method name="attachVideo" args="video">
Debug.write(" [ attachVideo ] - __LZvideo :: ", __LZvideo);
if (this.__LZvideo == null) {
return;
}
var vid = this._getflashvideo();
vid.attachNetStream(video);
</method>
</view>
</view>
</canvas>
Cross References
Named Instances