Advertisement
Guest User

Untitled

a guest
May 13th, 2010
882
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package
  2. {
  3.     import flash.display.Sprite;
  4.     import flash.net.NetConnection;
  5.     import flash.net.NetStream;
  6.     import flash.media.Video;
  7.     import flash.events.NetStatusEvent;
  8.  
  9.  
  10.     public class TimeCodeTest extends Sprite
  11.     {
  12.  
  13.             private var nc:NetConnection;
  14.             private var ns:NetStream;
  15.  
  16.         public function TimeCodeTest()
  17.         {
  18.             nc=new NetConnection();
  19.             nc.client = this;
  20.             nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
  21.             nc.connect("rtmp://10.1.80.156/myLiveApp/instance1/");
  22.         }
  23.        
  24.         public function netStatusHandler(event:NetStatusEvent):void
  25.         {
  26.                     switch (event.info.code)
  27.                     {
  28.                         case "NetConnection.Connect.Success":
  29.                
  30.                             trace("Connected!");
  31.      
  32.                             var clientObj:Object=new Object();
  33.                     clientObj.onFI=onFIHandler;
  34.                    
  35.                                 ns=new NetStream(nc);
  36.                     ns.client=clientObj;           
  37.                    
  38.                     var video:Video = new Video();
  39.                             video.attachNetStream(ns);
  40.                             ns.play("livestream");     // "livestream" is the name of the live stream you published
  41.                             addChild(video);
  42.                    
  43.                                 break;
  44.    
  45.                 default:
  46.                
  47.                     break;                  
  48.  
  49.                     }
  50.             }
  51.        
  52.             public function onBWDone():void
  53.             {  
  54.            
  55.         }
  56.  
  57.         // define onFIHandler
  58.         public function onFIHandler(infoObj:Object):void
  59.         {
  60.  
  61.             trace("FI works!!!");
  62.             trace("system time: " + infoObj.st);
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement