打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
视频流播放 双阀值缓冲
function initConnection() {
   // Create a NetConnection
   nc = new NetConnection();
   // Define onStatus event handler
   nc.onStatus = function(info) {
   trace("Level: "+info.level+" Code: "+info.code);
   // Initialize the stream after the connection is successful
   if (info.code == "NetConnection.Connect.Success") {
      trace("--- connected to: " + this.uri);
      startStream(); //Inizialize the stream
      }
   };
   // try to connect, to be changed with your app path
   nc.connect("rtmp://127.0.0.1/dualBuffering/demo");
}

function startStream() {
   //Define stream and buffers parameters
    stream_name="test_stream";  //your stream
    startBufferLength=2; //keep this in the range 2-4+
    expandedBufferLength=15;  //arbitrarily high

   // create a netstream
   ns = new NetStream(nc);
 
   // Define onStatus event handler
   ns.onStatus = function(infoObject:Object) {
      if (infoObject["code"]=="NetStream.Buffer.Full"){
      ns.setBufferTime(expandedBufferLength);
      trace("set expanded buffer");
      }
      if (infoObject["code"]=="NetStream.Buffer.Empty"){
      ns.setBufferTime(startBufferLength);
      trace("set start buffer");
      }
   }

   // attach the NetStream to a video object
   // change from videoObj to your istance name if needed
   videoObj.attachVideo(ns);
   ns.setBufferTime(startBufferLength);
   ns.play(stream_name, 0);
}
initConnection();
stop();

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
flasz?as3?NetStream类使用提示点和元数据OnMetaData,OnXMP...
自制Flash FLV视频播放器 - MaxIE - 博客园
FLV/MP4视频文件、FMS实时流播放器的制作技术详解(附AS2/AS3源文件)[
AS3.0加载FLV视频
Flex播放数据流
通过FMS实现时时视频聊天(Flash|Flex)【转载】
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服