0

我有一个 20 分钟的 FLV,可以在服务器上正常播放。客户端希望在会话之间保留用户的位置,以便将 time() 保存到 mySQL 并作为 FlashVar 传回,并且(如果设置)馈送到 seek() 和文本字段以进行测试。事情是 seek() 在本地工作正常,但在服务器上,无论 seek() 设置什么,我总是会收到 NetStream.Seek.InvalidTime 错误。文档在这里;这是一个非常简单的功能。

// 编辑刚刚使用http://www.buraks.com/flvmdi/将关键帧添加到 FLV 但这并没有解决问题

src = "videos/LivingProof.flv";

nc = new NetConnection();
nc.connect(null);
nets = new NetStream(nc);
mc_flv.attachVideo(nets);

//Attach your netstream audio to a movielcip: 
snd.attachAudio(nets); 
// create a sound object 
my_snd = new Sound(snd); 
// to adjust the volume 
my_snd.setVolume(50); 
nets.play(src);

if (starttime) {
  var dest:Number = Math.floor(starttime);
  nets.seek(dest);
  this.test.text = 'target time = ' + dest;
}

nets.onStatus = function(infoObject:Object) {
     if( infoObject.level == "status" && infoObject.code == "NetStream.Play.Stop" ) {
        getURL("javascript:setTime('9999999999');", "_self");
        nets.seek(0);
        nets.pause();
        mc_play.gotoAndStop(1);
        trace('onStatus listener fired');
    } else if (infoObject.code == "NetStream.Seek.InvalidTime") { 
        _root.test.text = "NetStream.Seek.InvalidTime";
        nets.seek(infoObject.details); 
    } 
    _root.status.text = infoObject.code;
};

有人见过这个吗?

4

1 回答 1

1

尝试将 if 语句添加到您的onStatus处理程序以检查NetStream.Play.Start代码并将查找逻辑移至该代码:

src = "videos/LivingProof.flv";

nc = new NetConnection();
nc.connect(null);
nets = new NetStream(nc);
mc_flv.attachVideo(nets);

//Attach your netstream audio to a movielcip: 
snd.attachAudio(nets); 
// create a sound object 
my_snd = new Sound(snd); 
// to adjust the volume 
my_snd.setVolume(50); 
nets.play(src);

nets.onStatus = function(infoObject:Object) {
     if( infoObject.level == "status" && infoObject.code == "NetStream.Play.Stop" ) {
        getURL("javascript:setTime('9999999999');", "_self");
        nets.seek(0);
        nets.pause();
        mc_play.gotoAndStop(1);
        trace('onStatus listener fired');
    } else if (infoObject.code == "NetStream.Play.Start) {
       if (starttime) {
          var dest:Number = Math.floor(starttime);
          nets.seek(dest);
          this.test.text = 'target time = ' + dest;
        }
    } else if (infoObject.code == "NetStream.Seek.InvalidTime") { 
        _root.test.text = "NetStream.Seek.InvalidTime";
        nets.seek(infoObject.details); 
    } 
    _root.status.text = infoObject.code;
}; 
于 2012-06-13T23:53:39.370 回答