Flash NetConnection


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var video:Video = new Video(VIDEOWIDTH, VIDEOHEIGHT);
  2. addChild(video);
  3.  
  4. var nc:NetConnection = new NetConnection();
  5. nc.connect(null);
  6.  
  7. var ns:NetStream = new NetStream(nc);
  8. ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
  9.  
  10. function onStatusEvent(stat:Object):void
  11. {
  12. trace(stat.info.code);
  13. }
  14.  
  15. var meta:Object = new Object();
  16. meta.onMetaData = function(meta:Object)
  17. {
  18. trace(meta.duration);
  19. }
  20.  
  21. ns.client = meta;
  22.  
  23. video.attachNetStream(ns);
  24.  
  25. ns.play("yoursource.flv");

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.