HTML5 视频流/搜索
我正在尝试提供正在即时转码的视频。不幸的是,这意味着寻找不起作用。我假设这是因为浏览器不知道视频有多长,因此无法正确显示搜索栏。
有谁知道是否可以对视频的持续时间进行硬编码?
我想到的另一个选项可能是创建我自己的搜索栏并使用 JS 更新其位置,如果拖动,则更新视频 URL 以将开始时间传递给服务器。
关于最好的方法有什么建议吗?
瓦
I'm trying to serve videos which are being transcoded on-the-fly. Unfortunately, this means that seeking does not work. I'm assuming that this is because the browser doesn't know how long the video is and therefore can't display a seekbar properly.
Does anyone know if it's possible to hard-code the duration of a video?
The other option I've thought of may be to create my own seek-bar and use JS to update it's position and, if dragged, update the video URL to pass a start-time to the server.
Any suggestions on the best way to do this?
W
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要提供有关其在服务器上如何工作的更多信息。然而,这是我对我认为正在发生的事情的一般性回答。
您的服务器上有一个特定格式的视频,并且它以不同的格式提供,我假设是为了浏览器兼容性(Firefox 的 WebM 等)。
您应该做的是为所有上传的视频建立一个数据库,以跟踪其原始格式的长度。然后,当将视频转码为不同格式时,您可以检查数据库以查看其长度,而不是尝试将其从转码流中拉出。
使用它来创建一个长度为最大值的滑块。
然后使用滑块的值将 currentTime 设置为 html5 视频元素。
You need to provide more info into how this is working on the server. However, here's my generic answer on what I assume is going on.
You have a video in a certain format on your server and it's being served in a different format, I assume for browser compatibility (WebM for firefox etc).
What you should do is have a database for all uploaded videos which keep track of the length in it's original format. Then when transcoding the video to a different format, you can check the database to see it's length instead of trying to pull it out of the transcoding stream.
Use that to create yourself a slider with the length as the max value.
Then set currentTime to the html5 video element using the slider's value.