Using Flex3 I've created a simple VideoPlayer, it works fine, just as it should. Now i want to embed it into a JSP page. I've written something like this:
The VideoPlayer shows up on the page, it works but it does't play the movie located at D:/video.flv
The war archive is deployed in the JBoss deploy dir. When the movie is in the application archive the player plays the movie, but when the video file is somewhere else, outside the archive (like in this example) then the player doesn't play anything.
My question is how to gain access to the video file which is outside the war file?
First, the url sent needs to be a full web accessible URL, "d:\" only work on your desktop, and outside of a web browser. using "file://" might work, but also only if the browser was on the same machine as the jboss server.
What we need to do is cause that content folder to be served through a HTTP url some how.,
in this case, i would recommend having your jboss app server connected behind an apache server, with mod_jk, perhaps mounted on point /app
so that hitting your page /app/VideoPlayer.jsp would load this page with the flash tags, etc.
and then have the source variable be
where the path /content is mapped to the d:\ folder and is handled by apache , such as a simple directory folder .
Note however this does not enforce any login or security filtering, so anyone with a HTTP client could navigate the contents of the content folder. and thats why we don't have "Options Indexes" in there.
If you did want to continue using just jboss, without getting into using apache, or wanted to have some kind of security filtering, requiring the users to first log in before getting the content, you would need to create a file streamer servlet and have that mapped to (for example, /content/* in your web.xml in your app)
Here is a simple example of this, where it takes the path following the servlet mapping and tries to resolve that to a file name inside the content folder (d:\ in this case)
Where this servlet doesn't do any "is logged in checking", I was thinking a servlet filter would do that for us, mapped to /content/* as well.
If there is no requirement to have users logged in before getting the content, I would recommend letting apache serve the media content, as a native process it might handle high thrughputs better, and certainly would not cause the precious resource of worker threads in jboss to be tied up to serve this static content.
Error: Keyboard not attached. Press F1 to continue.
The solution with a servlet.
As I understand this solution is similar to downloading a file from the server to a local machine, am I right?
What would be the value of the source var in my JSP which I pass to Flex? Just the name of the video file?
No, I think the servlet approach would still need to use a full HTTP front end URL.
JBoss on its own without apache still has an internal HTTP server built into it, the servlet JSP code is only ran within the server, communicating to it with a browser client is done with rendered HTML over HTTP still.
so the url value for 'source' would be the path as would be seen by your web browser connecting to the JBoss service, plus the contextPath of the webapp, and the servletPath we have mapped the content file servlet to, and then the name of the content file within our file system folder.