我如何开始从AS3特定的第二视频视频

2023-09-08 15:31:27 作者:浪荡绅士

我有一个问题关于动作脚本3.我有一个FLV视频和totaltime是6秒。我想从2秒seekSeconds启动它()。如果我写大于6值seekSeconds它只会从头部播放视频END.IF我写小于6,它不会work.what我可以写seekSeconds(),以2秒启动视频?

 函数useParams()
{
VAR OBJ:对象=新的对象();

变种D];
对于(法官在this.myParams)
{
    如果(j ==URL)
    {
        SRC = this.myParams [J]。
    }
    否则,如果(j ==浅)
    {
        的startTime = INT(this.myParams [J]);
    }
    其他
    {
        停止时间= INT(this.myParams [J]);
    }

    txt.text + = J + - + this.myParams [J]。
}
//fk.source = SRC;
txt.text =字符串(startTime时);

}

fk.addEventListener(VideoEvent.READY,比蒂);
功能比蒂(的EventObject:VideoEvent):无效
{
//fk.play();
跟踪(fk.totalTime);
fk.seek(2);
跟踪(fk.playheadTime);
//trace(fk.playheadTime);
}
 

解决方案

据为的VideoPlayer ,Event.READY被分派:

  

当FLV文件已加载并可以显示时调度此事件。它从你第一次进入响应状态后,您加载使用play()或load()方法一个新的FLV文件。它只为加载的每个FLV文件发生一次。

这是可能的视频准备好,但它并没有缓冲,以足够量的追求。您可以更改的bufferTime 的值大于2,虽然我不能肯定这将保证Event.READY将在您需要的时候会被解雇。还要注意寻求渐进式下载的属性:

  梳理UE4学习资料其二 好视频特定功能教程推荐

有关渐进式下载,由于只能搜索到一个关键帧;因此,设法把你的第一个关键帧的时间在指定的时间后。

所以一定要设置有足够先进的传递2秒,确保你传递一个关键帧上的bufferTime。

注意:有对既有的VideoPlayer和NetStream的一个的bufferTime,所以你可能需要调整一个或另一个或两者

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);
}

解决方案

According to the documentation for VideoPlayer, Event.READY is dispatched:

Event dispatched when an FLV file is loaded and ready to display. It starts the first time you enter a responsive state after you load a new FLV file with the play() or load() method. It starts only once for each FLV file that is loaded.

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:

For a progressive download, you can seek only to a keyframe; therefore, a seek takes you to the time of the first keyframe after the specified time.

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.