使用 Flex 和 Flash Media Server 逐帧推进视频
我已经设置了一个 Adobe Flash Media Server,其中包含一些流视频 (.f4v)。我有一个 Flex 应用程序,它使用 VideoDisplay 组件来连接和播放视频。
对于这个特定的应用程序,用户可以一次单击一下暂停视频并缓慢播放视频,这一点非常重要。如果可以的话,一帧一帧地看就很酷了。
目前我这样做,这对于 value > 来说效果相当好。 0.1s
protected function reverseFrame(event:MouseEvent):void
{
mainVideo.playheadTime -= 0.1; // seconds
}
protected function advanceFrame(event:MouseEvent):void
{
mainVideo.playheadTime += 0.1; // seconds
}
我可能可以计算出一帧所花费的粗略时间(我想是从元数据中),但我不确定这是否是最好的方法。另外,有时当使用较小的值(例如 0.1s)时,它不会渲染下一个图像,直到我再次前进。
我已经看到还有其他用于播放 Flash 媒体的组件,但我不确定它们是否比 VideoDisplay 提供任何额外的好处。
I've got an Adobe Flash Media Server set up with some streaming videos (.f4v). I've got a Flex app that uses a VideoDisplay component to connect and play videos.
For this particular application, it will be important that users can pause a video and advance it slowly, one click at a time. Frame by frame would be pretty cool, if possible.
Currently I do this, which works fairly well for values > 0.1s
protected function reverseFrame(event:MouseEvent):void
{
mainVideo.playheadTime -= 0.1; // seconds
}
protected function advanceFrame(event:MouseEvent):void
{
mainVideo.playheadTime += 0.1; // seconds
}
I could probably calculate the rough time a frame take (from the metadata I suppose) but I'm not sure if that would be the best way of doing it. Also, sometimes when using small values such as 0.1s, it won't render the next image until I advance again.
I've seen that there are other components for playing Flash media, but I'm not sure if they provide any additional benefit over VideoDisplay.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Flash 10.1 具有 NetStream。为此目的采取步骤。
Flash 10.1 has NetStream.step for this purpose.
如果您对媒体流服务器解决方案的选择比较灵活,我建议您看看 Wowza Media Server 而不是 Flash Media Server。
Wowza 支持快进、快退、慢动作等功能。它的工作原理是按照您想要的速度传输媒体,无需在 Flex 客户端上实现相同的效果。
您可以查看以下代码示例来了解上述功能:
Wowza 媒体服务器(快进、快退、慢动作)
If you are flexible on your choice of media streaming server solution, I would suggest you take a look at Wowza Media Server instead of Flash Media Server.
Wowza supports features like fast foward, fast rewind, slow motion. It works by streaming the media at your desired speed eliminating the need to implement the same on the Flex client.
You can take a look at the following code example for the aforementioned functionality:
Wowza Media Server (fast foward, fast rewind, slow motion)