File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Problems with Servlet and Windows Playing Videos from Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problems with Servlet and Windows Playing Videos from Servlet" Watch "Problems with Servlet and Windows Playing Videos from Servlet" New topic
Author

Problems with Servlet and Windows Playing Videos from Servlet

Michele Smith
Ranch Hand

Joined: Oct 27, 2010
Posts: 412
Hello I have acquired and re-written a servlet, which is as follows in the code. I have confirmed that it is operating properly in my environment and tested it, however, it will not play. I am not sure if I need to redo the code to accept different types of video or if I need to embed Windows Media Player or some other thing that I need to do. Is there anyone who can take a stab at this?

For example, on .flv files, the browser is saying: "The file you are attempting to play has an extension (.flv) that does not match the file format Playing the file may result in unexpected behavior . . . Do you want the player to try to play this content? . . . "



Thanks very much,
Michele

===================================================================================================================================

Dhaval J. Patel
Ranch Hand

Joined: Mar 10, 2011
Posts: 90

I'm not an expert on this, but i dont think you can do much with the code in this case. I guess you will need an flv plugin installed with windows media player to play this file. Not sure though. Try installing an flv plugin for windows media player and see if it works.
Michele Smith
Ranch Hand

Joined: Oct 27, 2010
Posts: 412
Hello thanks, what is happening upon closer inspection is that the filename is coming across consistently in each case, however, the physical file is not coming across.

Do you see any problems with the way the file is assembled in this servlet?

Thanks,
Michele
Michele Smith
Ranch Hand

Joined: Oct 27, 2010
Posts: 412
What I noticed was this:




It appears that there is a file name which is passing, but the entire video itself is not passing. I wonder if this is related to the tokens and if there is a workaround to using tokens.
Dhaval J. Patel
Ranch Hand

Joined: Mar 10, 2011
Posts: 90

I don't know what you are trying to do with this servlet, but there are a few things I noticed.

1) There is so much unused code in this servlet. The json strings that you are trying creating in your servlet are not being used at all. Did you notice that ? The file name or tokens or whatever is present in the json string has no effect at all. ( Another thing regarding json, Use some open source json api instead of creating json strings yourself. Creating it by hand would be vulnerable to bugs.)

2) I dont know why you dont get a MalformedURLException when you are trying to create a new Url on line 201 ??!! Also the targetURL2 and targetURL3 are never used.

The only thing that seems okay about the code is the part where you are trying to get an input stream and writing it out using bytearrayoutpoutstream. It seems that you have blindly copied code and trying to make it work without understanding it. Please try to understand what you want in your program and what you want to achieve.

And the video file name is getting through probably because of the code on line 110. not sure.
 
wood burning stoves
 
subject: Problems with Servlet and Windows Playing Videos from Servlet