我怎样才能从as3中的特定秒开始播放视频
我对动作脚本 3 有疑问。我有一个 flv 视频,其总时间为 6 秒。我想用seekSeconds()从2秒开始。如果我在seekSeconds中写入大于6的值,它只会从头到尾播放视频。如果我写入小于6,它将不起作用。我可以在seekSeconds()中写入什么来从2秒开始播放视频?
function useParams()
{
var obj:Object = new Object();
var j;
for (j in this.myParams)
{
if (j == "url")
{
src = this.myParams[j];
}
else if (j=="bas")
{
startTime = int(this.myParams[j]);
}
else
{
stopTime = int(this.myParams[j]);
}
txt.text += j + " - " + this.myParams[j];
}
//fk.source = src;
txt.text = String(startTime);
}
fk.addEventListener(VideoEvent.READY, bitti);
function bitti(eventObject:VideoEvent):void
{
//fk.play();
trace(fk.totalTime);
fk.seek(2);
trace(fk.playheadTime);
//trace(fk.playheadTime);
}
i have a problem about action script 3. i have a flv video and its totaltime is 6 seconds. i want to start it from 2. seconds with seekSeconds(). if i write bigger than 6 values in seekSeconds it will only play the video from head to end.İf i write smaller than 6 ,it won't work.what can i write in seekSeconds() to start the video from 2 seconds?
function useParams()
{
var obj:Object = new Object();
var j;
for (j in this.myParams)
{
if (j == "url")
{
src = this.myParams[j];
}
else if (j=="bas")
{
startTime = int(this.myParams[j]);
}
else
{
stopTime = int(this.myParams[j]);
}
txt.text += j + " - " + this.myParams[j];
}
//fk.source = src;
txt.text = String(startTime);
}
fk.addEventListener(VideoEvent.READY, bitti);
function bitti(eventObject:VideoEvent):void
{
//fk.play();
trace(fk.totalTime);
fk.seek(2);
trace(fk.playheadTime);
//trace(fk.playheadTime);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 VideoPlayer,Event.READY 被调度:
视频可能已准备就绪,但尚未缓冲到足够的量以供搜索。您可以将 bufferTime 更改为大于 2 的值,尽管我不确定这是否能保证 Event.READY 在您需要时被触发。另请注意“寻求渐进式下载”的属性:
因此,请确保您设置的 bufferTime 足够提前超过 2 秒,以确保您传递了关键帧。
注意: VideoPlayer 和 NetStream 上都有一个 bufferTime,因此您可能需要调整其中之一或两者。
According to the documentation for VideoPlayer, Event.READY is dispatched:
It is possible the video is ready but it hasn't buffered to an adequate amount for seeking. You can change the bufferTime to a value greater than 2 although I am not certain that will guarantee Event.READY will get fired at the time you need. Also note the property of seek for progressive downloads:
So make sure you set a bufferTime that is adequately advanced passed 2 seconds to ensure you are passed a keyframe.
Note: there is a bufferTime on both a VideoPlayer and the NetStream so you may have to adjust one or the other or both.