Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import flash.display.Sprite;
- import flash.net.NetConnection;
- import flash.net.NetStream;
- import flash.media.Video;
- import flash.events.NetStatusEvent;
- public class TimeCodeTest extends Sprite
- {
- private var nc:NetConnection;
- private var ns:NetStream;
- public function TimeCodeTest()
- {
- nc=new NetConnection();
- nc.client = this;
- nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
- nc.connect("rtmp://10.1.80.156/myLiveApp/instance1/");
- }
- public function netStatusHandler(event:NetStatusEvent):void
- {
- switch (event.info.code)
- {
- case "NetConnection.Connect.Success":
- trace("Connected!");
- var clientObj:Object=new Object();
- clientObj.onFI=onFIHandler;
- ns=new NetStream(nc);
- ns.client=clientObj;
- var video:Video = new Video();
- video.attachNetStream(ns);
- ns.play("livestream"); // "livestream" is the name of the live stream you published
- addChild(video);
- break;
- default:
- break;
- }
- }
- public function onBWDone():void
- {
- }
- // define onFIHandler
- public function onFIHandler(infoObj:Object):void
- {
- trace("FI works!!!");
- trace("system time: " + infoObj.st);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement