Permalink
Browse files

No commit message

  • Loading branch information...
0 parents commit 0cebfc05be2feba15f8fc2912614603dce949d90 @prekageo committed Jul 8, 2011
Showing with 864 additions and 0 deletions.
  1. +58 −0 SampleRTMPClient.as
  2. BIN SampleRTMPClient.swf
  3. +352 −0 rtmp_protocol.py
  4. +224 −0 rtmp_protocol_base.py
  5. +91 −0 sample_rtmp_client.py
  6. +139 −0 sample_rtmp_server.py
@@ -0,0 +1,58 @@
+package {
+ import flash.display.Sprite;
+ import flash.text.TextField;
+ import flash.net.NetConnection;
+ import flash.net.SharedObject;
+ import flash.net.ObjectEncoding;
+ import flash.events.*;
+
+ public class SampleRTMPClient extends Sprite {
+ internal var display_txt:TextField;
+ internal var netconn:NetConnection;
+ internal var so:SharedObject;
+ internal var so2:SharedObject;
+
+ public function SampleRTMPClient() {
+ display_txt = new TextField();
+ display_txt.text = "Connecting...";
+ display_txt.width = 400;
+ display_txt.height = 300;
+ display_txt.border = true;
+ display_txt.multiline = true;
+ display_txt.wordWrap = true;
+ addChild(display_txt);
+
+ NetConnection.defaultObjectEncoding = ObjectEncoding.AMF0;
+ netconn = new NetConnection();
+ netconn.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
+
+ netconn.connect("rtmp://127.0.0.1:80/test","arg1",42);
+ }
+
+ public function netStatusHandler(event:NetStatusEvent):void{
+ switch(event.info.code){
+ case 'NetConnection.Connect.Failed':
+ case 'NetConnection.Connect.Rejected':
+ display_txt.text = "Connection failed.";
+ break;
+ case 'NetConnection.Connect.Success':
+ display_txt.text = "Connection OK.";
+ so = SharedObject.getRemote("so_name", netconn.uri);
+ so.addEventListener(SyncEvent.SYNC, soSyncHandler);
+ so.connect(netconn);
+ break;
+ }
+ }
+
+ public function soSyncHandler(event:SyncEvent):void{
+ display_txt.text = "so_name.sparam = " + so.data.sparam;
+ so2 = SharedObject.getRemote("so2_name", netconn.uri);
+ so2.addEventListener(SyncEvent.SYNC, so2SyncHandler);
+ so2.connect(netconn);
+ }
+
+ public function so2SyncHandler(event:SyncEvent):void{
+ display_txt.text = "so2_name.sparam = " + so2.data.sparam;
+ }
+ }
+}
Binary file not shown.
Oops, something went wrong.

0 comments on commit 0cebfc0

Please sign in to comment.