使用videojs在播放框架中流式传输视频 [英] Streaming video in play framework using videojs

查看:1860
本文介绍了使用videojs在播放框架中流式传输视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我一直在我的朋友的播放框架1.2.4中的web应用程序上工作,我们尝试使用videojs播放器流式传输存储在项目的/ public目录中的视频。这个视频是.mp4格式,但我想这与这个问题无关。我们直接访问视频而不使用任何服务器端脚本。我们在测试期间发现了2个问题。

Recently I have been working with my friend on a web application in play framework 1.2.4 where we were trying to stream a video stored in the /public directory of the project using the videojs player. This video was in .mp4 format but I guess this is irrelevant for this question. We were accessing the video directly without using any server side scripts. We have spotted 2 issues the arose during our tests.


  1. 视频从未一直缓存到最后。只有几秒钟的时间总是存储在缓冲区中。

  1. The video was never buffered all the way to the end. Only a few seconds ahead were always stored in the buffer.

播放视频时,如果我们按下暂停然后播放,视频的播放就会中断完全。有时它会永远缓冲视频,有时它会继续播放视频,但它只会显示黑屏而没有声音。

When playing the video, if we pressed pause and then play, the playback of the video would break completely. Sometimes it would be buffering the video forever, other times it would look like it continues with the playback of the video, but it would only show a black screen and no sound.

当我们对不存储在Web应用程序中的文件尝试相同的videojs脚本,但是从其他服务器提供服务时,它运行得很完美。即使其他服务器只是在同一台计算机上运行tomcat。因此,我建议这必须是服务器播放用于运行其应用程序的问题。我们使用play run命令和默认配置运行应用程序。谁能解释这种奇怪的行为?是否需要在配置中设置某些内容,或者这只是一个错误?谢谢。

When we tried the same videojs script on the files stored not in the web application, but served from some other servers it worked flawlessly. Even if the other server was just tomcat running on the same computer. Therefore, I suggest this must be an issue with the server play uses to run its applications. We were running the application using the "play run" command and with the default configurations. Can anyone explain this strange behaviour? Is there something that needs to be set in the configurations, or is this just a bug? Thanks.

推荐答案

我认为netty /播放控制器处理中的范围支持存在问题公用文件夹。
http://www.w3.org/ Protocols / rfc2616 / rfc2616-sec14.html#sec14.35

I think thats a problem with the range support in netty / the play controller handling public folder. ( http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35 )

您应该可以使用curl进行测试..例如就像在这篇文章中描述的那样
http://linuxandfriends.com/2008/11/01/curl-split-a-file-and-download-simultaneously-from-multiple-locations/

You should be able to test this with curl.. e.g. like described in this post http://linuxandfriends.com/2008/11/01/curl-split-a-file-and-download-simultaneously-from-multiple-locations/

但是,在生产中,您通常会使用lighttpd / nginx (以允许绑定端口80),因此来自公共文件夹由播放以外的其他东西提供服务......那么你应该没有问题。

However, in production, you're usually fronting play with lighttpd/nginx (to allow to bind port 80) so the files from the public folder get served by something other than play... you shouldn't have a problem then.

这篇关于使用videojs在播放框架中流式传输视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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