Jwplayer 读取服务端文件出错?

奇hu安达 发布于 2012/02/28 16:19
阅读 3K+
收藏 1
jwplayer("containerFlv").setup({
        flashplayer: "<%=basePath %>js/jwplayer/player.swf",  
        file: "<%=basePath %>playerServlet?resourceId=11111",   // 方式1
        //file:"<%=basePath %>js/jwplayer/video.flv" ,            // 方式2
        height: 520,
        width: 700,
        image: "<%=basePath %>image/2008921593331_2.jpg"
       }
    );

FLV FILE : 使用方式1 视频显示不出来。。

附上PlayerServlet部门代码:

File f = new File("f:/test/test.flv");
    if(f.exists()){
     response.setHeader("Content-Length", "" + 1024000000);   
     response.setContentType("application/x-shockwave-flash");
     
     FileInputStream is = new FileInputStream(f);
     PrintWriter pw = response.getWriter();
     int k;
     while ((k = is.read()) != -1) {
      pw.write(k);
     }
     pw.flush();
     pw.close();
     is.close();
     is = null;
}

是参数配置的不对,还是服务端输出有问题?

以下是问题补充:

@奇hu安达:红薯,根据你的提示,我将Content_type设置为video/x-flv 接下来JWplayer 出现这个错误:Task Queue failed at step 5: Playlist could not be loaded: Playlist file did not contain a valid playlist (2012/02/28 16:44)
@霸气千秋:http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12534/video-delivery-http-pseudo-streaming (2012/10/22 17:59)
加载中
0
红薯
红薯
flv 的 content-type 应该是 video/x-flv
0
奇hu安达
奇hu安达

解决了,谢谢红薯...

后面从文档找到了.Http Streaming 配置方式

provider:'http',

返回顶部
顶部