html5 chrome 视频播放出现EofException,
html5 chrome video playback gets EofException,
我终于在 chrome 中使用 headers Content-Range 等搜索功能播放了视频,并返回了状态 206。它适用于较小的视频,但不适用于大型视频。请注意,我没有明确发送实际字节范围,而是将整个流传送到网络服务器。我收到以下错误:
org.eclipse.jetty.io.EofException,
这发生在后端数据服务器中,该服务器将整个输入流提供给 servlet,而码头是正在使用的服务器。我不确定这个过程是如何实际播放和更正我需要的搜索功能的,但现在视频在播放一段时间后失败了。浏览器调试器也出现如下错误:
ERR_CONTENT_LENGTH_MISMATCH
我同时请求和播放一个音频流,因为我不知道如何混合这两个流。
感谢任何想法或建议。
编辑:
感谢建议将resourcehandler改为defaultservlet;不知道在哪里做这个所以找到了代码中的实例:
private void addHttpContexts(ConfigNode cnode) throws Exception {
try {
// get all the http context nodes
ConfigNode[] httpContextNodes = cnode.getChildNode("HttpContextList").getChildNodes();
for (int s = 0; s < httpContextNodes.length; s++) {
String urlPath = httpContextNodes[s].getChildNode("ContextPath").getStringValueEx();
String resourceBase = httpContextNodes[s].getChildNode("ResourceBase").getStringValueEx();
ArrayList<String> welcomeFileList = new ArrayList<String>();
if (httpContextNodes[s].hasChildNode("WelcomeFile")) {
String welcomeFile = httpContextNodes[s].getChildNode("WelcomeFile").getStringValueEx();
welcomeFileList.add(welcomeFile);
}
ContextHandler context = new ContextHandler(contexts, urlPath);
ResourceHandler resourceHandler = new ResourceHandler();
resourceHandler.setResourceBase(resourceBase);
resourceHandler.setWelcomeFiles((String[]) welcomeFileList.toArray(new String[welcomeFileList.size()]));
context.setHandler(resourceHandler);
} catch (Exception ex) {
trace.warning("Configuration of http contexts failed", ex);
throw ex;
}
}
setResourceBase(resourceBase) 和
setWelcomeFiles((String[]) welcomeFileList.toArray(new String[welcomeFileList.size()]));
这是同一个地方的另一个地方class我找到了DefaultSErvlet
ServletHolder holderDefault = new ServletHolder("default",DefaultServlet.class);
holderDefault.setInitParameter("dirAllowed","false");
并且已经在 web.xml
中定义
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
<init-param>
<param-name>dirAllowed</param-name>
<param-value>false</param-value>
</init-param>
</servlet>
默认情况下,Jetty 的 DefaultServlet
将正确处理 Jetty 本身提供的静态内容的范围请求。
Jetty 中没有其他组件自行处理范围请求。
如果您有自定义代码、您自己的 Servlet、您自己的 Jetty 处理程序、REST 端点、专用过滤器、spring-mvc 设置等...那么您必须自己处理范围请求。
这是因为网络服务器支持自定义代码非常不切实际。 (它必须从自定义代码请求全部内容,然后只将特定字节范围发送给请求客户端)。
我终于在 chrome 中使用 headers Content-Range 等搜索功能播放了视频,并返回了状态 206。它适用于较小的视频,但不适用于大型视频。请注意,我没有明确发送实际字节范围,而是将整个流传送到网络服务器。我收到以下错误:
org.eclipse.jetty.io.EofException,
这发生在后端数据服务器中,该服务器将整个输入流提供给 servlet,而码头是正在使用的服务器。我不确定这个过程是如何实际播放和更正我需要的搜索功能的,但现在视频在播放一段时间后失败了。浏览器调试器也出现如下错误:
ERR_CONTENT_LENGTH_MISMATCH
我同时请求和播放一个音频流,因为我不知道如何混合这两个流。
感谢任何想法或建议。
编辑:
感谢建议将resourcehandler改为defaultservlet;不知道在哪里做这个所以找到了代码中的实例:
private void addHttpContexts(ConfigNode cnode) throws Exception {
try {
// get all the http context nodes
ConfigNode[] httpContextNodes = cnode.getChildNode("HttpContextList").getChildNodes();
for (int s = 0; s < httpContextNodes.length; s++) {
String urlPath = httpContextNodes[s].getChildNode("ContextPath").getStringValueEx();
String resourceBase = httpContextNodes[s].getChildNode("ResourceBase").getStringValueEx();
ArrayList<String> welcomeFileList = new ArrayList<String>();
if (httpContextNodes[s].hasChildNode("WelcomeFile")) {
String welcomeFile = httpContextNodes[s].getChildNode("WelcomeFile").getStringValueEx();
welcomeFileList.add(welcomeFile);
}
ContextHandler context = new ContextHandler(contexts, urlPath);
ResourceHandler resourceHandler = new ResourceHandler();
resourceHandler.setResourceBase(resourceBase);
resourceHandler.setWelcomeFiles((String[]) welcomeFileList.toArray(new String[welcomeFileList.size()]));
context.setHandler(resourceHandler);
} catch (Exception ex) {
trace.warning("Configuration of http contexts failed", ex);
throw ex;
}
}
setResourceBase(resourceBase) 和 setWelcomeFiles((String[]) welcomeFileList.toArray(new String[welcomeFileList.size()]));
这是同一个地方的另一个地方class我找到了DefaultSErvlet
ServletHolder holderDefault = new ServletHolder("default",DefaultServlet.class);
holderDefault.setInitParameter("dirAllowed","false");
并且已经在 web.xml
中定义 <servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
<init-param>
<param-name>dirAllowed</param-name>
<param-value>false</param-value>
</init-param>
</servlet>
默认情况下,Jetty 的 DefaultServlet
将正确处理 Jetty 本身提供的静态内容的范围请求。
Jetty 中没有其他组件自行处理范围请求。
如果您有自定义代码、您自己的 Servlet、您自己的 Jetty 处理程序、REST 端点、专用过滤器、spring-mvc 设置等...那么您必须自己处理范围请求。
这是因为网络服务器支持自定义代码非常不切实际。 (它必须从自定义代码请求全部内容,然后只将特定字节范围发送给请求客户端)。