Actionscript 3:使用netstatus和cuepoints排队FLV [英] Actionscript 3: Queuing up FLVs using netstatus and cuepoints

查看:272
本文介绍了Actionscript 3:使用netstatus和cuepoints排队FLV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个使用视频转场从一个部分到另一个部分的Flash网站。每个部分的背景都是比转换视频本身更高的静态照片,在转换过程中放大。每个视频转换的第一帧是当前的背景图像,每个视频转换的最后一帧是目的地的背景图像。粗略地说,这是在网站上导航的预期流程:

休息状态:

前景中的高分辨率图像,没有视频元素

用户在导航上单击项目:
Flash通过一个netstream对象准备一个FLV并对其进行缓冲,这通过netstream.play )功能。收到Netstatus.Buffer.Full事件后,netstream对象暂停并附加到一个视频对象,然后将其添加到前景中高分辨率图像后面的显示列表中。只要视频对象被添加到舞台上,前景中的高分辨率图像就会(通过补间)变暗,只留下背景视频。当前景完成补间时,后台的视频播放。一旦收到NetStream.Play.Stop,进程就会反向进行。也就是说,一个新的高分辨率前景图像在视频图层上补间,一旦完成,视频就从舞台上移除。

我没有以为上面所说的流程有什么问题(至少在原则上是这样),听起来不像是应该那么棘手。但是,我对FLV /视频对象的初始设置没有任何问题。起初,FLV似乎并没有正确排队,我的意思是说,高分辨率的前景图像变成了一个白色的屏幕,而且这个视频只是在一两秒钟后才开始播放。 (FLV的第一帧肯定不是白色的)。



我不知道是什么原因导致了这种行为,但是在收到Buffer.Full之后,从而推动视频过去任何可能导致白屏的事情。这在本地运行良好,但是一旦我把这个站点放在开发主机上,在转换过程中又回到了白屏。令人讨厌的是,将骇客延迟冲击到2秒左右摆脱了远程服务器上的白屏问题,但结果难以预料;取决于连接速度,你可能会看到一切正常,或者你可能会被扔进已经播放了一两秒钟的视频。

我也尝试过使用bytesLoaded / bytesTotal而不是netStatus事件的类似方法,无济于事。我上次的实验是使用提示点;在FLV编码过程中,我在0.2秒内向FLV投入了一个提示点,并在补间前景之前等待了这个提示;再一次,它在本地工作,但在视频踢到远程服务器上测试之前,我被对待了一个补间到白色。



我真的在运行出于这里的想法,并非常感谢你们可以提供的任何建议。非常感谢您的宝贵时间和宝贵意见!



Justin

解决方案

有时候,FLV是非常诡异的野兽。



我将会看看是否可以挖掘一些我编写的代码来处理所有这些。同时我喜欢你的想法,我知道你为什么会遇到麻烦。提示点实际上与关键帧绑定 - 所以你需要确保你的提示点被放置在第二个关键帧之后 - 这将确保至少显示第一个关键帧的视频。


I'm building a flash site that uses video transitions to go from section to section. Each section's background is a still-frame photo at higher res than the transition videos themselves, which are scaled up during transition. The first frame of each video transition is the current background image, and the last frame of each video transition is the destination's background image. Roughly speaking, this is the intended flow of navigation on the site:

Resting state:
hi-res image in foreground, no video elements

User clicks item on navigation:
Flash prepares an FLV via a netstream object and buffers it, which is accomplished through the netstream.play() function. Upon receipt of the "Netstatus.Buffer.Full" event, the netstream object is paused and attached to a video object, which is then added to the display list behind the hi-res image in the foreground. As soon as the video object has been added to the stage, the hi-res image in the foreground alphas out (via tween), leaving only the background video. When the foreground is finished tweening, the video in the background plays. As soon as "NetStream.Play.Stop" is received, the process happens in reverse; that is, a new hi-res foreground image tweens in over the video layer, and the video is removed from the stage as soon as that's done.

I don't think there's anything wrong (at least in principle) with the flow I've outlined above, and it doesn't sound like it should be that tricky to do. However, I've had no end of problems with the initial setting up of the FLV/video object. At first, it seemed that the FLV wasn't queuing up properly, by which I mean that the hi-res foreground image tweened out to reveal a white screen, and the video popped in and only began playing after a second or two. (The first frame of the FLV is definitely not white).

I had no idea what might have been causing this behavior, but hackishly threw in a timer that plays the netstream for about 100 ms after "Buffer.Full" is received, thereby advancing the video past whatever might have been causing the white screen. This worked well locally but as soon as I put the site on a dev host, it was back to the white screen during transitions. The annoying thing is that bumping the hackish delay up to about 2 s got rid of the white screen problem on remote servers, but results were unpredictable; depending on connection speed, you might see everything work perfectly, or you might get thrown into a video that had already been playing for a second or two.

I've also tried similar approaches using bytesLoaded/bytesTotal instead of netStatus events, to no avail. My last experiment was using cuepoints; during FLV encoding, I threw in a cuepoint 0.2 seconds into the FLV and waited for THAT before tweening out the foreground; once again, it worked locally, but I was treated to a tween-to-white before the video kicked in when testing on a remote server.

I'm really running out of ideas here and would very much appreciate any advice you guys can offer. Thanks very much for your time and consideration!

Justin

解决方案

FLVs are tricksy beasts at times.

I'm going to see if I can dig up some code I wrote a while back to handle all of this. In the meantime I like your idea about cuepoints, and I know why you're running into trouble with them. Cuepoints are actually tied to keyframes - so you need to make sure your cuepoint is placed AFTER your second keyframe - that will ensure that at least the first keyframe of video has been displayed.

这篇关于Actionscript 3:使用netstatus和cuepoints排队FLV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆