netstream 在视频中间播放
我正在使用 netstream 和视频对象在 Flash 中播放视频。具体来说是mp4视频。
我想做的是从特定位置(例如 20 秒)开始播放文件。
但是,除非流已加载超过 20 秒,否则 netstreamObject.seek(20) 不起作用。有没有办法指定20秒开始加载?或者还有其他方法可以实现这一点吗?
I'm using the netstream and video object to play a video in flash. Specifically a mp4 video.
What I'm trying to do is start playing the file from a specific position (Ex. 20seconds).
However with netstreamObject.seek(20) doesn't work unless the stream has been loaded past 20seconds. Is there a way to specify starting to load at 20s? Or any other way of accomplishing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
从 20 秒开始创建文件的新版本不是更简单吗?这样用户下载的内容就会减少。
尝试在这里查看 http://www.winmend.com/file-splitter/
乔什
would it not be simpler to create a new version of the file starting at 20 seconds. this way there is less for the user to download.
try looking here http://www.winmend.com/file-splitter/
Josh
简短的回答是,“您无法在渐进式视频中寻找超过下载点的位置。”
但是,Akamai 和其他 CDN(例如 YouTube)拥有允许搜索渐进式视频的技术。这并不能解决您的问题,因为它是专有的服务器技术。
在您的情况下,仅使用客户端代码而不控制文件或流服务器,在文件加载之前无法进行搜索。
The short answer is, "You cannot seek past the download point in a progressive video."
However, Akamai and other CDNs (for example, YouTube) have technology to allow seeking on progressive videos. This does not solve your problem, because it is proprietary server technology.
In your situation, using only client code with no control over the files or streaming server, there is no way to seek until the file loads.
您可以使用某种支持lighttpd的CDN缓存服务器(因此实际文件将通过该缓存服务器提供),然后您可以在视频中向前查找。
You can use some sort of CDN cache server (so the actual file will be served via this cache server) which support lighttpd, then you can seek ahead in the video.
是的,您甚至可以在渐进式上执行此操作,这称为 http 伪流,查找它,您会发现大量示例。基本上,您需要服务器上的一个部分来接收请求,在初始请求中,您将通过 http 标头添加起始点,服务器端将自动移动到该偏移量。
不过现在有更好的方法。在我看来,RTMP 很糟糕,它是 Adobe 专有的,并且在非标准端口上工作,所以很多用户都遇到问题。如果你想认真并把事情做好。查找 apache f4f 模块、adobe http 动态流和 f4fpackager。根据 apache origin 模块上的 Adobe 文档设置 apache 服务器,使用 f4fpackager 将视频/音频分成片段。现在将您的网络流指向 f4m。您不仅可以疯狂快速地进行搜索,还可以通过标准 http,可以使用普通的旧 CDN 来缓存和访问。服务器请求,但您也可以支持自适应流的多个比特率。
Yes, you can do this even on progressive, it's known as http pseudostreaming, look it up and you'll find tons of examples for this. Basically you need a piece on your server to recieve the request, in the initial request you'll add via a http header the start point, the server side will automatically move to that offset.
There are better ways now though. In my opinion RTMP sucks, it's very proprietary to Adobe and works over non-standard ports, so many users have issues with it. If you wanna get serious and do it right. Lookup the apache f4f module, adobe http dynamic streaming, and the f4fpackager. Setup a apache server according to Adobe's docs on the apache origin module, use the f4fpackager to chunkify your video/audio into segments. Now point your netstream to the f4m. Not only can you seek crazy fast, your also going over standard http, can use a plain old CDN to cache & server the requests, but you can also support multiple bit-rates for adaptive streaming.