我有一个20分钟的FLV,在服务器上流畅。客户端希望在会话之间保留用户的位置,以便将time()保存到mySQL并作为FlashVar传回,并且(如果设置)馈送到seek()和文本字段进行测试。事情是seek()在本地工作正常但在服务器上我总是得到一个NetStream.Seek.InvalidTime错误,无论seek()设置为什么。文档是here;这是一个简单的功能。
//编辑只是使用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;
};
以前有人见过这个吗?
答案 0 :(得分:1)
尝试向您的onStatus
处理程序添加if语句,以检查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;
};