FMS用AS来实现拉流

application.onAppStart=function ()
{
  this.myNC=new NetConnection();
  this.myNC.onStatus=NC_onStatus;
  this.myNC.onBWDone=NC_onBWDone;
  this.myNC.connect("rtmp://192.168.0.86/tsubasa");
  trace("Start");
};

function NC_onStatus(info)
{
  switch(info.code)
  {
  case "NetConnection.Connect.Success":
  application.myStream=Stream.get("stream");
  application.myStream.onStatus=NS_onStatus;
  if(application.myStream)
  {
    application.myStream.play("stream",-2, -1,false,application.myNC);
    trace("myStream=>play");
  }
  trace("连接成功!");
  break;
  case "NetConnection.Connect.Failed":
  trace("连接失败!");
  break;
  case "NetConnection.Connect.Rejected":
  trace("连接被拒绝!");
  break;
  default:
  trace("连接信息 "+info.code);
  break;
  }
}

function NS_onStatus(info)
{
  trace("视频流 "+info.code);
}
function NC_onBWDone(obj)
{
  trace("NC_onBWDone");
}

上一篇:学习安卓开发[3] - 使用RecyclerView显示列表


下一篇:xml使用系统整理