在Flash中使用HTTP伪序列时,请精确查找 [英] Accurate seek when using HTTP Pseudostreaming in Flash

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

问题描述

美好的一天!

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

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

我的解决方案



对于这个解决方案,我们需要在文件的开始部分有视频文件中的关键点(无论如何您都需要)。


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

  2. 如果目标时间已经被缓冲:
    2.1。如果是这样 - 只要使用NetStream.seek()
    2.2。如果目标时间未被加载 - 使用文件元数据中的关键点表找到neares seekpoint,并执行切换到新的URL并添加?start = ...


使用这个技巧,我可以得到准确的寻找,但整体的方法有点棘手。 b $ b

有什么更好的办法吗?

解决方案

为了防止有人需要帮助,这里是osmf插件,你可以用它来完成使用flex的录像机pseudostreaming:



Github链接


Good day!

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)

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.

My solution

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

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

  2. 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.

Is there any better way?

解决方案

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

Github link

这篇关于在Flash中使用HTTP伪序列时,请精确查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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