如何处理 IE 中的延迟 onMetaData?
我正在尝试动态调整在 Flash 播放器中播放的 flv 的大小。为此,我需要获取 flv 的宽度/高度,以便保持原始的宽高比。
我注意到在 Firefox 中 onMetaData 事件将立即被触发,并且视频将正确调整大小。然而,在 IE 中,只有缓冲区已满且视频开始播放时,才会触发 onMetaData。
我想到的一种解决方案是将初始缓冲区设置为接近 0(例如 0.01)。然后缓冲区将立即满,并且视频将被调整大小。
我遇到的问题是,低带宽用户在进入下一个更大的缓冲区之前,会在开始时出现一段短暂的视频“杂音”(例如 0.5 秒)。
有没有更好的方法来处理 IE 中的这种行为?您可以在播放 FLV 文件之前手动“获取”其元数据吗?
I am trying to dynamically resize an flv playing back in a flash player. To do this, I need to get the flv's width/height so I can maintain the original aspect ratio.
I have noticed that in Firefox the onMetaData event will be hit right away, and the video will resize properly. In IE however, onMetaData is not hit until the buffer is full and video starts playing.
One solution I have thought of is to set the initial buffer to something close to 0 (e.g. 0.01). Then the buffer will instantly hit full, and the video will be resized.
The issue I have with this is low bandwidth users will have a a short 'sputter' of video (0.5 seconds say) at the beginning before it goes to the next, larger, buffer.
Is there any better way to deal with this behavior in IE? Can you manually "get" the metaData from an FLV file before it even plays?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以加载 FLV 并将字节作为 ByteArray 读取,并从中获取元数据。元数据信息应位于文件头中。我不确定这是否是最好的方法。您可能只需加载前 X 个字节即可获取 FLV 文件头,这样您就不需要加载整个 FLV 两次。
这是实际操作: FLV 工具 我不久前构建了此工具(使用本地 FLV)。这会加载完整的文件,但显然您只想加载标头。
It is possible to load the FLV and read the bytes as a ByteArray and get the metadata from this. The metadata info should be in the file header. I'm not sure if this is the best approach though. You could probably just load in the first X amount of bytes to get the FLV file header, so that you don't need to load the whole FLV twice.
Here is this in action: an FLV tool I built a while ago that does this (with a local FLV). This loads the complete file, but you obviously would only want to load the header.