在 Flash 中使用 HTTP Pseudostreaming 时的准确搜索 [英] Accurate seek when using HTTP Pseudostreaming in Flash

查看:19
本文介绍了在 Flash 中使用 HTTP Pseudostreaming 时的准确搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天!

我在 AS3 中开发视频播放器时遇到了一个问题.我对 FLV 和 MP4 使用 HTTP 伪流(这里是伪流的描述:http://flowplayer.org/plugins/streaming/pseudostreaming.html)

I've faced one problem when developing my video player in AS3. I use HTTP pseudostreaming for FLV and MP4 (here is a description of pseudostreaming: http://flowplayer.org/plugins/streaming/pseudostreaming.html)

问题:flv/mp4 文件的大小分布不是线性的,因此基于 (stream.bytesLoaded/stream.bytesTotal) * video.duration 的查找不准确.

The problem: The size distribution over flv/mp4 file is not linear, so seeking based on (stream.bytesLoaded / stream.bytesTotal) * video.duration is not accurate.

我的解决方案

对于这个解决方案,我们需要在视频文件中包含 keypoints\seekpoints(无论如何你都需要).

For this solution we need to have keypoints\seekpoints in video file (you will need the anyway) at the beginning of the file.

  1. 用户点击搜索栏,我们以秒为单位计算目标搜索时间

  1. User clicks on seek bar, we calculate target seek time in seconds

我们检查目标时间是否已经缓冲:2.1.如果是这样 - 只需使用 NetStream.seek() 寻找2.2.如果未加载目标时间 - 使用文件元数据中的关键点表找到接近搜索点并执行切换到添加了 ?start=...

We check if target time is already buffered: 2.1. if so -- just seek using NetStream.seek() 2.2. if target time is not loaded -- found neares seekpoint using table of keypoints in file metadata and perform switch to the new URL with added ?start=...

使用这种技术我可以获得准确的搜索,但整体方法有点棘手.

Using this technique I can get accurate seek, but the overall approach is a bit tricky.

有没有更好的方法?

推荐答案

以防万一有人需要有关此主题的帮助,这里有 osmf 插件,您可以使用 flex 的视频播放器来完成伪流传输:

Just in case anybody needs help on this topic, here is osmf plugin you can use to accomplish pseudostreaming using flex's videoplayer:

Github 链接

这篇关于在 Flash 中使用 HTTP Pseudostreaming 时的准确搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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