访问本地媒体文件以在 FlowPLayer 中播放
我想访问本地媒体文件(例如 .mp4 文件)以在 Firefox 浏览器上的 FlowPLayer 中播放。
我的应用程序基于 JSF 和 RF3.3 以及 JBoss 服务器。
问题出在我的支持 bean 上,说我已经编写了一个名为 test.mp4 的文件名,并且 WEB-INF 文件夹中也存在该文件名。FlowPlayer 将使用以下方式访问此文件:-
http://IP/ContextPath/WEB-INF/test.mp4
但现在假设我在系统的 D: 驱动器中放置了一个文件。本地服务器正在我的系统上运行。我想访问保存在 D: 驱动器中的文件并在 flowplayer 中播放...
FlowPlayer 总是附加 http://IP/ 到文件名,因此它不会播放媒体文件。
有什么方法可以允许流播放器访问系统上的本地文件...
我认为可以使用 Apache 来完成。 ..但是如何/??...
I want to access local media file say .mp4 file to play in FlowPLayer on Firefox browser..
My application is based on JSF and RF3.3 with JBoss server.
Problem is in my backing bean say I have written a file name as test.mp4 and the same is being present in WEB-INF folder..FlowPlayer will access this file using:-
http://IP/ContextPath/WEB-INF/test.mp4
But now say suppose I have a file placed in my D: drive on my system. The local server is running on my system.I want to access the file kept in D: drive and play it in flowplayer...
FlowPlayer always append http://IP/ to the file name and as such it won't play the media file..
Is there any way out to allow flow player to access local file on the system...
I figured that it can be done using Apache...But how/??...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该组件接受必须可从客户端浏览器访问的 URL,因此像
file:///C:/resources/foo.mp4
这样的 URL 将不起作用。您尝试引用的资源文件必须可以从 Web 上下文访问。这并不是说您不能将文件资源存储在计算机的 D: 上,而是您需要像 Apache 这样的 Web 服务器来访问该文件夹位置作为 Web 上下文文件夹。它可以配置为执行此操作,但我不会详细介绍如何执行此操作,如果您遇到问题,那么您应该向 ServerFault StackExchange 站点以获取有关此问题的帮助。需要记住的一件事是,您的 Web 应用程序可能已配置为项目的 WEB-INF 文件夹中的任何资源都可能设置为应用程序的上下文路径。因此,如果您要将 MP4 文件放入您的 Web 应用程序中(我建议不要这样做,这些文件很大),那么可以从
http://site:port/applicationcontext/resources/foo.mp4 访问它
但在磁盘上它是WEB-INF/resources/foo.mp4
。我设置的最佳方法是设置一个 Apache 前端,用于监听特定端口上的 Web 流量,然后使用 mod_jk 模块,您可以让 Apache 转发对以下资源的请求: >http://site:port/applicationcontext/ 到 AJP 端口上的应用程序服务器。我喜欢这种设置,因为我可以在 Web 服务器的 ROOT 上下文中保留大量静态资源,并通过将应用程序服务器完全置于防火墙后面且无法从外部访问来保护我的应用程序服务器。应用程序服务器只能通过 Apache Web 服务器访问,这意味着安全性更高。有关此类设置的更多信息,请参阅有关如何使用 Tomcat 设置 Apache Web Connector 的示例指南。 http://tomcat.apache.org/connectors-doc/webserver_howto/apache。 html
The component accepts a URL that must be accessible from the client browser, thus a url like
file:///C:/resources/foo.mp4
would not work. The resource file you are trying to reference must be accessible from a web context. That is not to say that you can't store the file resources on the D: of your machine, but you would need a web server like Apache to access that folder location as a web context folder. It can be configured to do this, but I will not go into the details of how to do this, if you have trouble with that then you should post a question to the ServerFault StackExchange site for help with this.One thing to keep in mind is that your web application is likely configured that any resources within the
WEB-INF
folder of your project is likely set to be the context path of your application. Thus if you you were to place your MP4 file in your web app (i advice against it, those files are enormous), then it would be accessible fromhttp://site:port/applicationcontext/resources/foo.mp4
but on disk it isWEB-INF/resources/foo.mp4
.The best way that I set this up is to set up an Apache front end that is listening for web traffic on the specific port, then using the
mod_jk
module you can have Apache forward requests for resources athttp://site:port/applicationcontext/
to your application server on the AJP port. I like this setup because I can keep large static resources at the ROOT context of the web server, as well as protect my application server by keeping it completely behind a firewall and inaccessible from the outside. The application server can only be accessed through the Apache web server meaning increased security. For more information on this type of setup, see this example guide on how to setup Apache Web Connector with Tomcat. http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html