我正在做一个项目,我们连续播放多个视频,如果我们通过提供流 URL 以正常方式加载它们,则每次开始下一个视频时都会出现加载延迟。
我浏览了 Adobe 的 Flash 和 Flex 文档,但找不到预加载视频的方法。 在此应用程序中嵌入它们是行不通的。 理想情况下,我们会预加载它们,同时显示进度条或其他短视频,并且仅在所有视频加载完毕后才开始视频播放。
我不习惯向别人询问编程问题,我是 RTFM,但我发现 Adobe 文档缺乏,并且谷歌搜索 flash/flex 问题很困难。 有很多东西需要筛选,但我找不到相关的技术/解决方案。
至于 Flex/Flash,我对其中一个或两者的解决方案感兴趣。 也许它是相同的,因为它是动作脚本?
I'm doing a project where we play multiple videos back to back, and if we load them the normal way by providing a stream url, there is a load delay each time we start the next video.
I've looked through Adobe's docs for both Flash and Flex, and I can't find a way to pre-load the videos. Embedding them is not workable in this application. Ideally we would pre-load them, display a progress bar or other short video in the meanwhile, and only start the video playback when all the videos have loaded.
I'm not used to asking questions of others for programming, I RTFM, but I find the Adobe docs to be lacking, and googling flash/flex problems is tough. There's a lot to sift through, and I can't find the relevant technique/solution.
As to Flex/Flash I'm interested in the solution for either, or both. Perhaps it is the same, as it is actionscript?
发布评论
评论(2)
这应该是非常简单的。 对于直接 Flash,请使用 fl.video.VideoPlayer 或 fl.video.FLVPlayback。 创建多个播放器,每个视频一个,使用源视频的 url 对每个播放器调用 load()。 然后侦听 VideoProgressEvent.PROGRESS 事件以了解视频何时加载。 最后,您可以将视频连续附加到可视组件并调用 play() 来播放它们。
示例代码(未测试):
This should be very straightforward. For straight flash, use either fl.video.VideoPlayer or fl.video.FLVPlayback. Create multiple players, one per video, calling load() on each with the url to your source video. Then listen for VideoProgressEvent.PROGRESS events to find out when the video is loaded. Finally, you can attach the videos in succession to a visual component and call play() to play them.
Example code(not tested):
您可以尝试查看
bulk-loader
项目,看看是否它可能对此有用。摘录自首页:
You could try looking at the
bulk-loader
project and see if it might be useful for this.An excerpt from the front page: